create-next2d-app 2.0.3 → 2.1.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.d.ts +5 -1
- package/dist/index.js +48 -13
- package/package.json +18 -14
package/dist/index.d.ts
CHANGED
|
@@ -43,6 +43,9 @@ interface Packages {
|
|
|
43
43
|
dependencies?: {
|
|
44
44
|
[key: string]: string;
|
|
45
45
|
};
|
|
46
|
+
devDependencies?: {
|
|
47
|
+
[key: string]: string;
|
|
48
|
+
};
|
|
46
49
|
}
|
|
47
50
|
interface TemplateJson {
|
|
48
51
|
package?: Packages;
|
|
@@ -52,9 +55,10 @@ interface TemplateJson {
|
|
|
52
55
|
* @param {string} app_name
|
|
53
56
|
* @param {string} template
|
|
54
57
|
* @param {array} dependencies
|
|
58
|
+
* @param {array} devDependencies
|
|
55
59
|
* @return {void}
|
|
56
60
|
*/
|
|
57
|
-
declare const install: (root: string, app_name: string, template: string, dependencies: string[]) => void;
|
|
61
|
+
declare const install: (root: string, app_name: string, template: string, dependencies: string[], devDependencies: string[]) => void;
|
|
58
62
|
/**
|
|
59
63
|
* @param {string} app_name
|
|
60
64
|
* @param {string} [template="@next2d/framework-template"]
|
package/dist/index.js
CHANGED
|
@@ -120,9 +120,10 @@ const checkNpmVersion = () => {
|
|
|
120
120
|
* @param {string} app_name
|
|
121
121
|
* @param {string} template
|
|
122
122
|
* @param {array} dependencies
|
|
123
|
+
* @param {array} devDependencies
|
|
123
124
|
* @return {void}
|
|
124
125
|
*/
|
|
125
|
-
const install = (root, app_name, template, dependencies) => {
|
|
126
|
+
const install = (root, app_name, template, dependencies, devDependencies) => {
|
|
126
127
|
console.log("Installing packages. This may take a few minutes.");
|
|
127
128
|
const command = "npm";
|
|
128
129
|
new Promise((resolve, reject) => {
|
|
@@ -152,6 +153,9 @@ const install = (root, app_name, template, dependencies) => {
|
|
|
152
153
|
}
|
|
153
154
|
// base package.json
|
|
154
155
|
const packageJson = require(`${root}/package.json`);
|
|
156
|
+
// reset
|
|
157
|
+
packageJson.dependencies = {};
|
|
158
|
+
packageJson.devDependencies = {};
|
|
155
159
|
const templatePackage = templateJson.package;
|
|
156
160
|
if (templatePackage) {
|
|
157
161
|
const templateDependencies = templatePackage.dependencies;
|
|
@@ -160,13 +164,26 @@ const install = (root, app_name, template, dependencies) => {
|
|
|
160
164
|
for (let idx = 0; idx < keys.length; ++idx) {
|
|
161
165
|
const name = keys[idx];
|
|
162
166
|
if (templateDependencies[name] === "*") {
|
|
163
|
-
|
|
167
|
+
devDependencies.push(name);
|
|
164
168
|
}
|
|
165
169
|
else {
|
|
166
170
|
packageJson.dependencies[name] = templateDependencies[name];
|
|
167
171
|
}
|
|
168
172
|
}
|
|
169
173
|
}
|
|
174
|
+
const templateDevDependencies = templatePackage.devDependencies;
|
|
175
|
+
if (templateDevDependencies) {
|
|
176
|
+
const keys = Object.keys(templateDevDependencies);
|
|
177
|
+
for (let idx = 0; idx < keys.length; ++idx) {
|
|
178
|
+
const name = keys[idx];
|
|
179
|
+
if (templateDevDependencies[name] === "*") {
|
|
180
|
+
devDependencies.push(name);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
packageJson.devDependencies[name] = templateDevDependencies[name];
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
170
187
|
}
|
|
171
188
|
fs.writeFileSync(path.join(root, "package.json"), JSON.stringify(packageJson, null, 2) + os.EOL);
|
|
172
189
|
const templateDir = path.join(templatePath, "template");
|
|
@@ -199,6 +216,29 @@ const install = (root, app_name, template, dependencies) => {
|
|
|
199
216
|
});
|
|
200
217
|
}
|
|
201
218
|
});
|
|
219
|
+
})
|
|
220
|
+
.then(() => {
|
|
221
|
+
return new Promise((resolve, reject) => {
|
|
222
|
+
const args = [
|
|
223
|
+
"install",
|
|
224
|
+
"--no-audit",
|
|
225
|
+
"--save",
|
|
226
|
+
"--loglevel",
|
|
227
|
+
"error"
|
|
228
|
+
].concat(dependencies);
|
|
229
|
+
const child = spawn(command, args, { "stdio": "inherit" });
|
|
230
|
+
child
|
|
231
|
+
.on("close", (code) => {
|
|
232
|
+
if (code !== 0) {
|
|
233
|
+
reject({
|
|
234
|
+
"command": `${command} ${args.join(" ")}`
|
|
235
|
+
});
|
|
236
|
+
process.exit(1);
|
|
237
|
+
}
|
|
238
|
+
// @ts-ignore
|
|
239
|
+
resolve();
|
|
240
|
+
});
|
|
241
|
+
});
|
|
202
242
|
})
|
|
203
243
|
.then(() => {
|
|
204
244
|
const args = [
|
|
@@ -207,7 +247,7 @@ const install = (root, app_name, template, dependencies) => {
|
|
|
207
247
|
"--save-dev",
|
|
208
248
|
"--loglevel",
|
|
209
249
|
"error"
|
|
210
|
-
].concat(
|
|
250
|
+
].concat(devDependencies);
|
|
211
251
|
const child = spawn(command, args, { "stdio": "inherit" });
|
|
212
252
|
child
|
|
213
253
|
.on("close", (code) => {
|
|
@@ -228,12 +268,6 @@ const install = (root, app_name, template, dependencies) => {
|
|
|
228
268
|
console.log(` ${pc.green("npm run generate")}`);
|
|
229
269
|
console.log(" Generate the necessary View and ViewModel classes from the routing JSON file.");
|
|
230
270
|
console.log();
|
|
231
|
-
console.log(` ${pc.green("npm run [ios|android|windows|macos] -- --env prd")}`);
|
|
232
|
-
console.log(" Start the emulator for each platform.");
|
|
233
|
-
console.log();
|
|
234
|
-
console.log(` ${pc.green("npm run build -- --platform [windows|macos|web] --env prd")}`);
|
|
235
|
-
console.log(" Export a production version for each platform.");
|
|
236
|
-
console.log();
|
|
237
271
|
console.log(` ${pc.green("npm test")}`);
|
|
238
272
|
console.log(" Starts the test runner.");
|
|
239
273
|
console.log();
|
|
@@ -267,7 +301,7 @@ const createApp = (app_name, template = "@next2d/framework-template") => {
|
|
|
267
301
|
"private": true,
|
|
268
302
|
"type": "module",
|
|
269
303
|
"scripts": {
|
|
270
|
-
"start": "vite",
|
|
304
|
+
"start": "vite --host",
|
|
271
305
|
"preview:ios": "npx @next2d/builder --platform ios --preview",
|
|
272
306
|
"preview:android": "npx @next2d/builder --platform android --preview",
|
|
273
307
|
"preview:macos": "npx @next2d/builder --platform macos --preview",
|
|
@@ -319,13 +353,14 @@ const createApp = (app_name, template = "@next2d/framework-template") => {
|
|
|
319
353
|
"electron/resources"
|
|
320
354
|
];
|
|
321
355
|
fs.writeFileSync(path.join(root, ".gitignore"), ignoreList.join(os.EOL));
|
|
322
|
-
install(root, appName, template, [
|
|
323
|
-
"@next2d/player",
|
|
324
|
-
"@next2d/framework",
|
|
356
|
+
install(root, appName, template, ["@next2d/framework"], [
|
|
325
357
|
"@next2d/vite-auto-loader-plugin",
|
|
326
358
|
"jsdom",
|
|
327
359
|
"vite",
|
|
328
360
|
"vitest",
|
|
361
|
+
"@vitest/web-worker",
|
|
362
|
+
"vitest-webgl-canvas-mock",
|
|
363
|
+
"@types/node",
|
|
329
364
|
"@capacitor/cli",
|
|
330
365
|
"@capacitor/core",
|
|
331
366
|
"@capacitor/ios",
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-next2d-app",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Create Next2D apps with no build configuration.",
|
|
5
|
-
"author": "Toshiyuki Ienaga<ienaga@
|
|
5
|
+
"author": "Toshiyuki Ienaga<ienaga@next2d.app>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
16
|
"lint": "eslint src/index.ts",
|
|
17
|
-
"
|
|
17
|
+
"release": "tsc"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -27,19 +27,23 @@
|
|
|
27
27
|
"create-next2d-app": "dist/index.js"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@types/node": "^
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"semver": "7.
|
|
30
|
+
"@types/node": "^22.13.11",
|
|
31
|
+
"commander": "13.1.0",
|
|
32
|
+
"cross-spawn": "7.0.6",
|
|
33
|
+
"fs-extra": "11.3.0",
|
|
34
|
+
"picocolors": "^1.1.1",
|
|
35
|
+
"semver": "7.7.1",
|
|
36
36
|
"tar-pack": "3.4.1",
|
|
37
|
-
"validate-npm-package-name": "
|
|
37
|
+
"validate-npm-package-name": "6.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"eslint": "^8.
|
|
43
|
-
"typescript": "^
|
|
40
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
41
|
+
"@eslint/js": "^9.23.0",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^8.27.0",
|
|
43
|
+
"@typescript-eslint/parser": "^8.27.0",
|
|
44
|
+
"eslint": "^9.23.0",
|
|
45
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
46
|
+
"globals": "^16.0.0",
|
|
47
|
+
"typescript": "^5.8.2"
|
|
44
48
|
}
|
|
45
49
|
}
|