create-awesome-node-app 0.6.7 → 0.7.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/README.md +188 -160
- package/dist/index.cjs +27 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -12
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/dist/chunk-SIARO2CH.js +0 -123
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-awesome-node-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
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",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"test:src": "npm run test"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@create-node-app/core": "^0.5.
|
|
58
|
-
"axios": "^1.
|
|
57
|
+
"@create-node-app/core": "^0.5.7",
|
|
58
|
+
"axios": "^1.13.6",
|
|
59
59
|
"ci-info": "^4.3.0",
|
|
60
60
|
"commander": "^14.0.1",
|
|
61
61
|
"prompts": "^2.4.2",
|
|
@@ -63,16 +63,17 @@
|
|
|
63
63
|
"yargs": "^18.0.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
+
"@create-node-app/core": "^0.5.7",
|
|
66
67
|
"@create-node-app/eslint-config-ts": "*",
|
|
67
68
|
"@types/node": "^24.5.2",
|
|
68
69
|
"@types/prompts": "^2.4.9",
|
|
69
|
-
"@types/yargs": "^17.0.33",
|
|
70
70
|
"@types/semver": "^7.5.8",
|
|
71
|
-
"
|
|
71
|
+
"@types/yargs": "^17.0.33",
|
|
72
72
|
"eslint": "^9.35.0",
|
|
73
73
|
"eslint-config-turbo": "^2.5.6",
|
|
74
|
-
"tsup": "^8.5.0",
|
|
75
74
|
"eslint-plugin-turbo": "^2.5.6",
|
|
75
|
+
"nock": "^13.5.4",
|
|
76
|
+
"tsup": "^8.5.0",
|
|
76
77
|
"tsx": "^4.19.0"
|
|
77
78
|
}
|
|
78
79
|
}
|
package/dist/chunk-SIARO2CH.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
-
}) : x)(function(x) {
|
|
10
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
-
});
|
|
13
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
14
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
-
};
|
|
16
|
-
var __copyProps = (to, from, except, desc) => {
|
|
17
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
-
for (let key of __getOwnPropNames(from))
|
|
19
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
-
}
|
|
22
|
-
return to;
|
|
23
|
-
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
-
mod
|
|
31
|
-
));
|
|
32
|
-
|
|
33
|
-
// src/templates.ts
|
|
34
|
-
import axios from "axios";
|
|
35
|
-
var TEMPLATE_DATA_FILE_URL = "https://raw.githubusercontent.com/Create-Node-App/cna-templates/main/templates.json";
|
|
36
|
-
var CACHE_TTL_MS = 36e5;
|
|
37
|
-
var templateDataCache = {
|
|
38
|
-
data: null,
|
|
39
|
-
timestamp: 0
|
|
40
|
-
};
|
|
41
|
-
var fetchTemplateData = async () => {
|
|
42
|
-
try {
|
|
43
|
-
const response = await axios.get(TEMPLATE_DATA_FILE_URL);
|
|
44
|
-
return response.data;
|
|
45
|
-
} catch (error) {
|
|
46
|
-
throw new Error("Failed to fetch template data");
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var getTemplateData = async () => {
|
|
50
|
-
const currentTime = Date.now();
|
|
51
|
-
if (templateDataCache.data === null || currentTime - templateDataCache.timestamp > CACHE_TTL_MS) {
|
|
52
|
-
templateDataCache.data = await fetchTemplateData();
|
|
53
|
-
templateDataCache.timestamp = currentTime;
|
|
54
|
-
}
|
|
55
|
-
return templateDataCache.data;
|
|
56
|
-
};
|
|
57
|
-
var getTemplateCategories = async (cliArgs) => {
|
|
58
|
-
if (cliArgs?.category) {
|
|
59
|
-
return [cliArgs.category];
|
|
60
|
-
}
|
|
61
|
-
const templateData = await getTemplateData();
|
|
62
|
-
if (templateData.categories && templateData.categories.length > 0) {
|
|
63
|
-
return templateData.categories.map((category) => category.slug);
|
|
64
|
-
}
|
|
65
|
-
const categories = /* @__PURE__ */ new Set();
|
|
66
|
-
templateData.templates.forEach((template) => {
|
|
67
|
-
categories.add(template.category);
|
|
68
|
-
});
|
|
69
|
-
return Array.from(categories);
|
|
70
|
-
};
|
|
71
|
-
var getCategoryData = async (categorySlug) => {
|
|
72
|
-
const templateData = await getTemplateData();
|
|
73
|
-
if (templateData.categories && templateData.categories.length > 0) {
|
|
74
|
-
return templateData.categories.find(
|
|
75
|
-
(category) => category.slug === categorySlug
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
return void 0;
|
|
79
|
-
};
|
|
80
|
-
var getTemplatesForCategory = async (category, cliArgs) => {
|
|
81
|
-
const selectedCategory = cliArgs?.category || category;
|
|
82
|
-
if (!selectedCategory) {
|
|
83
|
-
throw new Error("Category is required in non-interactive mode.");
|
|
84
|
-
}
|
|
85
|
-
const templateData = await getTemplateData();
|
|
86
|
-
const templates = templateData.templates.filter(
|
|
87
|
-
(template) => template.category === selectedCategory
|
|
88
|
-
);
|
|
89
|
-
return templates;
|
|
90
|
-
};
|
|
91
|
-
var getExtensionsGroupedByCategory = async (type, cliArgs) => {
|
|
92
|
-
const selectedType = cliArgs?.type ? cliArgs.type.split(",") : type;
|
|
93
|
-
const safeType = Array.isArray(selectedType) ? selectedType : [selectedType];
|
|
94
|
-
const templateData = await getTemplateData();
|
|
95
|
-
const extensions = templateData.extensions.filter((extension) => {
|
|
96
|
-
const safeExtensionType = Array.isArray(extension.type) ? extension.type : [extension.type];
|
|
97
|
-
return safeExtensionType.some(
|
|
98
|
-
(extensionType) => safeType.includes(extensionType)
|
|
99
|
-
);
|
|
100
|
-
});
|
|
101
|
-
const extensionsGroupedByCategory = extensions.reduce(
|
|
102
|
-
(acc, extension) => {
|
|
103
|
-
const category = extension.category;
|
|
104
|
-
if (!acc[category]) {
|
|
105
|
-
acc[category] = [];
|
|
106
|
-
}
|
|
107
|
-
acc[category].push(extension);
|
|
108
|
-
return acc;
|
|
109
|
-
},
|
|
110
|
-
{}
|
|
111
|
-
);
|
|
112
|
-
return extensionsGroupedByCategory;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export {
|
|
116
|
-
__require,
|
|
117
|
-
__commonJS,
|
|
118
|
-
__toESM,
|
|
119
|
-
getTemplateCategories,
|
|
120
|
-
getCategoryData,
|
|
121
|
-
getTemplatesForCategory,
|
|
122
|
-
getExtensionsGroupedByCategory
|
|
123
|
-
};
|