create-awesome-node-app 0.4.18 → 0.4.19

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
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  "use strict";
3
2
  var __create = Object.create;
4
3
  var __defProp = Object.defineProperty;
@@ -3427,6 +3426,7 @@ var import_semver = __toESM(require("semver"), 1);
3427
3426
  var import_core = require("@create-node-app/core");
3428
3427
 
3429
3428
  // src/options.ts
3429
+ var import_ci_info = require("ci-info");
3430
3430
  var import_prompts = __toESM(require("prompts"), 1);
3431
3431
  var import_yargs = __toESM(require("yargs"), 1);
3432
3432
 
@@ -3491,7 +3491,14 @@ var getExtensionsGroupedByCategory = async (type) => {
3491
3491
 
3492
3492
  // src/options.ts
3493
3493
  import_prompts.default.override(import_yargs.default.argv);
3494
+ var PACKAGE_MANAGERS = ["npm", "yarn", "pnpm"];
3494
3495
  var getCnaOptions = async (options) => {
3496
+ if (import_ci_info.isCI) {
3497
+ if (options.verbose) {
3498
+ console.log(JSON.stringify(options, null, 2));
3499
+ }
3500
+ return options;
3501
+ }
3495
3502
  const categories = await getTemplateCategories();
3496
3503
  const categoriesOptions = [
3497
3504
  ...categories.map((category) => ({
@@ -3515,12 +3522,11 @@ var getCnaOptions = async (options) => {
3515
3522
  type: "select",
3516
3523
  name: "packageManager",
3517
3524
  message: "What package manager do you want to use?",
3518
- choices: [
3519
- { title: "npm", value: "npm" },
3520
- { title: "yarn", value: "yarn" },
3521
- { title: "pnpm", value: "pnpm" }
3522
- ],
3523
- initial: 0
3525
+ choices: PACKAGE_MANAGERS.map((packageManager) => ({
3526
+ title: packageManager,
3527
+ value: packageManager
3528
+ })),
3529
+ initial: options.packageManager ? PACKAGE_MANAGERS.indexOf(options.packageManager) : 0
3524
3530
  },
3525
3531
  {
3526
3532
  type: "select",
@@ -3545,7 +3551,7 @@ var getCnaOptions = async (options) => {
3545
3551
  type: "text",
3546
3552
  name: "template",
3547
3553
  message: "Enter the URL of your template. e.g: https://github.com/username/repository/tree/main/subdir",
3548
- initial: "",
3554
+ initial: options.template,
3549
3555
  validate: (value) => {
3550
3556
  if (!value) {
3551
3557
  return "Template URL is required";
@@ -3652,7 +3658,7 @@ var getCnaOptions = async (options) => {
3652
3658
  // package.json
3653
3659
  var package_default = {
3654
3660
  name: "create-awesome-node-app",
3655
- version: "0.4.18",
3661
+ version: "0.4.19",
3656
3662
  type: "module",
3657
3663
  description: "Command line tool to create Node apps with a lot of different templates and extensions.",
3658
3664
  license: "MIT",
@@ -3699,6 +3705,7 @@ var package_default = {
3699
3705
  dependencies: {
3700
3706
  "@create-node-app/core": "*",
3701
3707
  axios: "^1.5.0",
3708
+ "ci-info": "^3.8.0",
3702
3709
  prompts: "^2.4.1",
3703
3710
  semver: "^5.7.2",
3704
3711
  yargs: "^17.0.1"
@@ -3719,9 +3726,15 @@ var main = async () => {
3719
3726
  import_commander.default.version(package_default.version).arguments("[project-directory]").usage(`${import_chalk.default.green("[project-directory]")} [options]`).action((name) => {
3720
3727
  projectName = name || projectName;
3721
3728
  }).option("--verbose", "print additional logs").option("--info", "print environment debug info").option(
3722
- "--nodeps",
3723
- "generate package.json file without installing dependencies"
3724
- ).parse(process.argv);
3729
+ "--no-install",
3730
+ "Generate package.json without installing dependencies"
3731
+ ).option(
3732
+ "--template <template>",
3733
+ "specify a template for the created project"
3734
+ ).option(
3735
+ "--extend [extensions...]",
3736
+ "specify extensions to apply for the boilerplate generation"
3737
+ ).option("--use-yarn", "use yarn instead of npm or pnpm").option("--use-pnpm", "use pnpm instead of yarn or npm").parse(process.argv);
3725
3738
  (0, import_core.checkNodeVersion)(package_default.engines.node, package_default.name);
3726
3739
  const latest = await (0, import_core.checkForLatestVersion)("create-awesome-node-app");
3727
3740
  if (latest && import_semver.default.lt(package_default.version, latest)) {
@@ -3735,9 +3748,14 @@ We recommend always using the latest version of create-awesome-node-app if possi
3735
3748
  );
3736
3749
  return;
3737
3750
  }
3751
+ const { useYarn, usePnpm, ...opts } = import_commander.default.opts();
3752
+ const packageManager = useYarn ? "yarn" : usePnpm ? "pnpm" : "npm";
3753
+ const templatesOrExtensions = [opts.template].concat(opts.extend || []).filter(Boolean).map((templateOrExtension) => ({
3754
+ url: templateOrExtension
3755
+ }));
3738
3756
  return (0, import_core.createNodeApp)(
3739
3757
  projectName,
3740
- { ...import_commander.default.opts(), projectName },
3758
+ { ...opts, packageManager, templatesOrExtensions, projectName },
3741
3759
  getCnaOptions
3742
3760
  );
3743
3761
  };
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- #!/usr/bin/env node
1
+
2
+ export { }
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -3437,6 +3436,7 @@ import {
3437
3436
  } from "@create-node-app/core";
3438
3437
 
3439
3438
  // src/options.ts
3439
+ import { isCI } from "ci-info";
3440
3440
  import prompts from "prompts";
3441
3441
  import yargs from "yargs";
3442
3442
 
@@ -3501,7 +3501,14 @@ var getExtensionsGroupedByCategory = async (type) => {
3501
3501
 
3502
3502
  // src/options.ts
3503
3503
  prompts.override(yargs.argv);
3504
+ var PACKAGE_MANAGERS = ["npm", "yarn", "pnpm"];
3504
3505
  var getCnaOptions = async (options) => {
3506
+ if (isCI) {
3507
+ if (options.verbose) {
3508
+ console.log(JSON.stringify(options, null, 2));
3509
+ }
3510
+ return options;
3511
+ }
3505
3512
  const categories = await getTemplateCategories();
3506
3513
  const categoriesOptions = [
3507
3514
  ...categories.map((category) => ({
@@ -3525,12 +3532,11 @@ var getCnaOptions = async (options) => {
3525
3532
  type: "select",
3526
3533
  name: "packageManager",
3527
3534
  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
3535
+ choices: PACKAGE_MANAGERS.map((packageManager) => ({
3536
+ title: packageManager,
3537
+ value: packageManager
3538
+ })),
3539
+ initial: options.packageManager ? PACKAGE_MANAGERS.indexOf(options.packageManager) : 0
3534
3540
  },
3535
3541
  {
3536
3542
  type: "select",
@@ -3555,7 +3561,7 @@ var getCnaOptions = async (options) => {
3555
3561
  type: "text",
3556
3562
  name: "template",
3557
3563
  message: "Enter the URL of your template. e.g: https://github.com/username/repository/tree/main/subdir",
3558
- initial: "",
3564
+ initial: options.template,
3559
3565
  validate: (value) => {
3560
3566
  if (!value) {
3561
3567
  return "Template URL is required";
@@ -3662,7 +3668,7 @@ var getCnaOptions = async (options) => {
3662
3668
  // package.json
3663
3669
  var package_default = {
3664
3670
  name: "create-awesome-node-app",
3665
- version: "0.4.18",
3671
+ version: "0.4.19",
3666
3672
  type: "module",
3667
3673
  description: "Command line tool to create Node apps with a lot of different templates and extensions.",
3668
3674
  license: "MIT",
@@ -3709,6 +3715,7 @@ var package_default = {
3709
3715
  dependencies: {
3710
3716
  "@create-node-app/core": "*",
3711
3717
  axios: "^1.5.0",
3718
+ "ci-info": "^3.8.0",
3712
3719
  prompts: "^2.4.1",
3713
3720
  semver: "^5.7.2",
3714
3721
  yargs: "^17.0.1"
@@ -3729,9 +3736,15 @@ var main = async () => {
3729
3736
  import_commander.default.version(package_default.version).arguments("[project-directory]").usage(`${import_chalk.default.green("[project-directory]")} [options]`).action((name) => {
3730
3737
  projectName = name || projectName;
3731
3738
  }).option("--verbose", "print additional logs").option("--info", "print environment debug info").option(
3732
- "--nodeps",
3733
- "generate package.json file without installing dependencies"
3734
- ).parse(process.argv);
3739
+ "--no-install",
3740
+ "Generate package.json without installing dependencies"
3741
+ ).option(
3742
+ "--template <template>",
3743
+ "specify a template for the created project"
3744
+ ).option(
3745
+ "--extend [extensions...]",
3746
+ "specify extensions to apply for the boilerplate generation"
3747
+ ).option("--use-yarn", "use yarn instead of npm or pnpm").option("--use-pnpm", "use pnpm instead of yarn or npm").parse(process.argv);
3735
3748
  checkNodeVersion(package_default.engines.node, package_default.name);
3736
3749
  const latest = await checkForLatestVersion("create-awesome-node-app");
3737
3750
  if (latest && semver.lt(package_default.version, latest)) {
@@ -3745,9 +3758,14 @@ We recommend always using the latest version of create-awesome-node-app if possi
3745
3758
  );
3746
3759
  return;
3747
3760
  }
3761
+ const { useYarn, usePnpm, ...opts } = import_commander.default.opts();
3762
+ const packageManager = useYarn ? "yarn" : usePnpm ? "pnpm" : "npm";
3763
+ const templatesOrExtensions = [opts.template].concat(opts.extend || []).filter(Boolean).map((templateOrExtension) => ({
3764
+ url: templateOrExtension
3765
+ }));
3748
3766
  return createNodeApp(
3749
3767
  projectName,
3750
- { ...import_commander.default.opts(), projectName },
3768
+ { ...opts, packageManager, templatesOrExtensions, projectName },
3751
3769
  getCnaOptions
3752
3770
  );
3753
3771
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-awesome-node-app",
3
- "version": "0.4.18",
3
+ "version": "0.4.19",
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",
@@ -47,6 +47,7 @@
47
47
  "dependencies": {
48
48
  "@create-node-app/core": "*",
49
49
  "axios": "^1.5.0",
50
+ "ci-info": "^3.8.0",
50
51
  "prompts": "^2.4.1",
51
52
  "semver": "^5.7.2",
52
53
  "yargs": "^17.0.1"