create-next2d-app 1.0.3 → 1.0.7
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 +2 -2
- package/index.js +73 -69
- package/package.json +7 -1
package/README.md
CHANGED
|
@@ -22,9 +22,9 @@ npm start
|
|
|
22
22
|
npm start
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
*
|
|
25
|
+
* Generate the necessary View and ViewModel classes from the routing JSON file.
|
|
26
26
|
```sh
|
|
27
|
-
npm run
|
|
27
|
+
npm run generate
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
* Bundles the app into static files for production.
|
package/index.js
CHANGED
|
@@ -26,62 +26,10 @@ const packageJson = require("./package.json");
|
|
|
26
26
|
|
|
27
27
|
let projectName;
|
|
28
28
|
|
|
29
|
-
function exec ()
|
|
30
|
-
{
|
|
31
|
-
const program = new commander.Command(packageJson.name)
|
|
32
|
-
.version(packageJson.version)
|
|
33
|
-
.arguments("<project-directory>")
|
|
34
|
-
.usage(`${chalk.green("<project-directory>")} [options]`)
|
|
35
|
-
.action((name) => { projectName = name })
|
|
36
|
-
.option("--info", "print environment debug info")
|
|
37
|
-
.option(
|
|
38
|
-
"--template <path-to-template>",
|
|
39
|
-
"specify a template for the created project"
|
|
40
|
-
)
|
|
41
|
-
.on("--help", () =>
|
|
42
|
-
{
|
|
43
|
-
console.log();
|
|
44
|
-
console.log(` A custom ${chalk.cyan("--template")} can be one of:`);
|
|
45
|
-
console.log(
|
|
46
|
-
` - a custom template published on npm default: ${chalk.green(
|
|
47
|
-
"@next2d/framework-template"
|
|
48
|
-
)}`
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
console.log();
|
|
52
|
-
console.log(
|
|
53
|
-
" If you have any problems, do not hesitate to file an issue:"
|
|
54
|
-
);
|
|
55
|
-
console.log(
|
|
56
|
-
` ${chalk.cyan(
|
|
57
|
-
"https://github.com/Next2D/create-next2d-app/issues/new"
|
|
58
|
-
)}`
|
|
59
|
-
);
|
|
60
|
-
console.log();
|
|
61
|
-
})
|
|
62
|
-
.parse(process.argv);
|
|
63
|
-
|
|
64
|
-
if (typeof projectName === "undefined") {
|
|
65
|
-
|
|
66
|
-
console.error("Please specify the project directory:");
|
|
67
|
-
console.log(
|
|
68
|
-
` npx ${chalk.cyan(program.name())} ${chalk.green("<project-directory>")}`
|
|
69
|
-
);
|
|
70
|
-
console.log();
|
|
71
|
-
console.log("For example:");
|
|
72
|
-
console.log(
|
|
73
|
-
` npx ${chalk.cyan(program.name())} ${chalk.green("my-next2d-app")}`
|
|
74
|
-
);
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
createApp(projectName, program.template);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
29
|
/**
|
|
82
30
|
* @param {string} app_name
|
|
83
31
|
*/
|
|
84
|
-
function
|
|
32
|
+
const checkAppName = function (app_name)
|
|
85
33
|
{
|
|
86
34
|
const validationResult = validateProjectName(app_name);
|
|
87
35
|
if (!validationResult.validForNewPackages) {
|
|
@@ -116,12 +64,12 @@ function checkAppName(app_name)
|
|
|
116
64
|
);
|
|
117
65
|
process.exit(1);
|
|
118
66
|
}
|
|
119
|
-
}
|
|
67
|
+
};
|
|
120
68
|
|
|
121
69
|
/**
|
|
122
70
|
* @return {boolean}
|
|
123
71
|
*/
|
|
124
|
-
|
|
72
|
+
const checkThatNpmCanReadCwd = function ()
|
|
125
73
|
{
|
|
126
74
|
const cwd = process.cwd();
|
|
127
75
|
let childOutput = null;
|
|
@@ -175,12 +123,12 @@ function checkThatNpmCanReadCwd ()
|
|
|
175
123
|
}
|
|
176
124
|
|
|
177
125
|
return false;
|
|
178
|
-
}
|
|
126
|
+
};
|
|
179
127
|
|
|
180
128
|
/**
|
|
181
129
|
* @return {object}
|
|
182
130
|
*/
|
|
183
|
-
|
|
131
|
+
const checkNpmVersion = function ()
|
|
184
132
|
{
|
|
185
133
|
let hasMinNpm = false;
|
|
186
134
|
let npmVersion = null;
|
|
@@ -196,7 +144,7 @@ function checkNpmVersion ()
|
|
|
196
144
|
"hasMinNpm": hasMinNpm,
|
|
197
145
|
"npmVersion": npmVersion
|
|
198
146
|
};
|
|
199
|
-
}
|
|
147
|
+
};
|
|
200
148
|
|
|
201
149
|
/**
|
|
202
150
|
* @param {string} root
|
|
@@ -205,7 +153,7 @@ function checkNpmVersion ()
|
|
|
205
153
|
* @param {array} dependencies
|
|
206
154
|
* @return {Promise<unknown>}
|
|
207
155
|
*/
|
|
208
|
-
|
|
156
|
+
const install = function (root, app_name, template, dependencies)
|
|
209
157
|
{
|
|
210
158
|
console.log("Installing packages. This may take a few minutes.");
|
|
211
159
|
|
|
@@ -324,7 +272,7 @@ function install (root, app_name, template, dependencies)
|
|
|
324
272
|
} else {
|
|
325
273
|
|
|
326
274
|
console.log();
|
|
327
|
-
console.log(`Success! Created ${chalk.green(app_name)} at ${chalk.green(root)}`)
|
|
275
|
+
console.log(`Success! Created ${chalk.green(app_name)} at ${chalk.green(root)}`);
|
|
328
276
|
|
|
329
277
|
console.log();
|
|
330
278
|
console.log("you can run several commands:");
|
|
@@ -334,8 +282,8 @@ function install (root, app_name, template, dependencies)
|
|
|
334
282
|
console.log(" Starts the development server.");
|
|
335
283
|
|
|
336
284
|
console.log();
|
|
337
|
-
console.log(` ${chalk.green("npm run
|
|
338
|
-
console.log("
|
|
285
|
+
console.log(` ${chalk.green("npm run generate")}`);
|
|
286
|
+
console.log(" Generate the necessary View and ViewModel classes from the routing JSON file.");
|
|
339
287
|
|
|
340
288
|
console.log();
|
|
341
289
|
console.log(` ${chalk.green("npm run build --env=\"prd\"")}`);
|
|
@@ -346,20 +294,20 @@ function install (root, app_name, template, dependencies)
|
|
|
346
294
|
console.log(" Starts the test runner.");
|
|
347
295
|
|
|
348
296
|
console.log();
|
|
349
|
-
console.log("We suggest that you begin by typing:")
|
|
297
|
+
console.log("We suggest that you begin by typing:");
|
|
350
298
|
console.log(` ${chalk.green("cd")} ${app_name}`);
|
|
351
299
|
console.log(` ${chalk.green("npm start")}`);
|
|
352
300
|
console.log();
|
|
353
301
|
}
|
|
354
302
|
});
|
|
355
303
|
});
|
|
356
|
-
}
|
|
304
|
+
};
|
|
357
305
|
|
|
358
306
|
/**
|
|
359
307
|
* @param {string} app_name
|
|
360
308
|
* @param {string} [template="@next2d/framework-template"]
|
|
361
309
|
*/
|
|
362
|
-
|
|
310
|
+
const createApp = function (app_name, template = "@next2d/framework-template")
|
|
363
311
|
{
|
|
364
312
|
const root = path.resolve(app_name);
|
|
365
313
|
const appName = path.basename(root);
|
|
@@ -381,7 +329,8 @@ function createApp (app_name, template = "@next2d/framework-template")
|
|
|
381
329
|
"start": "webpack serve",
|
|
382
330
|
"build": "webpack --mode production",
|
|
383
331
|
"lint": "eslint src/**/*.js",
|
|
384
|
-
"test": "jest"
|
|
332
|
+
"test": "npx jest",
|
|
333
|
+
"generate": "npx next2d-view-generator"
|
|
385
334
|
}
|
|
386
335
|
}, null, 2) + os.EOL
|
|
387
336
|
);
|
|
@@ -412,8 +361,8 @@ function createApp (app_name, template = "@next2d/framework-template")
|
|
|
412
361
|
"npm-debug.log*",
|
|
413
362
|
"yarn-debug.log*",
|
|
414
363
|
"yarn-error.log*",
|
|
415
|
-
"src/Config.
|
|
416
|
-
"src/Packages.
|
|
364
|
+
"src/config/Config.js",
|
|
365
|
+
"src/Packages.js"
|
|
417
366
|
];
|
|
418
367
|
|
|
419
368
|
fs.writeFileSync(
|
|
@@ -430,6 +379,61 @@ function createApp (app_name, template = "@next2d/framework-template")
|
|
|
430
379
|
"webpack-cli",
|
|
431
380
|
"webpack-dev-server"
|
|
432
381
|
]);
|
|
433
|
-
}
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* @return {void}
|
|
386
|
+
*/
|
|
387
|
+
const exec = function ()
|
|
388
|
+
{
|
|
389
|
+
const program = new commander.Command(packageJson.name)
|
|
390
|
+
.version(packageJson.version)
|
|
391
|
+
.arguments("<project-directory>")
|
|
392
|
+
.usage(`${chalk.green("<project-directory>")} [options]`)
|
|
393
|
+
.action((name) => { projectName = name })
|
|
394
|
+
.option("--info", "print environment debug info")
|
|
395
|
+
.option(
|
|
396
|
+
"--template <path-to-template>",
|
|
397
|
+
"specify a template for the created project"
|
|
398
|
+
)
|
|
399
|
+
.on("--help", () =>
|
|
400
|
+
{
|
|
401
|
+
console.log();
|
|
402
|
+
console.log(` A custom ${chalk.cyan("--template")} can be one of:`);
|
|
403
|
+
console.log(
|
|
404
|
+
` - a custom template published on npm default: ${chalk.green(
|
|
405
|
+
"@next2d/framework-template"
|
|
406
|
+
)}`
|
|
407
|
+
);
|
|
408
|
+
|
|
409
|
+
console.log();
|
|
410
|
+
console.log(
|
|
411
|
+
" If you have any problems, do not hesitate to file an issue:"
|
|
412
|
+
);
|
|
413
|
+
console.log(
|
|
414
|
+
` ${chalk.cyan(
|
|
415
|
+
"https://github.com/Next2D/create-next2d-app/issues/new"
|
|
416
|
+
)}`
|
|
417
|
+
);
|
|
418
|
+
console.log();
|
|
419
|
+
})
|
|
420
|
+
.parse(process.argv);
|
|
421
|
+
|
|
422
|
+
if (typeof projectName === "undefined") {
|
|
423
|
+
|
|
424
|
+
console.error("Please specify the project directory:");
|
|
425
|
+
console.log(
|
|
426
|
+
` npx ${chalk.cyan(program.name())} ${chalk.green("<project-directory>")}`
|
|
427
|
+
);
|
|
428
|
+
console.log();
|
|
429
|
+
console.log("For example:");
|
|
430
|
+
console.log(
|
|
431
|
+
` npx ${chalk.cyan(program.name())} ${chalk.green("my-next2d-app")}`
|
|
432
|
+
);
|
|
433
|
+
process.exit(1);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
createApp(projectName, program.template);
|
|
437
|
+
};
|
|
434
438
|
|
|
435
439
|
exec();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-next2d-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Create Next2D apps with no build configuration.",
|
|
5
5
|
"author": "Toshiyuki Ienaga<ienaga@tvon.jp>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"Next2D",
|
|
11
11
|
"create-next2d-app"
|
|
12
12
|
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"lint": "eslint index.js"
|
|
15
|
+
},
|
|
13
16
|
"repository": {
|
|
14
17
|
"type": "git",
|
|
15
18
|
"url": "git+https://github.com/Next2D/create-next2d-app.git"
|
|
@@ -25,5 +28,8 @@
|
|
|
25
28
|
"semver": "7.3.2",
|
|
26
29
|
"tar-pack": "3.4.1",
|
|
27
30
|
"validate-npm-package-name": "3.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"eslint": "^8.0.0"
|
|
28
34
|
}
|
|
29
35
|
}
|