create-awesome-node-app 0.3.4 → 0.3.6

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/dist/index.cjs CHANGED
@@ -3516,12 +3516,15 @@ var getCnaOptions = async (options) => {
3516
3516
  initial: 1
3517
3517
  },
3518
3518
  {
3519
- type: "toggle",
3520
- name: "useNpm",
3521
- message: "Use `npm` mandatorily?",
3522
- initial: options.useNpm,
3523
- active: "yes",
3524
- inactive: "no"
3519
+ type: "select",
3520
+ name: "packageManager",
3521
+ message: "What package manager do you want to use?",
3522
+ choices: [
3523
+ { title: "npm", value: "npm" },
3524
+ { title: "yarn", value: "yarn" },
3525
+ { title: "pnpm", value: "pnpm" }
3526
+ ],
3527
+ initial: 0
3525
3528
  },
3526
3529
  {
3527
3530
  type: "select",
@@ -3564,20 +3567,12 @@ var getCnaOptions = async (options) => {
3564
3567
  }
3565
3568
  ]
3566
3569
  );
3567
- const defaultSrcDir = options.srcDir;
3570
+ const existingTemplate = templates.find(
3571
+ (template) => template.type === templateInput.template
3572
+ );
3573
+ const templateTemplateOrExtension = baseInput.category === "custom" ? templateInput.template : (_a = templates.find((template) => template.type === templateInput.template)) == null ? void 0 : _a.url;
3574
+ const customOptions = (existingTemplate == null ? void 0 : existingTemplate.customOptions) || [];
3568
3575
  const appConfig = await (0, import_prompts.default)([
3569
- {
3570
- type: "text",
3571
- name: "srcDir",
3572
- message: "Sub directory to put all source content (.e.g. `src`, `app`). Leave blank to use the root directory.",
3573
- initial: defaultSrcDir
3574
- },
3575
- {
3576
- type: "text",
3577
- name: "alias",
3578
- message: "Import alias to use for the project, e.g. `@`",
3579
- initial: options.alias
3580
- },
3581
3576
  // The following prompts are placeholders for future inputs
3582
3577
  {
3583
3578
  type: null,
@@ -3590,7 +3585,9 @@ var getCnaOptions = async (options) => {
3590
3585
  name: "extend",
3591
3586
  message: "Enter extra extensions",
3592
3587
  initial: 0
3593
- }
3588
+ },
3589
+ // The following prompts are for custom options
3590
+ ...customOptions
3594
3591
  ]);
3595
3592
  appConfig.templatesOrExtensions = [];
3596
3593
  appConfig.extend = [];
@@ -3638,16 +3635,16 @@ var getCnaOptions = async (options) => {
3638
3635
  appConfig.extend = extend;
3639
3636
  }
3640
3637
  const { ...nextAppOptions } = {
3638
+ extend: [],
3641
3639
  ...options,
3642
3640
  ...baseInput,
3643
3641
  ...templateInput,
3644
3642
  ...appConfig
3645
3643
  };
3646
- const templateTemplateOrExtension = baseInput.category === "custom" ? templateInput.template : (_a = templates.find((template) => template.type === templateInput.template)) == null ? void 0 : _a.url;
3647
3644
  const templatesOrExtensions = [
3648
3645
  templateTemplateOrExtension,
3649
- ...nextAppOptions.templatesOrExtensions,
3650
- ...nextAppOptions.extend
3646
+ ...nextAppOptions.templatesOrExtensions || [],
3647
+ ...nextAppOptions.extend || []
3651
3648
  ].filter(Boolean).map((templateOrExtension) => ({ url: templateOrExtension }));
3652
3649
  const nextOptions = { ...nextAppOptions, templatesOrExtensions };
