@dolphjs/cli 0.0.2-beta → 0.1.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.
Files changed (2) hide show
  1. package/new-app.mjs +5 -147
  2. package/package.json +1 -1
package/new-app.mjs CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  const program = new Command();
30
30
 
31
31
  program
32
- .version("1.0.0")
32
+ .version("0.1.1")
33
33
  .command("create-app <app-name>")
34
34
  .description("Create a new dolphJs application")
35
35
  .action(async (appName) => {
@@ -149,153 +149,9 @@ program
149
149
  const spinner2 = ora("Installing dev dependencies...").start();
150
150
 
151
151
  if (selectedOption === jsFunc || selectedOption === jsOop) {
152
- execSync(`${installCommand} ${devDependencies.join(" ")}`);
152
+ execSync(`${installCommand} ${devDependencies.join(" ")} -D`);
153
153
  } else if (selectedOption === tsFunc || selectedOption === tsOop) {
154
- execSync(`${installCommand} ${tsDevDependencies.join(" ")}`);
155
- }
156
-
157
- spinner2.succeed("Dev dependencies installed!");
158
-
159
- // show completion message
160
- console.log(
161
- chalk.green(
162
- `Done! Your app has been created. Navigate to your app by running "cd ${appName}" and then run ${chalk.bgGreen(
163
- runMsg
164
- )}`
165
- )
166
- );
167
- } catch (error) {
168
- console.log(chalk.redBright("\nError creating your app", error));
169
- }
170
- } catch (error) {
171
- console.log(chalk.redBright("Error creating your app", error));
172
- }
173
- });
174
-
175
- program
176
- .version("1.0.0")
177
- .command("create-app <app-name>")
178
- .description("Create a new dolphJs application")
179
- .action(async (appName) => {
180
- try {
181
- console.log(
182
- chalk.blueBright("Initializing your dolphJs application...") + "🐬"
183
- );
184
- const options = [tsOop, tsFunc, jsOop, jsFunc];
185
- const { selectedOption } = await inquirer.prompt([
186
- {
187
- type: "list",
188
- name: "selectedOption",
189
- message: "How do you want to write your application ? 🤔:",
190
- choices: options,
191
- },
192
- ]);
193
-
194
- const packageManagerOptions = [npm, yarn, pnpm];
195
- const { selectedPackageManagerOption } = await inquirer.prompt([
196
- {
197
- type: "list",
198
- name: "selectedPackageManagerOption",
199
- message: "Which is your preffered package manager ? :",
200
- choices: packageManagerOptions,
201
- },
202
- ]);
203
- console.info(chalk.green(`Using ${selectedPackageManagerOption}!`));
204
- console.log(
205
- chalk.green(`Getting your application ready for ${selectedOption}!`)
206
- );
207
- mkdirSync(appName);
208
- process.chdir(appName);
209
- if (selectedOption === tsOop) {
210
- writeTsFilePackage(appName);
211
- writeTsFileSwcrc();
212
- writeGitignoreFile();
213
- writeTsNodemonFile();
214
- writeReadmeFile();
215
- writeTsconfigFile();
216
- mkdirSync("src");
217
- mkdirSync("src/config");
218
- mkdirSync("src/controllers");
219
- mkdirSync("src/interfaces");
220
- mkdirSync("src/routes");
221
- writeTsOopSubFile();
222
- }
223
- if (selectedOption === tsFunc) {
224
- writeTsFuncFilePackage(appName);
225
- writeTsFileSwcrc();
226
- writeGitignoreFile();
227
- writeTsNodemonFile();
228
- writeTsconfigFile();
229
- writeReadmeFile();
230
- mkdirSync("src");
231
- mkdirSync("src/config");
232
- mkdirSync("src/controllers");
233
- mkdirSync("src/routes");
234
- writeTsFuncSubFile();
235
- }
236
-
237
- if (selectedOption === jsFunc) {
238
- writeJsFIlePackage(appName);
239
- writeReadmeFile();
240
- writeGitignoreFile();
241
- mkdirSync("src");
242
- mkdirSync("src/config");
243
- mkdirSync("src/controllers");
244
- mkdirSync("src/routes");
245
- writeSubFileJsFunc();
246
- }
247
-
248
- if (selectedOption === jsOop) {
249
- writeJsFIlePackage(appName);
250
- writeReadmeFile();
251
- writeGitignoreFile();
252
- mkdirSync("src");
253
- mkdirSync("src/config");
254
- mkdirSync("src/controllers");
255
- mkdirSync("src/routes");
256
- writeSubFileJsOop();
257
- }
258
-
259
- // install dependencies using child process execSync
260
- try {
261
- const spinner = ora("Installing dependencies...").start();
262
- let installCommand = "yarn add";
263
- let runMsg = "yarn dev";
264
-
265
- switch (selectedPackageManagerOption) {
266
- case npm:
267
- installCommand = "npm install";
268
- runMsg = "npm run dev";
269
- break;
270
- case pnpm:
271
- installCommand = "pnpm add";
272
- runMsg = "pnpm dev";
273
- case yarn:
274
- installCommand = installCommand;
275
- default:
276
- break;
277
- }
278
-
279
- if (selectedOption === jsFunc || selectedOption === jsOop) {
280
- execSync(`${installCommand} ${dependencies.join(" ")}`);
281
- } else if (selectedOption === tsFunc || selectedOption === tsOop) {
282
- execSync(`${installCommand} ${tsDependencies.join(" ")}`);
283
- }
284
- spinner.succeed("Dependencies installed!");
285
-
286
- // prompt user to select an option
287
-
288
- // create app directory and copy files
289
-
290
- // update package.json file
291
- console.log(chalk.yellow("Updating package.json..."));
292
- // install dev dependencies
293
- const spinner2 = ora("Installing dev dependencies...").start();
294
-
295
- if (selectedOption === jsFunc || selectedOption === jsOop) {
296
- exec(`${installCommand} ${devDependencies.join(" ")}`);
297
- } else if (selectedOption === tsFunc || selectedOption === tsOop) {
298
- exec(`${installCommand} ${tsDevDependencies.join(" ")}`);
154
+ execSync(`${installCommand} ${tsDevDependencies.join(" ")} -D`);
299
155
  }
300
156
 
301
157
  spinner2.succeed("Dev dependencies installed!");
@@ -309,9 +165,11 @@ program
309
165
  process.exit(1);
310
166
  } catch (error) {
311
167
  console.log(chalk.redBright("\nError creating your app", error));
168
+ process.exit(1);
312
169
  }
313
170
  } catch (error) {
314
171
  console.log(chalk.redBright("Error creating your app", error));
172
+ process.exit(1);
315
173
  }
316
174
  });
317
175
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolphjs/cli",
3
- "version": "0.0.2beta",
3
+ "version": "0.1.1",
4
4
  "description": "DolphJs is an express.js library for making software development easier by taking care of all the unneccessary tasks developers have to worry about.",
5
5
  "main": "new-app.mjs",
6
6
  "bin": {