create-awesome-node-app 0.4.27 → 0.6.0

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
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
 
28
28
  // node_modules/color-name/index.js
29
29
  var require_color_name = __commonJS({
30
- "node_modules/color-name/index.js"(exports, module2) {
30
+ "node_modules/color-name/index.js"(exports2, module2) {
31
31
  "use strict";
32
32
  module2.exports = {
33
33
  "aliceblue": [240, 248, 255],
@@ -184,7 +184,8 @@ var require_color_name = __commonJS({
184
184
 
185
185
  // node_modules/color-convert/conversions.js
186
186
  var require_conversions = __commonJS({
187
- "node_modules/color-convert/conversions.js"(exports, module2) {
187
+ "node_modules/color-convert/conversions.js"(exports2, module2) {
188
+ "use strict";
188
189
  var cssKeywords = require_color_name();
189
190
  var reverseKeywords = {};
190
191
  for (const key of Object.keys(cssKeywords)) {
@@ -855,7 +856,8 @@ var require_conversions = __commonJS({
855
856
 
856
857
  // node_modules/color-convert/route.js
857
858
  var require_route = __commonJS({
858
- "node_modules/color-convert/route.js"(exports, module2) {
859
+ "node_modules/color-convert/route.js"(exports2, module2) {
860
+ "use strict";
859
861
  var conversions = require_conversions();
860
862
  function buildGraph() {
861
863
  const graph = {};
@@ -925,7 +927,8 @@ var require_route = __commonJS({
925
927
 
926
928
  // node_modules/color-convert/index.js
927
929
  var require_color_convert = __commonJS({
928
- "node_modules/color-convert/index.js"(exports, module2) {
930
+ "node_modules/color-convert/index.js"(exports2, module2) {
931
+ "use strict";
929
932
  var conversions = require_conversions();
930
933
  var route = require_route();
931
934
  var convert = {};
@@ -986,7 +989,7 @@ var require_color_convert = __commonJS({
986
989
 
987
990
  // node_modules/ansi-styles/index.js
988
991
  var require_ansi_styles = __commonJS({
989
- "node_modules/ansi-styles/index.js"(exports, module2) {
992
+ "node_modules/ansi-styles/index.js"(exports2, module2) {
990
993
  "use strict";
991
994
  var wrapAnsi16 = (fn, offset) => (...args) => {
992
995
  const code = fn(...args);
@@ -1128,7 +1131,7 @@ var require_ansi_styles = __commonJS({
1128
1131
 
1129
1132
  // node_modules/has-flag/index.js
1130
1133
  var require_has_flag = __commonJS({
1131
- "node_modules/has-flag/index.js"(exports, module2) {
1134
+ "node_modules/has-flag/index.js"(exports2, module2) {
1132
1135
  "use strict";
1133
1136
  module2.exports = (flag, argv = process.argv) => {
1134
1137
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
@@ -1141,7 +1144,7 @@ var require_has_flag = __commonJS({
1141
1144
 
1142
1145
  // node_modules/supports-color/index.js
1143
1146
  var require_supports_color = __commonJS({
1144
- "node_modules/supports-color/index.js"(exports, module2) {
1147
+ "node_modules/supports-color/index.js"(exports2, module2) {
1145
1148
  "use strict";
1146
1149
  var os = require("os");
1147
1150
  var tty = require("tty");
@@ -1243,7 +1246,7 @@ var require_supports_color = __commonJS({
1243
1246
 
1244
1247
  // node_modules/chalk/source/util.js
1245
1248
  var require_util = __commonJS({
1246
- "node_modules/chalk/source/util.js"(exports, module2) {
1249
+ "node_modules/chalk/source/util.js"(exports2, module2) {
1247
1250
  "use strict";
1248
1251
  var stringReplaceAll = (string, substring, replacer) => {
1249
1252
  let index = string.indexOf(substring);
@@ -1282,7 +1285,7 @@ var require_util = __commonJS({
1282
1285
 
1283
1286
  // node_modules/chalk/source/templates.js
1284
1287
  var require_templates = __commonJS({
1285
- "node_modules/chalk/source/templates.js"(exports, module2) {
1288
+ "node_modules/chalk/source/templates.js"(exports2, module2) {
1286
1289
  "use strict";
1287
1290
  var TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
1288
1291
  var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
@@ -1396,7 +1399,7 @@ var require_templates = __commonJS({
1396
1399
 
1397
1400
  // node_modules/chalk/source/index.js
1398
1401
  var require_source = __commonJS({
1399
- "node_modules/chalk/source/index.js"(exports, module2) {
1402
+ "node_modules/chalk/source/index.js"(exports2, module2) {
1400
1403
  "use strict";
1401
1404
  var ansiStyles = require_ansi_styles();
1402
1405
  var { stdout: stdoutColor, stderr: stderrColor } = require_supports_color();
@@ -1608,7 +1611,7 @@ var getTemplateData = async () => {
1608
1611
  return templateDataCache.data;
1609
1612
  };
1610
1613
  var getTemplateCategories = async (cliArgs) => {
1611
- if (cliArgs == null ? void 0 : cliArgs.category) {
1614
+ if (cliArgs?.category) {
1612
1615
  return [cliArgs.category];
1613
1616
  }
1614
1617
  const templateData = await getTemplateData();
@@ -1631,7 +1634,7 @@ var getCategoryData = async (categorySlug) => {
1631
1634
  return void 0;
1632
1635
  };
1633
1636
  var getTemplatesForCategory = async (category, cliArgs) => {
1634
- const selectedCategory = (cliArgs == null ? void 0 : cliArgs.category) || category;
1637
+ const selectedCategory = cliArgs?.category || category;
1635
1638
  if (!selectedCategory) {
1636
1639
  throw new Error("Category is required in non-interactive mode.");
1637
1640
  }
@@ -1642,7 +1645,7 @@ var getTemplatesForCategory = async (category, cliArgs) => {
1642
1645
  return templates;
1643
1646
  };
1644
1647
  var getExtensionsGroupedByCategory = async (type, cliArgs) => {
1645
- const selectedType = (cliArgs == null ? void 0 : cliArgs.type) ? cliArgs.type.split(",") : type;
1648
+ const selectedType = cliArgs?.type ? cliArgs.type.split(",") : type;
1646
1649
  const safeType = Array.isArray(selectedType) ? selectedType : [selectedType];
1647
1650
  const templateData = await getTemplateData();
1648
1651
  const extensions = templateData.extensions.filter((extension) => {
@@ -1651,19 +1654,22 @@ var getExtensionsGroupedByCategory = async (type, cliArgs) => {
1651
1654
  (extensionType) => safeType.includes(extensionType)
1652
1655
  );
1653
1656
  });
1654
- const extensionsGroupedByCategory = extensions.reduce((acc, extension) => {
1655
- const category = extension.category;
1656
- if (!acc[category]) {
1657
- acc[category] = [];
1658
- }
1659
- acc[category].push(extension);
1660
- return acc;
1661
- }, {});
1657
+ const extensionsGroupedByCategory = extensions.reduce(
1658
+ (acc, extension) => {
1659
+ const category = extension.category;
1660
+ if (!acc[category]) {
1661
+ acc[category] = [];
1662
+ }
1663
+ acc[category].push(extension);
1664
+ return acc;
1665
+ },
1666
+ {}
1667
+ );
1662
1668
  return extensionsGroupedByCategory;
1663
1669
  };
1664
1670
 
1665
1671
  // src/options.ts
1666
- import_prompts.default.override(import_yargs.default.argv);
1672
+ import_prompts.default.override((0, import_yargs.default)(process.argv.slice(2)).argv);
1667
1673
  var PACKAGE_MANAGERS = ["npm", "yarn", "pnpm"];
1668
1674
  var isValidUrl = (url) => {
1669
1675
  try {
@@ -1703,7 +1709,7 @@ var processNonInteractiveOptions = async (options) => {
1703
1709
  }
1704
1710
  if (options.addons && Array.isArray(options.addons)) {
1705
1711
  const extensionsGroupedByCategory = await getExtensionsGroupedByCategory([
1706
- (matchedTemplate == null ? void 0 : matchedTemplate.type) || "custom",
1712
+ matchedTemplate?.type || "custom",
1707
1713
  "all"
1708
1714
  ]);
1709
1715
  const extensions = options.addons.map((addon) => {
@@ -1728,6 +1734,9 @@ var processNonInteractiveOptions = async (options) => {
1728
1734
  const additionalExtensions = options.extend.filter(Boolean).map((extension) => ({ url: extension }));
1729
1735
  templatesOrExtensions.push(...additionalExtensions);
1730
1736
  }
1737
+ if (Object.prototype.hasOwnProperty.call(options, "aiTool")) {
1738
+ delete options.aiTool;
1739
+ }
1731
1740
  options.templatesOrExtensions = templatesOrExtensions;
1732
1741
  if (options.verbose) {
1733
1742
  console.log(JSON.stringify(options, null, 2));
@@ -1740,8 +1749,8 @@ var processInteractiveOptions = async (options) => {
1740
1749
  const categoryData = await getCategoryData(categorySlug);
1741
1750
  return {
1742
1751
  slug: categorySlug,
1743
- name: (categoryData == null ? void 0 : categoryData.name) || categorySlug,
1744
- description: (categoryData == null ? void 0 : categoryData.description) || ""
1752
+ name: categoryData?.name || categorySlug,
1753
+ description: categoryData?.description || ""
1745
1754
  };
1746
1755
  });
1747
1756
  const categoryDataList = await Promise.all(categoryDataPromises);
@@ -1774,6 +1783,11 @@ var processInteractiveOptions = async (options) => {
1774
1783
  })),
1775
1784
  initial: options.packageManager ? PACKAGE_MANAGERS.indexOf(options.packageManager) : 0
1776
1785
  },
1786
+ {
1787
+ type: null,
1788
+ name: "__removed_aiTool",
1789
+ message: "(AI tool selection removed)"
1790
+ },
1777
1791
  {
1778
1792
  type: "select",
1779
1793
  name: "category",
@@ -1783,14 +1797,11 @@ var processInteractiveOptions = async (options) => {
1783
1797
  }
1784
1798
  ]);
1785
1799
  const templates = await getTemplatesForCategory(baseInput.category);
1786
- const templateOptions = templates.map((template) => {
1787
- var _a;
1788
- return {
1789
- title: template.name,
1790
- value: template.url,
1791
- description: template.description + " Keywords: " + ((_a = template.labels) == null ? void 0 : _a.join(", "))
1792
- };
1793
- });
1800
+ const templateOptions = templates.map((template) => ({
1801
+ title: template.name,
1802
+ value: template.url,
1803
+ description: template.description + " Keywords: " + template.labels?.join(", ")
1804
+ }));
1794
1805
  const templateInput = await (0, import_prompts.default)(
1795
1806
  baseInput.category === "custom" ? [
1796
1807
  {
@@ -1819,7 +1830,7 @@ var processInteractiveOptions = async (options) => {
1819
1830
  (template) => template.url === templateInput.template
1820
1831
  );
1821
1832
  const templateTemplateOrExtension = templateInput.template;
1822
- const customOptions = (existingTemplate == null ? void 0 : existingTemplate.customOptions) || [];
1833
+ const customOptions = existingTemplate?.customOptions || [];
1823
1834
  const appConfig = await (0, import_prompts.default)([
1824
1835
  // The following prompts are placeholders for future inputs
1825
1836
  {
@@ -1840,27 +1851,24 @@ var processInteractiveOptions = async (options) => {
1840
1851
  appConfig.templatesOrExtensions = [];
1841
1852
  appConfig.extend = [];
1842
1853
  const extensionsGroupedByCategory = await getExtensionsGroupedByCategory([
1843
- (existingTemplate == null ? void 0 : existingTemplate.type) || "custom",
1854
+ existingTemplate?.type || "custom",
1844
1855
  "all"
1845
1856
  ]);
1846
1857
  for (const [categorySlug, extensions] of Object.entries(
1847
1858
  extensionsGroupedByCategory
1848
1859
  )) {
1849
1860
  const categoryData = await getCategoryData(categorySlug);
1850
- const categoryName = (categoryData == null ? void 0 : categoryData.name) || categorySlug;
1851
- const categoryDescription = (categoryData == null ? void 0 : categoryData.description) || "";
1861
+ const categoryName = categoryData?.name || categorySlug;
1862
+ const categoryDescription = categoryData?.description || "";
1852
1863
  const { selected } = await (0, import_prompts.default)({
1853
1864
  type: "multiselect",
1854
1865
  name: "selected",
1855
1866
  message: `Select extensions for ${categoryName}${categoryDescription ? `: ${categoryDescription}` : ""}`,
1856
- choices: extensions.map((extension) => {
1857
- var _a;
1858
- return {
1859
- title: extension.name,
1860
- value: extension.url,
1861
- description: extension.description + " Keywords: " + ((_a = extension.labels) == null ? void 0 : _a.join(", "))
1862
- };
1863
- }),
1867
+ choices: extensions.map((extension) => ({
1868
+ title: extension.name,
1869
+ value: extension.url,
1870
+ description: extension.description + " Keywords: " + extension.labels?.join(", ")
1871
+ })),
1864
1872
  initial: 0
1865
1873
  });
1866
1874
  appConfig.templatesOrExtensions = appConfig.templatesOrExtensions ? [...appConfig.templatesOrExtensions, ...selected] : [];
@@ -1887,6 +1895,8 @@ var processInteractiveOptions = async (options) => {
1887
1895
  }
1888
1896
  const { ...nextAppOptions } = {
1889
1897
  extend: [],
1898
+ aiTool: "none",
1899
+ // Default value
1890
1900
  ...options,
1891
1901
  ...baseInput,
1892
1902
  ...templateInput,
@@ -1915,7 +1925,7 @@ var getCnaOptions = async (options) => {
1915
1925
  // package.json
1916
1926
  var package_default = {
1917
1927
  name: "create-awesome-node-app",
1918
- version: "0.4.27",
1928
+ version: "0.6.0",
1919
1929
  type: "module",
1920
1930
  description: "Command line tool to create Node apps with a lot of different templates and extensions.",
1921
1931
  license: "MIT",
@@ -1937,9 +1947,15 @@ var package_default = {
1937
1947
  }
1938
1948
  ],
1939
1949
  engines: {
1940
- node: ">=18.0.0"
1950
+ node: ">=22.0.0"
1941
1951
  },
1942
1952
  main: "index.js",
1953
+ exports: {
1954
+ ".": {
1955
+ types: "./dist/index.d.ts",
1956
+ import: "./index.js"
1957
+ }
1958
+ },
1943
1959
  files: [
1944
1960
  "index.js",
1945
1961
  "dist/**"
@@ -1956,27 +1972,29 @@ var package_default = {
1956
1972
  build: "tsup src/index.ts --format cjs,esm --dts",
1957
1973
  dev: "tsup src/index.ts --watch --format cjs,esm --dts",
1958
1974
  "type-check": "tsc --noEmit",
1959
- lint: "eslint .",
1960
- "lint:fix": "eslint . --fix"
1975
+ lint: "eslint 'src/**/*.{ts,tsx,js}'",
1976
+ "lint:fix": "eslint 'src/**/*.{ts,tsx,js}' --fix",
1977
+ test: "node --test tests/**/*.test.mjs"
1961
1978
  },
1962
1979
  dependencies: {
1963
1980
  "@create-node-app/core": "*",
1964
- axios: "^1.6.0",
1965
- "ci-info": "^4.0.0",
1966
- commander: "^13.1.0",
1967
- prompts: "^2.4.1",
1968
- semver: "^7.5.2",
1969
- yargs: "^17.0.1"
1981
+ axios: "^1.12.2",
1982
+ "ci-info": "^4.3.0",
1983
+ commander: "^14.0.1",
1984
+ prompts: "^2.4.2",
1985
+ semver: "^7.7.2",
1986
+ yargs: "^18.0.0"
1970
1987
  },
1971
1988
  devDependencies: {
1972
1989
  "@create-node-app/eslint-config-ts": "*",
1973
- "@types/node": "^18.14.6",
1990
+ "@types/node": "^24.5.2",
1974
1991
  "@types/prompts": "^2.4.9",
1975
- "@types/yargs": "^17.0.22",
1976
- eslint: "^7.23.0",
1977
- "eslint-config-turbo": "^0.0.4",
1978
- tsup: "^6.2.3",
1979
- "eslint-plugin-turbo": "^0.0.4"
1992
+ "@types/yargs": "^17.0.33",
1993
+ "@types/semver": "^7.5.8",
1994
+ eslint: "^9.35.0",
1995
+ "eslint-config-turbo": "^2.5.6",
1996
+ tsup: "^8.5.0",
1997
+ "eslint-plugin-turbo": "^2.5.6"
1980
1998
  }
1981
1999
  };
1982
2000
 
@@ -1988,10 +2006,10 @@ var listTemplates = async () => {
1988
2006
  for (const categorySlug of categories) {
1989
2007
  const categoryData = await getCategoryData(categorySlug);
1990
2008
  const templates = await getTemplatesForCategory(categorySlug);
1991
- const categoryName = (categoryData == null ? void 0 : categoryData.name) || categorySlug;
2009
+ const categoryName = categoryData?.name || categorySlug;
1992
2010
  console.log(import_chalk.default.bold.green(`
1993
2011
  ${categoryName}:`));
1994
- if (categoryData == null ? void 0 : categoryData.description) {
2012
+ if (categoryData?.description) {
1995
2013
  console.log(` ${categoryData.description}`);
1996
2014
  }
1997
2015
  templates.forEach((template) => {
@@ -2013,9 +2031,7 @@ var listAddons = async ({
2013
2031
  templateType = await getTemplateTypeFromSlug(templateSlug);
2014
2032
  }
2015
2033
  const types = templateType ? [templateType, "all"] : ["all"];
2016
- const extensionsGroupedByCategory = await getExtensionsGroupedByCategory(
2017
- types
2018
- );
2034
+ const extensionsGroupedByCategory = await getExtensionsGroupedByCategory(types);
2019
2035
  console.log(import_chalk.default.bold.blue("\nAvailable Addons:"));
2020
2036
  if (templateSlug) {
2021
2037
  console.log(
@@ -2027,10 +2043,10 @@ Compatible with template: ${templateSlug}`)
2027
2043
  extensionsGroupedByCategory
2028
2044
  )) {
2029
2045
  const categoryData = await getCategoryData(categorySlug);
2030
- const categoryName = (categoryData == null ? void 0 : categoryData.name) || categorySlug;
2046
+ const categoryName = categoryData?.name || categorySlug;
2031
2047
  console.log(import_chalk.default.bold.green(`
2032
2048
  ${categoryName}:`));
2033
- if (categoryData == null ? void 0 : categoryData.description) {
2049
+ if (categoryData?.description) {
2034
2050
  console.log(` ${categoryData.description}`);
2035
2051
  }
2036
2052
  extensions.forEach((extension) => {
@@ -2048,7 +2064,9 @@ var getTemplateTypeFromSlug = async (templateSlug) => {
2048
2064
  const categories = await getTemplateCategories();
2049
2065
  for (const category of categories) {
2050
2066
  const templates = await getTemplatesForCategory(category);
2051
- const template = templates.find((t) => t.slug === templateSlug);
2067
+ const template = templates.find(
2068
+ (t) => t.slug === templateSlug
2069
+ );
2052
2070
  if (template) {
2053
2071
  return template.type;
2054
2072
  }
@@ -2075,12 +2093,12 @@ var main = async () => {
2075
2093
  program.parse(process.argv);
2076
2094
  const opts = program.opts();
2077
2095
  (0, import_core.checkNodeVersion)(package_default.engines.node, package_default.name);
2078
- const latest = await (0, import_core.checkForLatestVersion)("create-awesome-node-app");
2079
- if (latest && import_semver.default.lt(package_default.version, latest)) {
2096
+ const latestVersion = await (0, import_core.checkForLatestVersion)("create-awesome-node-app");
2097
+ if (latestVersion && import_semver.default.lt(package_default.version, latestVersion)) {
2080
2098
  console.log();
2081
2099
  console.error(
2082
2100
  import_chalk2.default.yellow(
2083
- `You are running \`create-awesome-node-app\` ${package_default.version}, which is behind the latest release (${latest}).
2101
+ `You are running \`create-awesome-node-app\` ${package_default.version}, which is behind the latest release (${latestVersion}).
2084
2102
 
2085
2103
  We recommend always using the latest version of create-awesome-node-app if possible.`
2086
2104
  )
@@ -2099,13 +2117,9 @@ We recommend always using the latest version of create-awesome-node-app if possi
2099
2117
  }
2100
2118
  const { useYarn, usePnpm, ...restOpts } = opts;
2101
2119
  const packageManager = useYarn ? "yarn" : usePnpm ? "pnpm" : "npm";
2102
- const templatesOrExtensions = [restOpts.template].concat(Array.isArray(restOpts.extend) ? restOpts.extend : []).reduce((acc, templateOrExtension) => {
2103
- if (!templateOrExtension) {
2104
- return acc;
2105
- }
2106
- return acc.concat({
2107
- url: templateOrExtension
2108
- });
2120
+ const templatesOrExtensions = [restOpts.template].filter(Boolean).reduce((acc, templateOrExtension) => {
2121
+ if (!templateOrExtension) return acc;
2122
+ return acc.concat({ url: templateOrExtension });
2109
2123
  }, []);
2110
2124
  return (0, import_core.createNodeApp)(
2111
2125
  projectName,
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export { }
2
+ export { }
package/dist/index.js CHANGED
@@ -7,9 +7,8 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
8
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
9
  }) : x)(function(x) {
10
- if (typeof require !== "undefined")
11
- return require.apply(this, arguments);
12
- throw new Error('Dynamic require of "' + x + '" is not supported');
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
13
12
  });
14
13
  var __commonJS = (cb, mod) => function __require2() {
15
14
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
@@ -191,6 +190,7 @@ var require_color_name = __commonJS({
191
190
  // node_modules/color-convert/conversions.js
192
191
  var require_conversions = __commonJS({
193
192
  "node_modules/color-convert/conversions.js"(exports, module) {
193
+ "use strict";
194
194
  var cssKeywords = require_color_name();
195
195
  var reverseKeywords = {};
196
196
  for (const key of Object.keys(cssKeywords)) {
@@ -862,6 +862,7 @@ var require_conversions = __commonJS({
862
862
  // node_modules/color-convert/route.js
863
863
  var require_route = __commonJS({
864
864
  "node_modules/color-convert/route.js"(exports, module) {
865
+ "use strict";
865
866
  var conversions = require_conversions();
866
867
  function buildGraph() {
867
868
  const graph = {};
@@ -932,6 +933,7 @@ var require_route = __commonJS({
932
933
  // node_modules/color-convert/index.js
933
934
  var require_color_convert = __commonJS({
934
935
  "node_modules/color-convert/index.js"(exports, module) {
936
+ "use strict";
935
937
  var conversions = require_conversions();
936
938
  var route = require_route();
937
939
  var convert = {};
@@ -1618,7 +1620,7 @@ var getTemplateData = async () => {
1618
1620
  return templateDataCache.data;
1619
1621
  };
1620
1622
  var getTemplateCategories = async (cliArgs) => {
1621
- if (cliArgs == null ? void 0 : cliArgs.category) {
1623
+ if (cliArgs?.category) {
1622
1624
  return [cliArgs.category];
1623
1625
  }
1624
1626
  const templateData = await getTemplateData();
@@ -1641,7 +1643,7 @@ var getCategoryData = async (categorySlug) => {
1641
1643
  return void 0;
1642
1644
  };
1643
1645
  var getTemplatesForCategory = async (category, cliArgs) => {
1644
- const selectedCategory = (cliArgs == null ? void 0 : cliArgs.category) || category;
1646
+ const selectedCategory = cliArgs?.category || category;
1645
1647
  if (!selectedCategory) {
1646
1648
  throw new Error("Category is required in non-interactive mode.");
1647
1649
  }
@@ -1652,7 +1654,7 @@ var getTemplatesForCategory = async (category, cliArgs) => {
1652
1654
  return templates;
1653
1655
  };
1654
1656
  var getExtensionsGroupedByCategory = async (type, cliArgs) => {
1655
- const selectedType = (cliArgs == null ? void 0 : cliArgs.type) ? cliArgs.type.split(",") : type;
1657
+ const selectedType = cliArgs?.type ? cliArgs.type.split(",") : type;
1656
1658
  const safeType = Array.isArray(selectedType) ? selectedType : [selectedType];
1657
1659
  const templateData = await getTemplateData();
1658
1660
  const extensions = templateData.extensions.filter((extension) => {
@@ -1661,19 +1663,22 @@ var getExtensionsGroupedByCategory = async (type, cliArgs) => {
1661
1663
  (extensionType) => safeType.includes(extensionType)
1662
1664
  );
1663
1665
  });
1664
- const extensionsGroupedByCategory = extensions.reduce((acc, extension) => {
1665
- const category = extension.category;
1666
- if (!acc[category]) {
1667
- acc[category] = [];
1668
- }
1669
- acc[category].push(extension);
1670
- return acc;
1671
- }, {});
1666
+ const extensionsGroupedByCategory = extensions.reduce(
1667
+ (acc, extension) => {
1668
+ const category = extension.category;
1669
+ if (!acc[category]) {
1670
+ acc[category] = [];
1671
+ }
1672
+ acc[category].push(extension);
1673
+ return acc;
1674
+ },
1675
+ {}
1676
+ );
1672
1677
  return extensionsGroupedByCategory;
1673
1678
  };
1674
1679
 
1675
1680
  // src/options.ts
1676
- prompts.override(yargs.argv);
1681
+ prompts.override(yargs(process.argv.slice(2)).argv);
1677
1682
  var PACKAGE_MANAGERS = ["npm", "yarn", "pnpm"];
1678
1683
  var isValidUrl = (url) => {
1679
1684
  try {
@@ -1713,7 +1718,7 @@ var processNonInteractiveOptions = async (options) => {
1713
1718
  }
1714
1719
  if (options.addons && Array.isArray(options.addons)) {
1715
1720
  const extensionsGroupedByCategory = await getExtensionsGroupedByCategory([
1716
- (matchedTemplate == null ? void 0 : matchedTemplate.type) || "custom",
1721
+ matchedTemplate?.type || "custom",
1717
1722
  "all"
1718
1723
  ]);
1719
1724
  const extensions = options.addons.map((addon) => {
@@ -1738,6 +1743,9 @@ var processNonInteractiveOptions = async (options) => {
1738
1743
  const additionalExtensions = options.extend.filter(Boolean).map((extension) => ({ url: extension }));
1739
1744
  templatesOrExtensions.push(...additionalExtensions);
1740
1745
  }
1746
+ if (Object.prototype.hasOwnProperty.call(options, "aiTool")) {
1747
+ delete options.aiTool;
1748
+ }
1741
1749
  options.templatesOrExtensions = templatesOrExtensions;
1742
1750
  if (options.verbose) {
1743
1751
  console.log(JSON.stringify(options, null, 2));
@@ -1750,8 +1758,8 @@ var processInteractiveOptions = async (options) => {
1750
1758
  const categoryData = await getCategoryData(categorySlug);
1751
1759
  return {
1752
1760
  slug: categorySlug,
1753
- name: (categoryData == null ? void 0 : categoryData.name) || categorySlug,
1754
- description: (categoryData == null ? void 0 : categoryData.description) || ""
1761
+ name: categoryData?.name || categorySlug,
1762
+ description: categoryData?.description || ""
1755
1763
  };
1756
1764
  });
1757
1765
  const categoryDataList = await Promise.all(categoryDataPromises);
@@ -1784,6 +1792,11 @@ var processInteractiveOptions = async (options) => {
1784
1792
  })),
1785
1793
  initial: options.packageManager ? PACKAGE_MANAGERS.indexOf(options.packageManager) : 0
1786
1794
  },
1795
+ {
1796
+ type: null,
1797
+ name: "__removed_aiTool",
1798
+ message: "(AI tool selection removed)"
1799
+ },
1787
1800
  {
1788
1801
  type: "select",
1789
1802
  name: "category",
@@ -1793,14 +1806,11 @@ var processInteractiveOptions = async (options) => {
1793
1806
  }
1794
1807
  ]);
1795
1808
  const templates = await getTemplatesForCategory(baseInput.category);
1796
- const templateOptions = templates.map((template) => {
1797
- var _a;
1798
- return {
1799
- title: template.name,
1800
- value: template.url,
1801
- description: template.description + " Keywords: " + ((_a = template.labels) == null ? void 0 : _a.join(", "))
1802
- };
1803
- });
1809
+ const templateOptions = templates.map((template) => ({
1810
+ title: template.name,
1811
+ value: template.url,
1812
+ description: template.description + " Keywords: " + template.labels?.join(", ")
1813
+ }));
1804
1814
  const templateInput = await prompts(
1805
1815
  baseInput.category === "custom" ? [
1806
1816
  {
@@ -1829,7 +1839,7 @@ var processInteractiveOptions = async (options) => {
1829
1839
  (template) => template.url === templateInput.template
1830
1840
  );
1831
1841
  const templateTemplateOrExtension = templateInput.template;
1832
- const customOptions = (existingTemplate == null ? void 0 : existingTemplate.customOptions) || [];
1842
+ const customOptions = existingTemplate?.customOptions || [];
1833
1843
  const appConfig = await prompts([
1834
1844
  // The following prompts are placeholders for future inputs
1835
1845
  {
@@ -1850,27 +1860,24 @@ var processInteractiveOptions = async (options) => {
1850
1860
  appConfig.templatesOrExtensions = [];
1851
1861
  appConfig.extend = [];
1852
1862
  const extensionsGroupedByCategory = await getExtensionsGroupedByCategory([
1853
- (existingTemplate == null ? void 0 : existingTemplate.type) || "custom",
1863
+ existingTemplate?.type || "custom",
1854
1864
  "all"
1855
1865
  ]);
1856
1866
  for (const [categorySlug, extensions] of Object.entries(
1857
1867
  extensionsGroupedByCategory
1858
1868
  )) {
1859
1869
  const categoryData = await getCategoryData(categorySlug);
1860
- const categoryName = (categoryData == null ? void 0 : categoryData.name) || categorySlug;
1861
- const categoryDescription = (categoryData == null ? void 0 : categoryData.description) || "";
1870
+ const categoryName = categoryData?.name || categorySlug;
1871
+ const categoryDescription = categoryData?.description || "";
1862
1872
  const { selected } = await prompts({
1863
1873
  type: "multiselect",
1864
1874
  name: "selected",
1865
1875
  message: `Select extensions for ${categoryName}${categoryDescription ? `: ${categoryDescription}` : ""}`,
1866
- choices: extensions.map((extension) => {
1867
- var _a;
1868
- return {
1869
- title: extension.name,
1870
- value: extension.url,
1871
- description: extension.description + " Keywords: " + ((_a = extension.labels) == null ? void 0 : _a.join(", "))
1872
- };
1873
- }),
1876
+ choices: extensions.map((extension) => ({
1877
+ title: extension.name,
1878
+ value: extension.url,
1879
+ description: extension.description + " Keywords: " + extension.labels?.join(", ")
1880
+ })),
1874
1881
  initial: 0
1875
1882
  });
1876
1883
  appConfig.templatesOrExtensions = appConfig.templatesOrExtensions ? [...appConfig.templatesOrExtensions, ...selected] : [];
@@ -1897,6 +1904,8 @@ var processInteractiveOptions = async (options) => {
1897
1904
  }
1898
1905
  const { ...nextAppOptions } = {
1899
1906
  extend: [],
1907
+ aiTool: "none",
1908
+ // Default value
1900
1909
  ...options,
1901
1910
  ...baseInput,
1902
1911
  ...templateInput,
@@ -1925,7 +1934,7 @@ var getCnaOptions = async (options) => {
1925
1934
  // package.json
1926
1935
  var package_default = {
1927
1936
  name: "create-awesome-node-app",
1928
- version: "0.4.27",
1937
+ version: "0.6.0",
1929
1938
  type: "module",
1930
1939
  description: "Command line tool to create Node apps with a lot of different templates and extensions.",
1931
1940
  license: "MIT",
@@ -1947,9 +1956,15 @@ var package_default = {
1947
1956
  }
1948
1957
  ],
1949
1958
  engines: {
1950
- node: ">=18.0.0"
1959
+ node: ">=22.0.0"
1951
1960
  },
1952
1961
  main: "index.js",
1962
+ exports: {
1963
+ ".": {
1964
+ types: "./dist/index.d.ts",
1965
+ import: "./index.js"
1966
+ }
1967
+ },
1953
1968
  files: [
1954
1969
  "index.js",
1955
1970
  "dist/**"
@@ -1966,27 +1981,29 @@ var package_default = {
1966
1981
  build: "tsup src/index.ts --format cjs,esm --dts",
1967
1982
  dev: "tsup src/index.ts --watch --format cjs,esm --dts",
1968
1983
  "type-check": "tsc --noEmit",
1969
- lint: "eslint .",
1970
- "lint:fix": "eslint . --fix"
1984
+ lint: "eslint 'src/**/*.{ts,tsx,js}'",
1985
+ "lint:fix": "eslint 'src/**/*.{ts,tsx,js}' --fix",
1986
+ test: "node --test tests/**/*.test.mjs"
1971
1987
  },
1972
1988
  dependencies: {
1973
1989
  "@create-node-app/core": "*",
1974
- axios: "^1.6.0",
1975
- "ci-info": "^4.0.0",
1976
- commander: "^13.1.0",
1977
- prompts: "^2.4.1",
1978
- semver: "^7.5.2",
1979
- yargs: "^17.0.1"
1990
+ axios: "^1.12.2",
1991
+ "ci-info": "^4.3.0",
1992
+ commander: "^14.0.1",
1993
+ prompts: "^2.4.2",
1994
+ semver: "^7.7.2",
1995
+ yargs: "^18.0.0"
1980
1996
  },
1981
1997
  devDependencies: {
1982
1998
  "@create-node-app/eslint-config-ts": "*",
1983
- "@types/node": "^18.14.6",
1999
+ "@types/node": "^24.5.2",
1984
2000
  "@types/prompts": "^2.4.9",
1985
- "@types/yargs": "^17.0.22",
1986
- eslint: "^7.23.0",
1987
- "eslint-config-turbo": "^0.0.4",
1988
- tsup: "^6.2.3",
1989
- "eslint-plugin-turbo": "^0.0.4"
2001
+ "@types/yargs": "^17.0.33",
2002
+ "@types/semver": "^7.5.8",
2003
+ eslint: "^9.35.0",
2004
+ "eslint-config-turbo": "^2.5.6",
2005
+ tsup: "^8.5.0",
2006
+ "eslint-plugin-turbo": "^2.5.6"
1990
2007
  }
1991
2008
  };
1992
2009
 
@@ -1998,10 +2015,10 @@ var listTemplates = async () => {
1998
2015
  for (const categorySlug of categories) {
1999
2016
  const categoryData = await getCategoryData(categorySlug);
2000
2017
  const templates = await getTemplatesForCategory(categorySlug);
2001
- const categoryName = (categoryData == null ? void 0 : categoryData.name) || categorySlug;
2018
+ const categoryName = categoryData?.name || categorySlug;
2002
2019
  console.log(import_chalk.default.bold.green(`
2003
2020
  ${categoryName}:`));
2004
- if (categoryData == null ? void 0 : categoryData.description) {
2021
+ if (categoryData?.description) {
2005
2022
  console.log(` ${categoryData.description}`);
2006
2023
  }
2007
2024
  templates.forEach((template) => {
@@ -2023,9 +2040,7 @@ var listAddons = async ({
2023
2040
  templateType = await getTemplateTypeFromSlug(templateSlug);
2024
2041
  }
2025
2042
  const types = templateType ? [templateType, "all"] : ["all"];
2026
- const extensionsGroupedByCategory = await getExtensionsGroupedByCategory(
2027
- types
2028
- );
2043
+ const extensionsGroupedByCategory = await getExtensionsGroupedByCategory(types);
2029
2044
  console.log(import_chalk.default.bold.blue("\nAvailable Addons:"));
2030
2045
  if (templateSlug) {
2031
2046
  console.log(
@@ -2037,10 +2052,10 @@ Compatible with template: ${templateSlug}`)
2037
2052
  extensionsGroupedByCategory
2038
2053
  )) {
2039
2054
  const categoryData = await getCategoryData(categorySlug);
2040
- const categoryName = (categoryData == null ? void 0 : categoryData.name) || categorySlug;
2055
+ const categoryName = categoryData?.name || categorySlug;
2041
2056
  console.log(import_chalk.default.bold.green(`
2042
2057
  ${categoryName}:`));
2043
- if (categoryData == null ? void 0 : categoryData.description) {
2058
+ if (categoryData?.description) {
2044
2059
  console.log(` ${categoryData.description}`);
2045
2060
  }
2046
2061
  extensions.forEach((extension) => {
@@ -2058,7 +2073,9 @@ var getTemplateTypeFromSlug = async (templateSlug) => {
2058
2073
  const categories = await getTemplateCategories();
2059
2074
  for (const category of categories) {
2060
2075
  const templates = await getTemplatesForCategory(category);
2061
- const template = templates.find((t) => t.slug === templateSlug);
2076
+ const template = templates.find(
2077
+ (t) => t.slug === templateSlug
2078
+ );
2062
2079
  if (template) {
2063
2080
  return template.type;
2064
2081
  }
@@ -2085,12 +2102,12 @@ var main = async () => {
2085
2102
  program.parse(process.argv);
2086
2103
  const opts = program.opts();
2087
2104
  checkNodeVersion(package_default.engines.node, package_default.name);
2088
- const latest = await checkForLatestVersion("create-awesome-node-app");
2089
- if (latest && semver.lt(package_default.version, latest)) {
2105
+ const latestVersion = await checkForLatestVersion("create-awesome-node-app");
2106
+ if (latestVersion && semver.lt(package_default.version, latestVersion)) {
2090
2107
  console.log();
2091
2108
  console.error(
2092
2109
  import_chalk2.default.yellow(
2093
- `You are running \`create-awesome-node-app\` ${package_default.version}, which is behind the latest release (${latest}).
2110
+ `You are running \`create-awesome-node-app\` ${package_default.version}, which is behind the latest release (${latestVersion}).
2094
2111
 
2095
2112
  We recommend always using the latest version of create-awesome-node-app if possible.`
2096
2113
  )
@@ -2109,13 +2126,9 @@ We recommend always using the latest version of create-awesome-node-app if possi
2109
2126
  }
2110
2127
  const { useYarn, usePnpm, ...restOpts } = opts;
2111
2128
  const packageManager = useYarn ? "yarn" : usePnpm ? "pnpm" : "npm";
2112
- const templatesOrExtensions = [restOpts.template].concat(Array.isArray(restOpts.extend) ? restOpts.extend : []).reduce((acc, templateOrExtension) => {
2113
- if (!templateOrExtension) {
2114
- return acc;
2115
- }
2116
- return acc.concat({
2117
- url: templateOrExtension
2118
- });
2129
+ const templatesOrExtensions = [restOpts.template].filter(Boolean).reduce((acc, templateOrExtension) => {
2130
+ if (!templateOrExtension) return acc;
2131
+ return acc.concat({ url: templateOrExtension });
2119
2132
  }, []);
2120
2133
  return createNodeApp(
2121
2134
  projectName,
package/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
-
2
+ // Use CJS wrapper which loads core CJS build (avoids dynamic require issues for now)
3
3
  import "./dist/index.cjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-awesome-node-app",
3
- "version": "0.4.27",
3
+ "version": "0.6.0",
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",
@@ -22,9 +22,15 @@
22
22
  }
23
23
  ],
24
24
  "engines": {
25
- "node": ">=18.0.0"
25
+ "node": ">=22.0.0"
26
26
  },
27
27
  "main": "index.js",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./index.js"
32
+ }
33
+ },
28
34
  "files": [
29
35
  "index.js",
30
36
  "dist/**"
@@ -41,26 +47,28 @@
41
47
  "build": "tsup src/index.ts --format cjs,esm --dts",
42
48
  "dev": "tsup src/index.ts --watch --format cjs,esm --dts",
43
49
  "type-check": "tsc --noEmit",
44
- "lint": "eslint .",
45
- "lint:fix": "eslint . --fix"
50
+ "lint": "eslint 'src/**/*.{ts,tsx,js}'",
51
+ "lint:fix": "eslint 'src/**/*.{ts,tsx,js}' --fix",
52
+ "test": "node --test tests/**/*.test.mjs"
46
53
  },
47
54
  "dependencies": {
48
55
  "@create-node-app/core": "*",
49
- "axios": "^1.6.0",
50
- "ci-info": "^4.0.0",
51
- "commander": "^13.1.0",
52
- "prompts": "^2.4.1",
53
- "semver": "^7.5.2",
54
- "yargs": "^17.0.1"
56
+ "axios": "^1.12.2",
57
+ "ci-info": "^4.3.0",
58
+ "commander": "^14.0.1",
59
+ "prompts": "^2.4.2",
60
+ "semver": "^7.7.2",
61
+ "yargs": "^18.0.0"
55
62
  },
56
63
  "devDependencies": {
57
64
  "@create-node-app/eslint-config-ts": "*",
58
- "@types/node": "^18.14.6",
65
+ "@types/node": "^24.5.2",
59
66
  "@types/prompts": "^2.4.9",
60
- "@types/yargs": "^17.0.22",
61
- "eslint": "^7.23.0",
62
- "eslint-config-turbo": "^0.0.4",
63
- "tsup": "^6.2.3",
64
- "eslint-plugin-turbo": "^0.0.4"
67
+ "@types/yargs": "^17.0.33",
68
+ "@types/semver": "^7.5.8",
69
+ "eslint": "^9.35.0",
70
+ "eslint-config-turbo": "^2.5.6",
71
+ "tsup": "^8.5.0",
72
+ "eslint-plugin-turbo": "^2.5.6"
65
73
  }
66
74
  }