@next2d/view-generator 0.0.3 → 1.1.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 +5 -5
- package/index.js +8 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
[](https://github.com/Next2D/view-generator/actions/workflows/codeql-analysis.yml)
|
|
2
|
+
[](https://github.com/Next2D/view-generator/releases)
|
|
3
|
+
[](https://github.com/Next2D/view-generator/blob/main/LICENSE)
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# view-generator
|
|
6
6
|
Generate the View class required for routing.
|
|
7
7
|
|
|
8
8
|
## Commands
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
|
-
npx next2d
|
|
11
|
+
npx @next2d/view-generator
|
|
12
12
|
```
|
package/index.js
CHANGED
|
@@ -25,13 +25,15 @@ const createFile = function ()
|
|
|
25
25
|
{
|
|
26
26
|
|
|
27
27
|
console.log();
|
|
28
|
-
console.log("Begin research.");
|
|
28
|
+
console.log(`${chalk.green("Begin research.")}`);
|
|
29
29
|
console.log();
|
|
30
30
|
|
|
31
31
|
const cwd = `${process.cwd()}/src/`;
|
|
32
32
|
|
|
33
33
|
const routingPath = path.join(cwd, "config/routing.json");
|
|
34
34
|
if (!fs.existsSync(routingPath)) {
|
|
35
|
+
console.log(`${chalk.red("Could not find routing.json.")}`);
|
|
36
|
+
console.log();
|
|
35
37
|
return ;
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -44,6 +46,10 @@ const createFile = function ()
|
|
|
44
46
|
|
|
45
47
|
const viewDir = path.join(cwd, `view/${names[0]}`);
|
|
46
48
|
if (!fs.existsSync(viewDir)) {
|
|
49
|
+
|
|
50
|
+
console.log(`${chalk.green(`Create a new Directory ${viewDir}.`)}`);
|
|
51
|
+
console.log();
|
|
52
|
+
|
|
47
53
|
fs.ensureDirSync(viewDir);
|
|
48
54
|
}
|
|
49
55
|
|
|
@@ -62,7 +68,6 @@ const createFile = function ()
|
|
|
62
68
|
const viewFile = path.join(viewDir, `${name}View.js`);
|
|
63
69
|
if (!fs.existsSync(viewFile)) {
|
|
64
70
|
|
|
65
|
-
console.log();
|
|
66
71
|
console.log(`Create a new View Class ${viewFile}.`);
|
|
67
72
|
console.log();
|
|
68
73
|
|
|
@@ -87,7 +92,6 @@ export class ${name}View extends next2d.fw.View
|
|
|
87
92
|
const viewModelFile = path.join(viewDir, `${name}ViewModel.js`);
|
|
88
93
|
if (!fs.existsSync(viewModelFile)) {
|
|
89
94
|
|
|
90
|
-
console.log();
|
|
91
95
|
console.log(`Create a new ViewModel Class ${viewModelFile}.`);
|
|
92
96
|
console.log();
|
|
93
97
|
|
|
@@ -120,8 +124,8 @@ export class ${name}ViewModel extends next2d.fw.ViewModel
|
|
|
120
124
|
}
|
|
121
125
|
}
|
|
122
126
|
|
|
127
|
+
console.log(`${chalk.green("Finished.")}`);
|
|
123
128
|
console.log();
|
|
124
|
-
console.log(`Finished.`);
|
|
125
129
|
};
|
|
126
130
|
|
|
127
131
|
/**
|