@kosdev-code/kos-ui-cli 2.0.8 → 2.0.9
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/package.json +2 -2
- package/src/lib/cli.mjs +59 -109
- package/src/lib/generators/cache/index.mjs +12 -0
- package/src/lib/generators/component/index.mjs +48 -0
- package/src/lib/{env-plopfile.mjs → generators/env/index.mjs} +17 -10
- package/src/lib/generators/i18n/namespace.mjs +55 -0
- package/src/lib/generators/metadata.json +150 -0
- package/src/lib/generators/model/companion.mjs +77 -0
- package/src/lib/generators/model/container.mjs +66 -0
- package/src/lib/generators/model/context.mjs +54 -0
- package/src/lib/generators/model/hook.mjs +54 -0
- package/src/lib/generators/model/model.mjs +63 -0
- package/src/lib/generators/plugin/index.mjs +82 -0
- package/src/lib/generators/project/app.mjs +37 -0
- package/src/lib/generators/project/i18n.mjs +36 -0
- package/src/lib/generators/project/plugin.mjs +36 -0
- package/src/lib/generators/project/splash.mjs +37 -0
- package/src/lib/generators/project/theme.mjs +36 -0
- package/src/lib/generators/workspace/index.mjs +30 -0
- package/src/lib/plopfile.mjs +47 -582
- package/src/lib/routing-plopfile.mjs +31 -63
- package/src/lib/scripts/generate-metadata.mjs +39 -0
- package/src/lib/utils/cache.mjs +128 -0
- package/src/lib/utils/exec.mjs +18 -0
- package/src/lib/utils/generator-loader.mjs +65 -0
- package/src/lib/utils/logger.mjs +0 -0
- package/src/lib/utils/nx-context.mjs +97 -0
- package/src/lib/utils/prompts.mjs +46 -0
- package/src/lib/utils/validators.mjs +10 -0
- package/src/lib/model-aware-plopfile.mjs +0 -274
package/src/lib/plopfile.mjs
CHANGED
|
@@ -1,586 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
// plopfile.mjs
|
|
2
|
+
import { detectWorkspace } from "./utils/nx-context.mjs";
|
|
3
|
+
|
|
4
|
+
// Generator registration
|
|
5
|
+
import registerCompanion from "./generators/model/companion.mjs";
|
|
6
|
+
import registerContainer from "./generators/model/container.mjs";
|
|
7
|
+
import registerContext from "./generators/model/context.mjs";
|
|
8
|
+
import registerHook from "./generators/model/hook.mjs";
|
|
9
|
+
import registerKosModel from "./generators/model/model.mjs";
|
|
10
|
+
|
|
11
|
+
import registerComponent from "./generators/component/index.mjs";
|
|
12
|
+
import registerPluginComponent from "./generators/plugin/index.mjs";
|
|
13
|
+
|
|
14
|
+
import registerCacheGenerators from "./generators/cache/index.mjs";
|
|
15
|
+
import registerEnv from "./generators/env/index.mjs";
|
|
16
|
+
import registerI18nNamespace from "./generators/i18n/namespace.mjs";
|
|
17
|
+
import registerUiProject from "./generators/project/app.mjs";
|
|
18
|
+
import registerI18n from "./generators/project/i18n.mjs";
|
|
19
|
+
import registerPluginProject from "./generators/project/plugin.mjs";
|
|
20
|
+
import registerSplashProject from "./generators/project/splash.mjs";
|
|
21
|
+
import registerTheme from "./generators/project/theme.mjs";
|
|
22
|
+
import registerWorkspace from "./generators/workspace/index.mjs";
|
|
15
23
|
|
|
16
|
-
const DEFAULT_PROMPTS = [
|
|
17
|
-
{
|
|
18
|
-
type: "confirm",
|
|
19
|
-
name: "interactive",
|
|
20
|
-
message: "Do you want to use the interactive mode?",
|
|
21
|
-
default: false,
|
|
22
|
-
when: false,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: "confirm",
|
|
26
|
-
name: "dryRun",
|
|
27
|
-
message: "Show the output of the command without running it?",
|
|
28
|
-
default: false,
|
|
29
|
-
when: false,
|
|
30
|
-
},
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
const MODEL_PROMPTS = [
|
|
34
|
-
{
|
|
35
|
-
type: "confirm",
|
|
36
|
-
name: "container",
|
|
37
|
-
default: false,
|
|
38
|
-
message: "Does this model require a container model?",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: "confirm",
|
|
42
|
-
name: "parentAware",
|
|
43
|
-
when: (answers) => {
|
|
44
|
-
return !!answers.container;
|
|
45
|
-
},
|
|
46
|
-
default: false,
|
|
47
|
-
message: "Should the model be aware of it's parent container?",
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: "confirm",
|
|
51
|
-
name: "singleton",
|
|
52
|
-
default: false,
|
|
53
|
-
message: "Is this model a singleton?",
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
type: "confirm",
|
|
58
|
-
name: "dataServices",
|
|
59
|
-
default: true,
|
|
60
|
-
message: "Create data services for model?",
|
|
61
|
-
},
|
|
62
|
-
];
|
|
63
24
|
export default async function (plop) {
|
|
64
|
-
plop.setPrompt("directory", directoryPrompt);
|
|
65
25
|
const isWorkspace = await detectWorkspace();
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
throw new Error(error);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return `*******************************************************
|
|
95
|
-
model ${answers.modelName} created in ${answers.modelProject}
|
|
96
|
-
|
|
97
|
-
Please register the model in your app registration file
|
|
98
|
-
*******************************************************`;
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
plop.setActionType("addNamespace", async function (answers, config, plop) {
|
|
102
|
-
const i18nProject = await getProjectDetails(answers.project);
|
|
103
|
-
const locale = answers.locale;
|
|
104
|
-
const src = i18nProject.sourceRoot;
|
|
105
|
-
const namespaceDirPath = path.join(src, "assets", "locales", locale);
|
|
106
|
-
|
|
107
|
-
const namespacePath = path.join(namespaceDirPath, `${answers.name}.json`);
|
|
108
|
-
|
|
109
|
-
const defaultData = {
|
|
110
|
-
name: answers.name,
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
fs.mkdirSync(namespaceDirPath, { recursive: true });
|
|
114
|
-
fs.writeFileSync(namespacePath, JSON.stringify(defaultData, null, 2));
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
plop.setActionType("createSplashProject", function (answers, config, plop) {
|
|
118
|
-
return new Promise((resolve, reject) => {
|
|
119
|
-
const command =
|
|
120
|
-
`nx generate @kosdev-code/kos-nx-plugin:kos-splash-project --name=${answers.name} --no-interactive`.split(
|
|
121
|
-
" "
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
const child = spawn("npx", command, { shell: true });
|
|
125
|
-
child.stdout.on("data", (data) => {
|
|
126
|
-
console.log(`${data}`);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
child.stderr.on("data", (data) => {
|
|
130
|
-
console.error(`ERROR:${data}`);
|
|
131
|
-
});
|
|
132
|
-
child.on("exit", function (code, signal) {
|
|
133
|
-
if (code === 0) {
|
|
134
|
-
resolve(`Splash page project ${answers.name} created`);
|
|
135
|
-
} else {
|
|
136
|
-
reject(`Splash page project ${answers.name} failed`);
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
plop.setActionType("createComponent", function (answers, config, plop) {
|
|
142
|
-
return new Promise((resolve, reject) => {
|
|
143
|
-
const command =
|
|
144
|
-
`npx nx generate @kosdev-code/kos-nx-plugin:kos-component --name=${answers.componentName} --appProject=${answers.componentProject} --type=components --no-interactive`.split(
|
|
145
|
-
" "
|
|
146
|
-
);
|
|
147
|
-
const child = spawn("npx", command, { shell: true });
|
|
148
|
-
child.stdout.on("data", (data) => {
|
|
149
|
-
console.log(`${data}`);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
child.stderr.on("data", (data) => {
|
|
153
|
-
console.error(`ERROR:${data}`);
|
|
154
|
-
});
|
|
155
|
-
child.on("exit", function (code, signal) {
|
|
156
|
-
if (code === 0) {
|
|
157
|
-
resolve(`UI project ${answers.name} created`);
|
|
158
|
-
} else {
|
|
159
|
-
reject(`UI project ${answers.name} failed`);
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
plop.setActionType("createPluginComponent", function (answers, config, plop) {
|
|
165
|
-
return new Promise((resolve, reject) => {
|
|
166
|
-
const pluginType = answers.extensionPoint;
|
|
167
|
-
const command =
|
|
168
|
-
`npx nx generate @kosdev-code/kos-nx-plugin:kos-component --name=${answers.componentName} --group=${answers.group} --appProject=${answers.componentProject} --pluginType=${pluginType} --type=components --no-interactive`.split(
|
|
169
|
-
" "
|
|
170
|
-
);
|
|
171
|
-
const child = spawn("npx", command, { shell: true });
|
|
172
|
-
child.stdout.on("data", (data) => {
|
|
173
|
-
console.log(`${data}`);
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
child.stderr.on("data", (data) => {
|
|
177
|
-
console.error(`ERROR:${data}`);
|
|
178
|
-
});
|
|
179
|
-
child.on("exit", function (code, signal) {
|
|
180
|
-
if (code === 0) {
|
|
181
|
-
resolve(`UI project ${answers.name} created`);
|
|
182
|
-
} else {
|
|
183
|
-
reject(`UI project ${answers.name} failed`);
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
plop.setActionType("createUiProject", function (answers, config, plop) {
|
|
189
|
-
return new Promise((resolve, reject) => {
|
|
190
|
-
const command =
|
|
191
|
-
`npx nx generate @kosdev-code/kos-nx-plugin:kos-ui-project --name=${answers.name} --no-interactive`.split(
|
|
192
|
-
" "
|
|
193
|
-
);
|
|
194
|
-
const child = spawn("npx", command, { shell: true });
|
|
195
|
-
child.stdout.on("data", (data) => {
|
|
196
|
-
console.log(`${data}`);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
child.stderr.on("data", (data) => {
|
|
200
|
-
console.error(`ERROR:${data}`);
|
|
201
|
-
});
|
|
202
|
-
child.on("exit", function (code, signal) {
|
|
203
|
-
if (code === 0) {
|
|
204
|
-
resolve(`UI project ${answers.name} created`);
|
|
205
|
-
} else {
|
|
206
|
-
reject(`UI project ${answers.name} failed`);
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
plop.setActionType("createI18nProject", function (answers, config, plop) {
|
|
213
|
-
return new Promise((resolve, reject) => {
|
|
214
|
-
const command =
|
|
215
|
-
`npx nx generate @kosdev-code/kos-nx-plugin:kos-i18n-project --name=${answers.name} --no-interactive`.split(
|
|
216
|
-
" "
|
|
217
|
-
);
|
|
218
|
-
const child = spawn("npx", command, { shell: true });
|
|
219
|
-
child.stdout.on("data", (data) => {
|
|
220
|
-
console.log(`${data}`);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
child.stderr.on("data", (data) => {
|
|
224
|
-
console.error(`ERROR:${data}`);
|
|
225
|
-
});
|
|
226
|
-
child.on("exit", function (code, signal) {
|
|
227
|
-
if (code === 0) {
|
|
228
|
-
resolve(`i18n project ${answers.name} created`);
|
|
229
|
-
} else {
|
|
230
|
-
reject(`i18n project ${answers.name} failed`);
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
plop.setActionType("createThemeProject", function (answers, config, plop) {
|
|
236
|
-
return new Promise((resolve, reject) => {
|
|
237
|
-
const command =
|
|
238
|
-
`npx nx generate @kosdev-code/kos-nx-plugin:kos-theme-project --name=${answers.name} --no-interactive`.split(
|
|
239
|
-
" "
|
|
240
|
-
);
|
|
241
|
-
const child = spawn("npx", command, { shell: true });
|
|
242
|
-
child.stdout.on("data", (data) => {
|
|
243
|
-
console.log(`${data}`);
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
child.stderr.on("data", (data) => {
|
|
247
|
-
console.error(`ERROR:${data}`);
|
|
248
|
-
});
|
|
249
|
-
child.on("exit", function (code, signal) {
|
|
250
|
-
if (code === 0) {
|
|
251
|
-
resolve(`theme project ${answers.name} created`);
|
|
252
|
-
} else {
|
|
253
|
-
reject(`theme project ${answers.name} failed`);
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
plop.setActionType("createPluginProject", function (answers, config, plop) {
|
|
260
|
-
return new Promise((resolve, reject) => {
|
|
261
|
-
const command =
|
|
262
|
-
`npx nx generate @kosdev-code/kos-nx-plugin:kos-plugin-project --name=${answers.name} --no-interactive`.split(
|
|
263
|
-
" "
|
|
264
|
-
);
|
|
265
|
-
const child = spawn("npx", command, { shell: true });
|
|
266
|
-
child.stdout.on("data", (data) => {
|
|
267
|
-
console.log(`${data}`);
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
child.stderr.on("data", (data) => {
|
|
271
|
-
console.error(`ERROR:${data}`);
|
|
272
|
-
});
|
|
273
|
-
child.on("exit", function (code, signal) {
|
|
274
|
-
if (code === 0) {
|
|
275
|
-
resolve(`plugin project ${answers.name} created`);
|
|
276
|
-
} else {
|
|
277
|
-
reject(`plugin project ${answers.name} failed`);
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
plop.setGenerator("component", {
|
|
284
|
-
description: "Create a new KOS Component",
|
|
285
|
-
prompts: [
|
|
286
|
-
{
|
|
287
|
-
type: "input",
|
|
288
|
-
name: "componentName",
|
|
289
|
-
message: "Enter the name of the component",
|
|
290
|
-
validate: required,
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
type: "list",
|
|
294
|
-
name: "componentProject",
|
|
295
|
-
message: "Which project should the component be created in?",
|
|
296
|
-
choices: allProjects,
|
|
297
|
-
},
|
|
298
|
-
],
|
|
299
|
-
actions: function (data) {
|
|
300
|
-
const action = {
|
|
301
|
-
type: "createComponent",
|
|
302
|
-
};
|
|
303
|
-
return [action];
|
|
304
|
-
},
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
const pluginPrompts = [
|
|
308
|
-
{
|
|
309
|
-
type: "input",
|
|
310
|
-
name: "componentName",
|
|
311
|
-
message: "Enter the name of the component",
|
|
312
|
-
validate: required,
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
type: "list",
|
|
316
|
-
name: "componentProject",
|
|
317
|
-
message: "Which project should the component be created in?",
|
|
318
|
-
choices: getPluginProjects,
|
|
319
|
-
},
|
|
320
|
-
];
|
|
321
|
-
plop.setGenerator("pluginComponent", {
|
|
322
|
-
description: "Create a new KOS Plugin Component",
|
|
323
|
-
prompts: [
|
|
324
|
-
...pluginPrompts,
|
|
325
|
-
{
|
|
326
|
-
type: "list",
|
|
327
|
-
name: "extensionPoint",
|
|
328
|
-
message: "What type of extension point is the plugin supporting?",
|
|
329
|
-
choices: ["cui", "setup", "utility", "setting", "troubleAction"],
|
|
330
|
-
},
|
|
331
|
-
],
|
|
332
|
-
actions: function (data) {
|
|
333
|
-
const action = {
|
|
334
|
-
type: "createPluginComponent",
|
|
335
|
-
};
|
|
336
|
-
return [action];
|
|
337
|
-
},
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
plop.setGenerator("plugin:cui", {
|
|
341
|
-
description: "Create a new KOS CUI Configuration Plugin Component",
|
|
342
|
-
prompts: [...pluginPrompts],
|
|
343
|
-
actions: function (data) {
|
|
344
|
-
data.extensionPoint = "cui";
|
|
345
|
-
const action = {
|
|
346
|
-
type: "createPluginComponent",
|
|
347
|
-
extensionPoint: "cui",
|
|
348
|
-
};
|
|
349
|
-
return [action];
|
|
350
|
-
},
|
|
351
|
-
});
|
|
352
|
-
plop.setGenerator("plugin:utility", {
|
|
353
|
-
description: "Create a new KOS Utility Plugin Component",
|
|
354
|
-
prompts: [...pluginPrompts],
|
|
355
|
-
actions: function (data) {
|
|
356
|
-
data.extensionPoint = "utility";
|
|
357
|
-
const action = {
|
|
358
|
-
type: "createPluginComponent",
|
|
359
|
-
extensionPoint: "utility",
|
|
360
|
-
};
|
|
361
|
-
return [action];
|
|
362
|
-
},
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
plop.setGenerator("plugin:troubleAction", {
|
|
366
|
-
description: "Create a new KOS Trouble Action Plugin Component",
|
|
367
|
-
prompts: [...pluginPrompts],
|
|
368
|
-
actions: function (data) {
|
|
369
|
-
data.extensionPoint = "troubleAction";
|
|
370
|
-
const action = {
|
|
371
|
-
type: "createPluginComponent",
|
|
372
|
-
extensionPoint: "troubleAction",
|
|
373
|
-
};
|
|
374
|
-
return [action];
|
|
375
|
-
},
|
|
376
|
-
});
|
|
377
|
-
|
|
378
|
-
plop.setGenerator("plugin:setup", {
|
|
379
|
-
description: "Create a new KOS Setup Step Plugin Component",
|
|
380
|
-
prompts: [...pluginPrompts],
|
|
381
|
-
actions: function (data) {
|
|
382
|
-
data.extensionPoint = "setup";
|
|
383
|
-
const action = {
|
|
384
|
-
type: "createPluginComponent",
|
|
385
|
-
extensionPoint: "setup",
|
|
386
|
-
};
|
|
387
|
-
return [action];
|
|
388
|
-
},
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
plop.setGenerator("plugin:setting", {
|
|
392
|
-
description: "Create a new KOS Settings Plugin Component",
|
|
393
|
-
prompts: [
|
|
394
|
-
...pluginPrompts,
|
|
395
|
-
{
|
|
396
|
-
type: "input",
|
|
397
|
-
name: "group",
|
|
398
|
-
message: "Which settings group should the setting be located?",
|
|
399
|
-
},
|
|
400
|
-
],
|
|
401
|
-
actions: function (data) {
|
|
402
|
-
data.extensionPoint = "setting";
|
|
403
|
-
const action = {
|
|
404
|
-
type: "createPluginComponent",
|
|
405
|
-
extensionPoint: "setting",
|
|
406
|
-
};
|
|
407
|
-
return [action];
|
|
408
|
-
},
|
|
409
|
-
});
|
|
410
|
-
plop.setGenerator("plugin:nav", {
|
|
411
|
-
description: "Create a new KOS Navigation View Plugin Component",
|
|
412
|
-
prompts: [...pluginPrompts],
|
|
413
|
-
actions: function (data) {
|
|
414
|
-
data.extensionPoint = "nav";
|
|
415
|
-
const action = {
|
|
416
|
-
type: "createPluginComponent",
|
|
417
|
-
extensionPoint: "nav",
|
|
418
|
-
};
|
|
419
|
-
return [action];
|
|
420
|
-
},
|
|
421
|
-
});
|
|
422
|
-
plop.setGenerator("workspace", {
|
|
423
|
-
description: "KOS UI Workspace Setup",
|
|
424
|
-
prompts: [
|
|
425
|
-
{
|
|
426
|
-
type: "input",
|
|
427
|
-
name: "workspaceName",
|
|
428
|
-
message: "KOS UI Workspace Name",
|
|
429
|
-
validate: required,
|
|
430
|
-
},
|
|
431
|
-
],
|
|
432
|
-
actions: function (data) {
|
|
433
|
-
const action = {
|
|
434
|
-
type: "createWorkspace",
|
|
435
|
-
};
|
|
436
|
-
return [action];
|
|
437
|
-
},
|
|
438
|
-
});
|
|
439
|
-
|
|
440
|
-
plop.setGenerator("model", {
|
|
441
|
-
description: "Create a new KOS Model",
|
|
442
|
-
prompts: [
|
|
443
|
-
...DEFAULT_PROMPTS,
|
|
444
|
-
{
|
|
445
|
-
type: "input",
|
|
446
|
-
name: "modelName",
|
|
447
|
-
message: "Enter the name of the model",
|
|
448
|
-
validate: required,
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
type: "list",
|
|
452
|
-
name: "modelProject",
|
|
453
|
-
message: "Which model project to use?",
|
|
454
|
-
validate: required,
|
|
455
|
-
choices: libraryProjects,
|
|
456
|
-
},
|
|
457
|
-
...MODEL_PROMPTS,
|
|
458
|
-
],
|
|
459
|
-
actions: function (data) {
|
|
460
|
-
const action = {
|
|
461
|
-
type: "createModel",
|
|
462
|
-
};
|
|
463
|
-
return [action];
|
|
464
|
-
},
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
plop.setGenerator("theme", {
|
|
468
|
-
description: "Create a new kos UI Theme project",
|
|
469
|
-
prompts: [
|
|
470
|
-
{
|
|
471
|
-
type: "input",
|
|
472
|
-
name: "name",
|
|
473
|
-
message: "What is the name of the theme project?",
|
|
474
|
-
validate: required,
|
|
475
|
-
},
|
|
476
|
-
],
|
|
477
|
-
actions: function (data) {
|
|
478
|
-
const action = {
|
|
479
|
-
type: "createThemeProject",
|
|
480
|
-
};
|
|
481
|
-
return [action];
|
|
482
|
-
},
|
|
483
|
-
});
|
|
484
|
-
|
|
485
|
-
plop.setGenerator("project", {
|
|
486
|
-
description: "Create a new kos UI App project",
|
|
487
|
-
prompts: [
|
|
488
|
-
{
|
|
489
|
-
type: "input",
|
|
490
|
-
name: "name",
|
|
491
|
-
message: "What is the name of the app project?",
|
|
492
|
-
validate: required,
|
|
493
|
-
},
|
|
494
|
-
],
|
|
495
|
-
actions: function (data) {
|
|
496
|
-
const action = {
|
|
497
|
-
type: "createUiProject",
|
|
498
|
-
};
|
|
499
|
-
return [action];
|
|
500
|
-
},
|
|
501
|
-
});
|
|
502
|
-
|
|
503
|
-
plop.setGenerator("plugin", {
|
|
504
|
-
description: "Create a new kos UI Plugin project",
|
|
505
|
-
prompts: [
|
|
506
|
-
{
|
|
507
|
-
type: "input",
|
|
508
|
-
name: "name",
|
|
509
|
-
message: "What is the name of the plugin project?",
|
|
510
|
-
validate: required,
|
|
511
|
-
},
|
|
512
|
-
],
|
|
513
|
-
actions: function (data) {
|
|
514
|
-
const action = {
|
|
515
|
-
type: "createPluginProject",
|
|
516
|
-
};
|
|
517
|
-
return [action];
|
|
518
|
-
},
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
plop.setGenerator("project:splash", {
|
|
522
|
-
description: "Create a new kos splash page project",
|
|
523
|
-
prompts: [
|
|
524
|
-
{
|
|
525
|
-
type: "input",
|
|
526
|
-
name: "name",
|
|
527
|
-
message: "What is the name of the splash project?",
|
|
528
|
-
validate: required,
|
|
529
|
-
},
|
|
530
|
-
],
|
|
531
|
-
actions: function (data) {
|
|
532
|
-
const action = {
|
|
533
|
-
type: "createSplashProject",
|
|
534
|
-
};
|
|
535
|
-
return [action];
|
|
536
|
-
},
|
|
537
|
-
});
|
|
538
|
-
|
|
539
|
-
plop.setGenerator("i18n", {
|
|
540
|
-
description: "Create a new kos UI i18n project",
|
|
541
|
-
prompts: [
|
|
542
|
-
{
|
|
543
|
-
type: "input",
|
|
544
|
-
name: "name",
|
|
545
|
-
message: "What is the name of the i18n project?",
|
|
546
|
-
validate: required,
|
|
547
|
-
},
|
|
548
|
-
],
|
|
549
|
-
actions: function (data) {
|
|
550
|
-
const action = {
|
|
551
|
-
type: "createI18nProject",
|
|
552
|
-
};
|
|
553
|
-
return [action];
|
|
554
|
-
},
|
|
555
|
-
});
|
|
556
|
-
|
|
557
|
-
plop.setGenerator("i18n:namespace", {
|
|
558
|
-
description: "Create a new kos UI i18n namespace",
|
|
559
|
-
prompts: [
|
|
560
|
-
{
|
|
561
|
-
type: "input",
|
|
562
|
-
name: "name",
|
|
563
|
-
message: "What is the name of the i18n namespace?",
|
|
564
|
-
validate: required,
|
|
565
|
-
},
|
|
566
|
-
{
|
|
567
|
-
type: "input",
|
|
568
|
-
name: "locale",
|
|
569
|
-
message: "What is the locale of the i18n namespace?",
|
|
570
|
-
validate: required,
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
type: "list",
|
|
574
|
-
name: "project",
|
|
575
|
-
message: "Which project should the namespace be created in?",
|
|
576
|
-
choices: getAllProjects,
|
|
577
|
-
},
|
|
578
|
-
],
|
|
579
|
-
actions: function (data) {
|
|
580
|
-
const action = {
|
|
581
|
-
type: "addNamespace",
|
|
582
|
-
};
|
|
583
|
-
return [action];
|
|
584
|
-
},
|
|
585
|
-
});
|
|
26
|
+
if (!isWorkspace) {
|
|
27
|
+
console.warn("[kos-cli] Not inside an Nx workspace. Exiting.");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Register all generators
|
|
32
|
+
await registerKosModel(plop);
|
|
33
|
+
await registerHook(plop);
|
|
34
|
+
await registerCompanion(plop);
|
|
35
|
+
await registerContainer(plop);
|
|
36
|
+
await registerContext(plop);
|
|
37
|
+
|
|
38
|
+
await registerComponent(plop);
|
|
39
|
+
await registerPluginComponent(plop);
|
|
40
|
+
|
|
41
|
+
await registerWorkspace(plop);
|
|
42
|
+
await registerTheme(plop);
|
|
43
|
+
await registerUiProject(plop);
|
|
44
|
+
await registerPluginProject(plop);
|
|
45
|
+
await registerSplashProject(plop);
|
|
46
|
+
await registerI18n(plop);
|
|
47
|
+
await registerI18nNamespace(plop);
|
|
48
|
+
await registerEnv(plop);
|
|
49
|
+
|
|
50
|
+
await registerCacheGenerators(plop);
|
|
586
51
|
}
|