@next2d/view-generator 0.0.1 → 0.0.5
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/index.js +22 -0
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -23,10 +23,17 @@ const fs = require("fs-extra");
|
|
|
23
23
|
*/
|
|
24
24
|
const createFile = function ()
|
|
25
25
|
{
|
|
26
|
+
|
|
27
|
+
console.log();
|
|
28
|
+
console.log(`${chalk.green("Begin research.")}`);
|
|
29
|
+
console.log();
|
|
30
|
+
|
|
26
31
|
const cwd = `${process.cwd()}/src/`;
|
|
27
32
|
|
|
28
33
|
const routingPath = path.join(cwd, "config/routing.json");
|
|
29
34
|
if (!fs.existsSync(routingPath)) {
|
|
35
|
+
console.log(`${chalk.red("Could not find routing.json.")}`);
|
|
36
|
+
console.log();
|
|
30
37
|
return ;
|
|
31
38
|
}
|
|
32
39
|
|
|
@@ -39,6 +46,10 @@ const createFile = function ()
|
|
|
39
46
|
|
|
40
47
|
const viewDir = path.join(cwd, `view/${names[0]}`);
|
|
41
48
|
if (!fs.existsSync(viewDir)) {
|
|
49
|
+
|
|
50
|
+
console.log(`${chalk.green(`Create a new Directory ${viewDir}.`)}`);
|
|
51
|
+
console.log();
|
|
52
|
+
|
|
42
53
|
fs.ensureDirSync(viewDir);
|
|
43
54
|
}
|
|
44
55
|
|
|
@@ -56,6 +67,10 @@ const createFile = function ()
|
|
|
56
67
|
// create View file
|
|
57
68
|
const viewFile = path.join(viewDir, `${name}View.js`);
|
|
58
69
|
if (!fs.existsSync(viewFile)) {
|
|
70
|
+
|
|
71
|
+
console.log(`Create a new View Class ${viewFile}.`);
|
|
72
|
+
console.log();
|
|
73
|
+
|
|
59
74
|
fs.writeFileSync(viewFile, `/**
|
|
60
75
|
* @class
|
|
61
76
|
* @extends {next2d.fw.View}
|
|
@@ -76,6 +91,10 @@ export class ${name}View extends next2d.fw.View
|
|
|
76
91
|
// create ViewModel file
|
|
77
92
|
const viewModelFile = path.join(viewDir, `${name}ViewModel.js`);
|
|
78
93
|
if (!fs.existsSync(viewModelFile)) {
|
|
94
|
+
|
|
95
|
+
console.log(`Create a new ViewModel Class ${viewModelFile}.`);
|
|
96
|
+
console.log();
|
|
97
|
+
|
|
79
98
|
fs.writeFileSync(viewModelFile, `/**
|
|
80
99
|
* @class
|
|
81
100
|
* @extends {next2d.fw.ViewModel}
|
|
@@ -104,6 +123,9 @@ export class ${name}ViewModel extends next2d.fw.ViewModel
|
|
|
104
123
|
}`);
|
|
105
124
|
}
|
|
106
125
|
}
|
|
126
|
+
|
|
127
|
+
console.log(`${chalk.green("Finished.")}`);
|
|
128
|
+
console.log();
|
|
107
129
|
};
|
|
108
130
|
|
|
109
131
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next2d/view-generator",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Generate the View class required for routing.",
|
|
5
5
|
"author": "Toshiyuki Ienaga<ienaga@tvon.jp>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"url": "git+https://github.com/Next2D/view-generator.git"
|
|
19
19
|
},
|
|
20
20
|
"bin": {
|
|
21
|
-
"next2d
|
|
21
|
+
"@next2d/view-generator": "index.js"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"chalk": "4.1.0",
|