@next2d/view-generator 1.1.5 → 1.3.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/index.js +20 -26
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -13,10 +13,10 @@ if (10 > version.split(".")[0]) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const chalk = require("chalk");
|
|
16
|
-
const
|
|
16
|
+
const { Command } = require("commander");
|
|
17
17
|
const packageJson = require("./package.json");
|
|
18
18
|
const path = require("path");
|
|
19
|
-
const fs
|
|
19
|
+
const fs = require("fs-extra");
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @return {void}
|
|
@@ -42,7 +42,7 @@ const createFile = function ()
|
|
|
42
42
|
|
|
43
43
|
for (let idx = 0; idx < keys.length; ++idx) {
|
|
44
44
|
|
|
45
|
-
const names = keys[idx].split(
|
|
45
|
+
const names = keys[idx].split("-");
|
|
46
46
|
|
|
47
47
|
if (names[0].charAt(0) === "@") {
|
|
48
48
|
continue;
|
|
@@ -104,25 +104,32 @@ export class ${name}View extends next2d.fw.View
|
|
|
104
104
|
* @extends {next2d.fw.ViewModel}
|
|
105
105
|
*/
|
|
106
106
|
export class ${name}ViewModel extends next2d.fw.ViewModel
|
|
107
|
-
{
|
|
107
|
+
{
|
|
108
108
|
/**
|
|
109
|
-
* @param
|
|
110
|
-
* @
|
|
109
|
+
* @param {next2d.fw.View} view
|
|
110
|
+
* @return {void}
|
|
111
|
+
* @method
|
|
111
112
|
* @public
|
|
112
113
|
*/
|
|
113
|
-
|
|
114
|
+
unbind (view)
|
|
114
115
|
{
|
|
115
|
-
|
|
116
|
+
console.log(view);
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
/**
|
|
119
120
|
* @param {next2d.fw.View} view
|
|
120
|
-
* @return {Promise
|
|
121
|
+
* @return {Promise}
|
|
122
|
+
* @method
|
|
121
123
|
* @public
|
|
122
124
|
*/
|
|
123
125
|
bind (view)
|
|
124
126
|
{
|
|
125
|
-
return this
|
|
127
|
+
return this
|
|
128
|
+
.factory()
|
|
129
|
+
.then(() =>
|
|
130
|
+
{
|
|
131
|
+
console.log(view);
|
|
132
|
+
});
|
|
126
133
|
}
|
|
127
134
|
}`);
|
|
128
135
|
}
|
|
@@ -137,23 +144,10 @@ export class ${name}ViewModel extends next2d.fw.ViewModel
|
|
|
137
144
|
*/
|
|
138
145
|
const exec = function ()
|
|
139
146
|
{
|
|
140
|
-
new
|
|
147
|
+
new Command()
|
|
148
|
+
.name(packageJson.name)
|
|
149
|
+
.description("Generate the View, ViewModel class required for routing.")
|
|
141
150
|
.version(packageJson.version)
|
|
142
|
-
.arguments("<project-directory>")
|
|
143
|
-
.usage(`${chalk.green("<project-directory>")} [options]`)
|
|
144
|
-
.on("--help", () =>
|
|
145
|
-
{
|
|
146
|
-
console.log();
|
|
147
|
-
console.log(
|
|
148
|
-
" If you have any problems, do not hesitate to file an issue:"
|
|
149
|
-
);
|
|
150
|
-
console.log(
|
|
151
|
-
` ${chalk.cyan(
|
|
152
|
-
"https://github.com/Next2D/next2d-view-generator/issues/new"
|
|
153
|
-
)}`
|
|
154
|
-
);
|
|
155
|
-
console.log();
|
|
156
|
-
})
|
|
157
151
|
.parse(process.argv);
|
|
158
152
|
|
|
159
153
|
createFile();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next2d/view-generator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Generate the View class required for routing.",
|
|
5
5
|
"author": "Toshiyuki Ienaga<ienaga@tvon.jp>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"eslint": "^8.22.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"chalk": "
|
|
27
|
+
"chalk": "4.1.2",
|
|
28
28
|
"commander": "^9.4.0",
|
|
29
29
|
"fs-extra": "^10.1.0"
|
|
30
30
|
}
|