3653
3650
  if (nextAppOptions.verbose) {
@@ -3659,7 +3656,7 @@ var getCnaOptions = async (options) => {
3659
3656
  // package.json
3660
3657
  var package_default = {
3661
3658
  name: "create-awesome-node-app",
3662
- version: "0.3.4",
3659
+ version: "0.3.6",
3663
3660
  type: "module",
3664
3661
  description: "Command line tool to create Node apps with a lot of different templates and extensions.",
3665
3662
  license: "MIT",
@@ -3724,20 +3721,10 @@ var main = async () => {
3724
3721
  let projectName = "my-project";
3725
3722
  import_commander.default.version(package_default.version).arguments("[project-directory]").usage(`${import_chalk.default.green("[project-directory]")} [options]`).action((name) => {
3726
3723
  projectName = name || projectName;
3727
- }).option("--verbose", "print additional logs").option("--info", "print environment debug info").option("--use-npm", "use npm mandatorily").option(
3728
- "--template <template>",
3729
- "specify template to use for initial setup"
3730
- ).option(
3731
- "--extend <repos...>",
3732
- "git repositories to extend your boilerplate"
3733
- ).option("-a, --alias <alias>", "Import alias to use for the project", "@").option(
3734
- "--src-dir <src-dir>",
3735
- "dir name to put content under [src]/",
3736
- "src"
3737
- ).option(
3724
+ }).option("--verbose", "print additional logs").option("--info", "print environment debug info").option(
3738
3725
  "--nodeps",
3739
3726
  "generate package.json file without installing dependencies"
3740
- ).option("--inplace", "apply setup to an existing project").parse(process.argv);
3727
+ ).parse(process.argv);
3741
3728
  const latest = await (0, import_core.checkForLatestVersion)("create-awesome-node-app");
3742
3729
  if (latest && import_semver.default.lt(package_default.version, latest)) {
3743
3730
  console.log();
@@ -3748,7 +3735,6 @@ var main = async () => {
3748
3735
  We recommend always using the latest version of create-awesome-node-app if possible.`
3749
3736
  )
3750
3737
  );
3751
- return;
3752
3738
  }
3753
3739
  return (0, import_core.createNodeApp)(
3754
3740
  projectName,
package/dist/index.js CHANGED
@@ -3522,12 +3522,15 @@ var getCnaOptions = async (options) => {
3522
3522
  initial: 1
3523
3523
  },
3524
3524
  {
3525
- type: "toggle",
3526
- name: "useNpm",
3527
- message: "Use `npm` mandatorily?",
3528
- initial: options.useNpm,
3529
- active: "yes",
3530
- inactive: "no"
3525
+ type: "select",
3526
+ name: "packageManager",
3527
+ message: "What package manager do you want to use?",
3528
+ choices: [
3529
+ { title: "npm", value: "npm" },
3530
+ { title: "yarn", value: "yarn" },
3531
+ { title: "pnpm", value: "pnpm" }
3532
+ ],
3533
+ initial: 0
3531
3534
  },
3532
3535
  {
3533
3536
  type: "select",
@@ -3570,20 +3573,12 @@ var getCnaOptions = async (options) => {
3570
3573
  }
3571
3574
  ]
3572
3575
  );
3573
- const defaultSrcDir = options.srcDir;
3576
+ const existingTemplate = templates.find(
3577
+ (template) => template.type === templateInput.template
3578
+ );
3579
+ const templateTemplateOrExtension = baseInput.category === "custom" ? templateInput.template : (_a = templates.find((template) => template.type === templateInput.template)) == null ? void 0 : _a.url;
3580
+ const customOptions = (existingTemplate == null ? void 0 : existingTemplate.customOptions) || [];
3574
3581
  const appConfig = await prompts([
3575
- {
3576
- type: "text",
3577
- name: "srcDir",
3578
- message: "Sub directory to put all source content (.e.g. `src`, `app`). Leave blank to use the root directory.",
3579
- initial: defaultSrcDir
3580
- },
3581
- {
3582
- type: "text",
3583
- name: "alias",
3584
- message: "Import alias to use for the project, e.g. `@`",
3585
- initial: options.alias
3586
- },
3587
3582
  // The following prompts are placeholders for future inputs
3588
3583
  {
3589
3584
  type: null,
@@ -3596,7 +3591,9 @@ var getCnaOptions = async (options) => {
3596
3591
  name: "extend",
3597
3592
  message: "Enter extra extensions",
3598
3593
  initial: 0
3599
- }
3594
+ },
3595
+ // The following prompts are for custom options
3596
+ ...customOptions
3600
3597
  ]);
3601
3598
  appConfig.templatesOrExtensions = [];
3602
3599
  appConfig.extend = [];
@@ -3644,16 +3641,16 @@ var getCnaOptions = async (options) => {
3644
3641
  appConfig.extend = extend;
3645
3642
  }
3646
3643
  const { ...nextAppOptions } = {
3644
+ extend: [],
3647
3645
  ...options,
3648
3646
  ...baseInput,
3649
3647
  ...templateInput,
3650
3648
  ...appConfig
3651
3649
  };
3652
- const templateTemplateOrExtension = baseInput.category === "custom" ? templateInput.template : (_a = templates.find((template) => template.type === templateInput.template)) == null ? void 0 : _a.url;
3653
3650
  const templatesOrExtensions = [
3654
3651
  templateTemplateOrExtension,
3655
- ...nextAppOptions.templatesOrExtensions,
3656
- ...nextAppOptions.extend
3652
+ ...nextAppOptions.templatesOrExtensions || [],
3653
+ ...nextAppOptions.extend || []
3657
3654
  ].filter(Boolean).map((templateOrExtension) => ({ url: templateOrExtension }));
3658
3655
  const nextOptions = { ...nextAppOptions, templatesOrExtensions };
3659
3656
  if (nextAppOptions.verbose) {
@@ -3665,7 +3662,7 @@ var getCnaOptions = async (options) => {
3665
3662
  // package.json
3666
3663
  var package_default = {
3667
3664
  name: "create-awesome-node-app",
3668
- version: "0.3.4",
3665
+ version: "0.3.6",
3669
3666
  type: "module",
3670
3667
  description: "Command line tool to create Node apps with a lot of different templates and extensions.",
3671
3668
  license: "MIT",
@@ -3730,20 +3727,10 @@ var main = async () => {
3730
3727
  let projectName = "my-project";
3731
3728
  import_commander.default.version(package_default.version).arguments("[project-directory]").usage(`${import_chalk.default.green("[project-directory]")} [options]`).action((name) => {
3732
3729
  projectName = name || projectName;
3733
- }).option("--verbose", "print additional logs").option("--info", "print environment debug info").option("--use-npm", "use npm mandatorily").option(
3734
- "--template <template>",
3735
- "specify template to use for initial setup"
3736
- ).option(
3737
- "--extend <repos...>",
3738
- "git repositories to extend your boilerplate"
3739
- ).option("-a, --alias <alias>", "Import alias to use for the project", "@").option(
3740
- "--src-dir <src-dir>",
3741
- "dir name to put content under [src]/",
3742
- "src"
3743
- ).option(
3730
+ }).option("--verbose", "print additional logs").option("--info", "print environment debug info").option(
3744
3731
  "--nodeps",
3745
3732
  "generate package.json file without installing dependencies"
3746
- ).option("--inplace", "apply setup to an existing project").parse(process.argv);
3733
+ ).parse(process.argv);
3747
3734
  const latest = await checkForLatestVersion("create-awesome-node-app");
3748
3735
  if (latest && semver.lt(package_default.version, latest)) {
3749
3736
  console.log();
@@ -3754,7 +3741,6 @@ var main = async () => {
3754
3741
  We recommend always using the latest version of create-awesome-node-app if possible.`
3755
3742
  )
3756
3743
  );
3757
- return;
3758
3744
  }
3759
3745
  return createNodeApp(
3760
3746
  projectName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-awesome-node-app",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "type": "module",
5
5
  "description": "Command line tool to create Node apps with a lot of different templates and extensions.",
6
6
  "license": "MIT",