create-proyect-cli 1.2.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.idea/misc.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager">
4
- <output url="file://$PROJECT_DIR$/out" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/proyecto-cli.iml" filepath="$PROJECT_DIR$/.idea/proyecto-cli.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="inheritedJdk" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- </component>
9
- </module>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- </component>
6
- </project>
@@ -1,42 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ChangeListManager">
4
- <list default="true" id="93d8c761-14c3-4e66-a6c8-d6d7dd32ccbc" name="Changes" comment="" />
5
- <option name="SHOW_DIALOG" value="false" />
6
- <option name="HIGHLIGHT_CONFLICTS" value="true" />
7
- <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
8
- <option name="LAST_RESOLUTION" value="IGNORE" />
9
- </component>
10
- <component name="Git.Settings">
11
- <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
12
- </component>
13
- <component name="MarkdownSettingsMigration">
14
- <option name="stateVersion" value="1" />
15
- </component>
16
- <component name="ProjectColorInfo"><![CDATA[{
17
- "associatedIndex": 2
18
- }]]></component>
19
- <component name="ProjectId" id="2YjKv1QmTTAAV7hcUdNJSCVbWTh" />
20
- <component name="ProjectViewState">
21
- <option name="hideEmptyMiddlePackages" value="true" />
22
- <option name="showLibraryContents" value="true" />
23
- </component>
24
- <component name="PropertiesComponent"><![CDATA[{
25
- "keyToString": {
26
- "RunOnceActivity.OpenProjectViewOnStart": "true",
27
- "RunOnceActivity.ShowReadmeOnStart": "true",
28
- "git-widget-placeholder": "Dev"
29
- }
30
- }]]></component>
31
- <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
32
- <component name="TaskManager">
33
- <task active="true" id="Default" summary="Default task">
34
- <changelist id="93d8c761-14c3-4e66-a6c8-d6d7dd32ccbc" name="Changes" comment="" />
35
- <created>1701033776269</created>
36
- <option name="number" value="Default" />
37
- <option name="presentableId" value="Default" />
38
- <updated>1701033776269</updated>
39
- </task>
40
- <servers />
41
- </component>
42
- </project>
package/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "node" # Usa la última versión de Node.js
4
-
5
- deploy:
6
- provider: npm
7
- email: "microsystemags@hotmail.com" # Tu dirección de correo electrónico asociada con tu cuenta de npm
8
- api_key: "$NPM_TOKEN" # Configura esta variable de entorno en la configuración de Travis CI
9
-
10
- branches:
11
- only:
12
- - main # O el nombre de la rama que desees
package/index.js DELETED
@@ -1,192 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { exec } from 'child_process';
4
- import inquirer from 'inquirer';
5
- import ora from 'ora';
6
- import figlet from 'figlet';
7
- import fs from 'fs'
8
- import path from 'path';
9
-
10
- // Función para clonar un repositorio
11
- function cloneRepository(repoUrl, cloneLocation) {
12
- const cloneCommand = `git clone ${repoUrl} ${cloneLocation}`;
13
- const cloneSpinner = ora('Clonando repositorio...').start();
14
-
15
- exec(cloneCommand, (error, stdout, stderr) => {
16
- if (error) {
17
- cloneSpinner.fail(`Error al clonar el repositorio: ${stderr}`);
18
- } else {
19
- cloneSpinner.succeed(`Repositorio clonado exitosamente en: ${cloneLocation}`);
20
- }
21
- });
22
- }
23
-
24
- //Funcion para instalar dependencias
25
- function installdependencias(location) {
26
- const install = 'npm install';
27
- const installSpinner = ora('Instalando Dependencias..').start();
28
- exec(`cd ${location}`, (error, stdout, stderr) => {
29
- if (error) {
30
- installSpinner.fail(`Error al ingresar a la carpeta: ${stderr}`)
31
- } else {
32
- exec(install, (error, stdout, stderr) => {
33
- if (error) {
34
- installSpinner.fail(`Error al Instalar las dependecias: ${stderr}`);
35
- } else {
36
- installSpinner.succeed('Dependencias Instaladas Exitosamente');
37
- }
38
- });
39
- }
40
- });
41
- }
42
-
43
- //Funcion para eliminar repo local
44
- function deleterepo(location) {
45
- const deleteSpinner = ora('Eliminando Repositorio Local..').start();
46
-
47
- if (fs.existsSync(location)) {
48
- fs.readdirSync(location).forEach((archivo) => {
49
- const archivoPath = path.join(location, archivo);
50
-
51
- if (fs.lstatSync(archivoPath).isDirectory()) {
52
- // Llamamos recursivamente a la función para eliminar el subdirectorio
53
- deleterepo(archivoPath);
54
- } else {
55
- // Si es un archivo, lo eliminamos
56
- fs.unlinkSync(archivoPath);
57
- }
58
- });
59
-
60
- // Finalmente, eliminamos el directorio
61
- fs.rmdir(location, (error) => {
62
- if (error) {
63
- deleteSpinner.fail(`Error al Eliminar el repositorio: ${error}`);
64
- } else {
65
- deleteSpinner.succeed('Directorio eliminado correctamente.');
66
- }
67
- });
68
- } else {
69
- deleteSpinner.fail('El directorio no existe.');
70
- }
71
- }
72
-
73
- // Función para crear un proyecto en Angular, React o Ionic
74
- function createProject(projectType, projectName) {
75
- let createCommand = '';
76
- let createSpinnerText = '';
77
-
78
- switch (projectType) {
79
- case 'Angular':
80
- createCommand = `npx ng new ${projectName}`;
81
- createSpinnerText = 'Creando proyecto Angular...';
82
- break;
83
- case 'React':
84
- createCommand = `npx create-react-app ${projectName}`;
85
- createSpinnerText = 'Creando proyecto React...';
86
- break;
87
- case 'Ionic':
88
- createCommand = `npx ionic start ${projectName} blank`;
89
- createSpinnerText = 'Creando proyecto Ionic...';
90
- break;
91
- case 'api-express':
92
- createCommand = `git clone https://github.com/CARLOSMARES/api-express.git ${projectName}`;
93
- createSpinnerText = 'Clonando API Express...';
94
- break;
95
- default:
96
- console.error('Tipo de proyecto no reconocido.');
97
- return;
98
- }
99
-
100
- const createSpinner = ora(createSpinnerText).start();
101
-
102
- exec(createCommand, (error, stdout, stderr) => {
103
- if (error) {
104
- createSpinner.fail(`Error al crear el proyecto: ${stderr}`);
105
- } else {
106
- createSpinner.succeed(`Proyecto ${projectName} creado exitosamente.`);
107
- }
108
- });
109
- }
110
-
111
- function createAPIExpress(proyectoname) {
112
- projectType = "api-express";
113
- createProject(projectType, proyectoname);
114
- }
115
-
116
- // Presentación del texto con Figlet
117
- figlet('Create Project CLI', (err, data) => {
118
- if (err) {
119
- console.error('Error al generar el texto de presentación.');
120
- return;
121
- }
122
- console.log(data);
123
-
124
- const questions = [
125
- {
126
- type: 'list',
127
- name: 'action',
128
- message: '¿Qué acción desea realizar?',
129
- choices: ['Clonar repositorio', 'Crear proyecto', 'Instalar Dependencias', 'Eliminar Repositorio Local'],
130
- },
131
- {
132
- type: 'input',
133
- name: 'proyectoname',
134
- message: 'Ingrese el nombre del proyecto:',
135
- when: (answers) => answers.action === 'api-rest',
136
- },
137
- {
138
- type: 'input',
139
- name: 'repoUrl',
140
- message: 'Ingrese la URL del repositorio:',
141
- when: (answers) => answers.action === 'Clonar repositorio',
142
- },
143
- {
144
- type: 'input',
145
- name: 'location',
146
- message: 'Ingrese la URL del repositorio local:',
147
- when: (answers) => answers.action === 'Eliminar Repositorio Local',
148
- default: './',
149
- },
150
- {
151
- type: 'input',
152
- name: 'cloneLocation',
153
- message: 'Ingrese la ubicación donde desea clonar el repositorio:',
154
- when: (answers) => answers.action === 'Clonar repositorio',
155
- default: './',
156
- },
157
- {
158
- type: 'input',
159
- name: 'location',
160
- message: 'Ingrese la ubicación donde desea instalar las dependencias:',
161
- when: (answers) => answers.action === 'Instalar Dependencias',
162
- default: './',
163
- },
164
- {
165
- type: 'list',
166
- name: 'projectType',
167
- message: 'Seleccione el tipo de proyecto:',
168
- choices: ['Angular', 'React', 'Ionic', `api-express`],
169
- when: (answers) => answers.action === 'Crear proyecto',
170
- },
171
- {
172
- type: 'input',
173
- name: 'projectName',
174
- message: 'Ingrese el nombre del proyecto:',
175
- when: (answers) => answers.action === 'Crear proyecto',
176
- },
177
- ];
178
-
179
- inquirer.prompt(questions).then((answers) => {
180
- if (answers.action === 'Clonar repositorio') {
181
- cloneRepository(answers.repoUrl, answers.cloneLocation);
182
- } else if (answers.action === 'Crear proyecto') {
183
- createProject(answers.projectType, answers.projectName);
184
- } else if (answers.action === 'Instalar Dependencias') {
185
- installdependencias(answers.location);
186
- } else if (answers.action === 'Eliminar Repositorio Local') {
187
- deleterepo(answers.location);
188
- } else if (answers.action === 'api-express') {
189
- createAPIExpress(answers.proyectoname);
190
- }
191
- });
192
- });