@kosdev-code/kos-ui-cli 2.1.39 → 3.0.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.
@@ -1,10 +1,1212 @@
1
- // generators/component/index.mjs
2
- import { actionFactory } from "../../utils/action-factory.mjs";
3
- import { execute } from "../../utils/exec.mjs";
4
- import { getComponentCompatibleProjectsWithFallback } from "../../utils/nx-context.mjs";
5
- import { required } from "../../utils/validators.mjs";
1
+ // ../kos-codegen-core/src/lib/codegen-filesystem.ts
2
+ import * as fs from "fs";
3
+ import * as path from "path";
4
+ var TrackingFileSystem = class {
5
+ inner;
6
+ _writtenPaths = [];
7
+ constructor(inner) {
8
+ this.inner = inner;
9
+ }
10
+ get root() {
11
+ return this.inner.root;
12
+ }
13
+ get writtenPaths() {
14
+ return [...this._writtenPaths];
15
+ }
16
+ read(filePath) {
17
+ return this.inner.read(filePath);
18
+ }
19
+ write(filePath, content) {
20
+ this.inner.write(filePath, content);
21
+ this._writtenPaths.push(
22
+ path.isAbsolute(filePath) ? filePath : path.join(this.inner.root, filePath)
23
+ );
24
+ }
25
+ exists(filePath) {
26
+ return this.inner.exists(filePath);
27
+ }
28
+ delete(filePath) {
29
+ this.inner.delete(filePath);
30
+ }
31
+ listFiles(dirPath) {
32
+ return this.inner.listFiles(dirPath);
33
+ }
34
+ };
35
+ var DirectFileSystem = class {
36
+ root;
37
+ constructor(workspaceRoot) {
38
+ this.root = path.resolve(workspaceRoot);
39
+ }
40
+ read(filePath) {
41
+ const abs = this.resolve(filePath);
42
+ try {
43
+ return fs.readFileSync(abs, "utf-8");
44
+ } catch {
45
+ return null;
46
+ }
47
+ }
48
+ write(filePath, content) {
49
+ const abs = this.resolve(filePath);
50
+ fs.mkdirSync(path.dirname(abs), { recursive: true });
51
+ fs.writeFileSync(abs, content, "utf-8");
52
+ }
53
+ exists(filePath) {
54
+ return fs.existsSync(this.resolve(filePath));
55
+ }
56
+ delete(filePath) {
57
+ const abs = this.resolve(filePath);
58
+ try {
59
+ fs.unlinkSync(abs);
60
+ } catch {
61
+ }
62
+ }
63
+ listFiles(dirPath) {
64
+ const abs = this.resolve(dirPath);
65
+ if (!fs.existsSync(abs)) {
66
+ return [];
67
+ }
68
+ return this.walkDir(abs).map((file) => path.relative(this.root, file));
69
+ }
70
+ resolve(filePath) {
71
+ if (path.isAbsolute(filePath)) {
72
+ return filePath;
73
+ }
74
+ return path.join(this.root, filePath);
75
+ }
76
+ walkDir(dir) {
77
+ const results = [];
78
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
79
+ for (const entry of entries) {
80
+ const full = path.join(dir, entry.name);
81
+ if (entry.isDirectory()) {
82
+ results.push(...this.walkDir(full));
83
+ } else {
84
+ results.push(full);
85
+ }
86
+ }
87
+ return results;
88
+ }
89
+ };
90
+
91
+ // ../kos-codegen-core/src/lib/generate-files.ts
92
+ import * as fs2 from "fs";
93
+ import * as path2 from "path";
94
+ import * as ejs from "ejs";
95
+
96
+ // ../kos-codegen-core/src/lib/logger.ts
97
+ var noopLogger = {
98
+ debug: () => {
99
+ },
100
+ info: () => {
101
+ },
102
+ warn: () => {
103
+ },
104
+ error: () => {
105
+ }
106
+ };
107
+ var activeLogger = noopLogger;
108
+ function getCodegenLogger() {
109
+ return activeLogger;
110
+ }
111
+
112
+ // ../kos-codegen-core/src/lib/generate-files.ts
113
+ function generateFilesFromTemplates(codegenFs, srcFolder, destFolder, substitutions) {
114
+ const logger = getCodegenLogger();
115
+ const templateFiles = walkTemplateDir(srcFolder);
116
+ for (const templateFile of templateFiles) {
117
+ const relPath = path2.relative(srcFolder, templateFile);
118
+ let destRelPath = interpolateFilename(relPath, substitutions);
119
+ if (destRelPath.endsWith(".template")) {
120
+ destRelPath = destRelPath.slice(0, -".template".length);
121
+ }
122
+ const destPath = path2.join(destFolder, destRelPath);
123
+ const rawContent = fs2.readFileSync(templateFile, "utf-8");
124
+ const rendered = ejs.render(rawContent, substitutions, {
125
+ filename: templateFile
126
+ // for EJS error messages and includes
127
+ });
128
+ logger.debug(`Generating ${destPath}`);
129
+ codegenFs.write(destPath, rendered);
130
+ }
131
+ }
132
+ function interpolateFilename(filePath, substitutions) {
133
+ return filePath.replace(/__([^_]+)__/g, (match, key) => {
134
+ if (key in substitutions) {
135
+ return String(substitutions[key]);
136
+ }
137
+ return match;
138
+ });
139
+ }
140
+ function walkTemplateDir(dir) {
141
+ const results = [];
142
+ const entries = fs2.readdirSync(dir, { withFileTypes: true });
143
+ for (const entry of entries) {
144
+ const full = path2.join(dir, entry.name);
145
+ if (entry.isDirectory()) {
146
+ results.push(...walkTemplateDir(full));
147
+ } else {
148
+ results.push(full);
149
+ }
150
+ }
151
+ return results;
152
+ }
153
+
154
+ // ../kos-codegen-core/src/lib/project-discovery.ts
155
+ import * as fs3 from "fs";
156
+ import * as path3 from "path";
157
+ import fg from "fast-glob";
158
+ function discoverProjects(workspaceRoot) {
159
+ const logger = getCodegenLogger();
160
+ const projects = /* @__PURE__ */ new Map();
161
+ const projectJsonPaths = fg.sync("**/project.json", {
162
+ cwd: workspaceRoot,
163
+ ignore: ["**/node_modules/**", "**/dist/**", "**/.git/**"],
164
+ absolute: false
165
+ });
166
+ for (const relPath of projectJsonPaths) {
167
+ const absPath = path3.join(workspaceRoot, relPath);
168
+ try {
169
+ const raw = fs3.readFileSync(absPath, "utf-8");
170
+ const json = JSON.parse(raw);
171
+ const projectRoot = path3.dirname(relPath);
172
+ const name = json.name ?? path3.basename(projectRoot);
173
+ const config = {
174
+ name,
175
+ root: projectRoot,
176
+ sourceRoot: json.sourceRoot ?? path3.join(projectRoot, "src"),
177
+ projectType: json.projectType,
178
+ targets: json.targets,
179
+ tags: json.tags
180
+ };
181
+ projects.set(name, config);
182
+ logger.debug(`Discovered project: ${name} at ${projectRoot}`);
183
+ } catch (err) {
184
+ logger.warn(`Failed to parse ${absPath}: ${err}`);
185
+ }
186
+ }
187
+ logger.info(`Discovered ${projects.size} projects`);
188
+ return projects;
189
+ }
190
+ function findProjectByName(workspaceRoot, projectName, projects) {
191
+ const map = projects ?? discoverProjects(workspaceRoot);
192
+ return map.get(projectName);
193
+ }
194
+
195
+ // ../kos-codegen-core/src/lib/json-utils.ts
196
+ function readJson(codegenFs, filePath) {
197
+ const content = codegenFs.read(filePath);
198
+ if (content === null) {
199
+ throw new Error(`File not found: ${filePath}`);
200
+ }
201
+ return JSON.parse(content);
202
+ }
203
+ function writeJson(codegenFs, filePath, value) {
204
+ codegenFs.write(filePath, JSON.stringify(value, null, 2) + "\n");
205
+ }
206
+ function updateJson(codegenFs, filePath, updater) {
207
+ const current = readJson(codegenFs, filePath);
208
+ const updated = updater(current);
209
+ writeJson(codegenFs, filePath, updated);
210
+ }
211
+
212
+ // ../kos-codegen-core/src/lib/format-files.ts
213
+ import * as fs4 from "fs";
214
+ import * as path4 from "path";
215
+ import prettier from "prettier";
216
+ var FORMATTABLE_EXTENSIONS = /* @__PURE__ */ new Set([
217
+ ".ts",
218
+ ".tsx",
219
+ ".js",
220
+ ".jsx",
221
+ ".json",
222
+ ".css",
223
+ ".scss",
224
+ ".md",
225
+ ".yaml",
226
+ ".yml",
227
+ ".html"
228
+ ]);
229
+ async function formatFiles(workspaceRoot, filePaths) {
230
+ const logger = getCodegenLogger();
231
+ for (const filePath of filePaths) {
232
+ const ext = path4.extname(filePath);
233
+ if (!FORMATTABLE_EXTENSIONS.has(ext)) {
234
+ continue;
235
+ }
236
+ try {
237
+ const content = fs4.readFileSync(filePath, "utf-8");
238
+ const options = await prettier.resolveConfig(filePath, {
239
+ editorconfig: true
240
+ });
241
+ const formatted = await prettier.format(content, {
242
+ ...options,
243
+ filepath: filePath
244
+ });
245
+ fs4.writeFileSync(filePath, formatted, "utf-8");
246
+ logger.debug(`Formatted ${path4.relative(workspaceRoot, filePath)}`);
247
+ } catch (err) {
248
+ logger.warn(`Failed to format ${filePath}: ${err}`);
249
+ }
250
+ }
251
+ }
252
+
253
+ // ../kos-codegen-core/src/lib/name-utils.ts
254
+ function dashCase(input) {
255
+ return input.replace(/\s+/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
256
+ }
257
+ function camelCase(input) {
258
+ if (input.length === 0)
259
+ return "";
260
+ const words = input.split(/-|\s+/);
261
+ if (words.length > 0 && words[0].length > 0) {
262
+ words[0] = words[0].charAt(0).toLowerCase() + words[0].slice(1);
263
+ }
264
+ for (let i = 1; i < words.length; i++) {
265
+ words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1);
266
+ }
267
+ return words.join("");
268
+ }
269
+ function pascalCase(input) {
270
+ if (input.length === 0)
271
+ return "";
272
+ const cc = camelCase(input);
273
+ return cc[0].toUpperCase() + cc.slice(1);
274
+ }
275
+ function properCase(input) {
276
+ const words = input.toLowerCase().replaceAll("-", " ").split(" ").filter(Boolean);
277
+ for (let i = 0; i < words.length; i++) {
278
+ words[i] = words[i][0].toUpperCase() + words[i].slice(1);
279
+ }
280
+ return words.join("");
281
+ }
282
+ function constantCase(input) {
283
+ if (input.length === 0)
284
+ return "";
285
+ return input.toUpperCase().split(/[\s-]+/).filter(Boolean).join("_");
286
+ }
287
+
288
+ // ../kos-codegen-core/src/lib/normalize-values.ts
289
+ var normalizeValue = (optionsName, value) => ({
290
+ [`${camelCase(optionsName)}CamelCase`]: camelCase(value),
291
+ [`${camelCase(optionsName)}ConstantCase`]: constantCase(value),
292
+ [`${camelCase(optionsName)}DashCase`]: dashCase(value),
293
+ [`${camelCase(optionsName)}PascalCase`]: pascalCase(value),
294
+ [`${camelCase(optionsName)}ProperCase`]: properCase(value),
295
+ [`${camelCase(optionsName)}LowerCase`]: value.toLowerCase(),
296
+ [`${optionsName}`]: value
297
+ });
298
+ var normalizeAllValues = (options) => {
299
+ let normalizedValues = {};
300
+ for (const key in options) {
301
+ if (Object.prototype.hasOwnProperty.call(options, key)) {
302
+ const element = options[key];
303
+ const newOptions = typeof element !== "string" || element === "" ? { [key]: element } : normalizeValue(key, element);
304
+ normalizedValues = {
305
+ ...normalizedValues,
306
+ ...newOptions
307
+ };
308
+ }
309
+ }
310
+ return normalizedValues;
311
+ };
312
+
313
+ // ../kos-codegen-core/src/lib/kos-config.ts
314
+ import * as path5 from "path";
315
+ function getKosProjectConfiguration(codegenFs, projectName, projects) {
316
+ const project = findProjectByName(codegenFs.root, projectName, projects);
317
+ if (!project)
318
+ return void 0;
319
+ const configPath = path5.join(project.root, ".kos.json");
320
+ if (!codegenFs.exists(configPath)) {
321
+ const defaultConfig = {
322
+ name: `${dashCase(projectName)}-model`,
323
+ type: "kos.model",
324
+ version: "0.1.0",
325
+ models: {},
326
+ generator: { defaults: { model: { folder: "" } } }
327
+ };
328
+ codegenFs.write(configPath, JSON.stringify(defaultConfig, null, 2));
329
+ }
330
+ const content = codegenFs.read(configPath);
331
+ return content ? JSON.parse(content) : void 0;
332
+ }
333
+
334
+ // ../kos-codegen-core/src/lib/template-resolver.ts
335
+ import * as path6 from "path";
336
+ import * as fs5 from "fs";
337
+ function findPackageRoot() {
338
+ if (process.env.KOS_TEMPLATE_BASE_DIR) {
339
+ return process.env.KOS_TEMPLATE_BASE_DIR;
340
+ }
341
+ let dir = __dirname;
342
+ while (dir !== path6.dirname(dir)) {
343
+ const pkgPath = path6.join(dir, "package.json");
344
+ if (fs5.existsSync(pkgPath)) {
345
+ try {
346
+ const pkg = JSON.parse(fs5.readFileSync(pkgPath, "utf-8"));
347
+ if (pkg.name === "@kosdev-code/kos-codegen-core") {
348
+ return dir;
349
+ }
350
+ } catch {
351
+ }
352
+ }
353
+ dir = path6.dirname(dir);
354
+ }
355
+ return path6.resolve(__dirname, "..", "..");
356
+ }
357
+ function getTemplateDir(generatorName) {
358
+ return path6.join(findPackageRoot(), "templates", generatorName);
359
+ }
360
+
361
+ // ../kos-codegen-core/src/lib/generators/normalize-options.ts
362
+ import * as path7 from "path";
363
+ function normalizeOptions(codegenFs, options, projects) {
364
+ const toNormalize = {
365
+ name: options.name
366
+ };
367
+ if (options.modelName) {
368
+ toNormalize.modelName = options.modelName;
369
+ }
370
+ if (options.companionModel) {
371
+ toNormalize.companionModel = options.companionModel;
372
+ }
373
+ const normalizedValues = normalizeAllValues(toNormalize);
374
+ const modelProject = options.modelProject;
375
+ const registrationProject = options.registrationProject || "";
376
+ const useModelProject = modelProject !== "__NONE__";
377
+ let importPath = "";
378
+ if (useModelProject) {
379
+ const modelProjectConfig = findProjectByName(
380
+ codegenFs.root,
381
+ modelProject,
382
+ projects
383
+ );
384
+ if (modelProjectConfig) {
385
+ const pkgJsonPath = path7.join(modelProjectConfig.root, "package.json");
386
+ try {
387
+ const pkgJson = readJson(codegenFs, pkgJsonPath);
388
+ importPath = pkgJson.name || "";
389
+ } catch {
390
+ importPath = "";
391
+ }
392
+ }
393
+ }
394
+ const booleanDefaults = {
395
+ companion: false,
396
+ skipRegistration: false
397
+ };
398
+ return {
399
+ ...booleanDefaults,
400
+ ...options,
401
+ ...normalizedValues,
402
+ modelProject,
403
+ importPath,
404
+ registrationProject,
405
+ template: ""
406
+ };
407
+ }
408
+
409
+ // ../kos-codegen-core/src/lib/generators/update-model-index.ts
410
+ import * as ts from "typescript";
411
+
412
+ // ../kos-codegen-core/src/lib/generators/component/generate-component.ts
413
+ import * as path10 from "path";
414
+
415
+ // ../kos-codegen-core/src/lib/generators/component/types.ts
416
+ var PLUGIN_TYPES = {
417
+ CUI: "cui",
418
+ UTILITY: "utility",
419
+ TROUBLE_ACTION: "troubleAction",
420
+ SETUP: "setup",
421
+ SETTING: "setting",
422
+ NAV: "nav",
423
+ CONTROL_POUR: "controlPour",
424
+ CUSTOM: "custom"
425
+ };
426
+ var CONTRIBUTION_TYPE_MAP = {
427
+ [PLUGIN_TYPES.SETUP]: "setup",
428
+ [PLUGIN_TYPES.CUI]: "cui",
429
+ [PLUGIN_TYPES.UTILITY]: "utility",
430
+ [PLUGIN_TYPES.SETTING]: "setting",
431
+ [PLUGIN_TYPES.NAV]: "nav",
432
+ [PLUGIN_TYPES.TROUBLE_ACTION]: "trouble-action",
433
+ [PLUGIN_TYPES.CONTROL_POUR]: "control-pour",
434
+ [PLUGIN_TYPES.CUSTOM]: "custom"
435
+ };
436
+ var LOCALIZED_PLUGIN_TYPES = /* @__PURE__ */ new Set([
437
+ PLUGIN_TYPES.CUI,
438
+ PLUGIN_TYPES.UTILITY,
439
+ PLUGIN_TYPES.SETUP,
440
+ PLUGIN_TYPES.SETTING,
441
+ PLUGIN_TYPES.NAV,
442
+ PLUGIN_TYPES.CONTROL_POUR,
443
+ PLUGIN_TYPES.TROUBLE_ACTION,
444
+ PLUGIN_TYPES.CUSTOM
445
+ ]);
446
+
447
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/base.ts
448
+ var BasePluginHandler = class {
449
+ getContributionKey() {
450
+ return this.contributionKey;
451
+ }
452
+ requiresLocalization() {
453
+ return this.requiresI18n;
454
+ }
455
+ getTemplatePath() {
456
+ return this.contributionKey;
457
+ }
458
+ /**
459
+ * Helper to create experience configuration
460
+ */
461
+ createExperience(options, experienceId) {
462
+ const compPath = this.getComponentPath(options);
463
+ return {
464
+ id: experienceId,
465
+ component: options.namePascalCase,
466
+ location: `./src/${compPath}`
467
+ };
468
+ }
469
+ /**
470
+ * Helper to get component path
471
+ */
472
+ getComponentPath(options) {
473
+ return `${options.appDirectory}/${this.contributionKey}/${options.nameDashCase}/${options.nameDashCase}.tsx`;
474
+ }
475
+ /**
476
+ * Helper to create config prefix
477
+ */
478
+ getConfigPrefix(options) {
479
+ return `${options.appProject}.${options.nameCamelCase}`;
480
+ }
481
+ };
482
+
483
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/control-pour-handler.ts
484
+ var ControlPourPluginHandler = class extends BasePluginHandler {
485
+ pluginType = PLUGIN_TYPES.CONTROL_POUR;
486
+ contributionKey = "control-pour";
487
+ requiresI18n = true;
488
+ createConfiguration(options) {
489
+ const configPrefix = this.getConfigPrefix(options);
490
+ const experienceId = `${configPrefix}.controlPour.experience`;
491
+ const contribution = {
492
+ id: `${configPrefix}.controlPour`,
493
+ title: `${configPrefix}.controlPour.title`,
494
+ namespace: options.appProject,
495
+ experienceId
496
+ };
497
+ const experience = this.createExperience(options, experienceId);
498
+ return {
499
+ contributions: {
500
+ controlPour: [contribution]
501
+ },
502
+ experiences: {
503
+ [experienceId]: experience
504
+ }
505
+ };
506
+ }
507
+ };
508
+
509
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/cui-handler.ts
510
+ var CuiPluginHandler = class extends BasePluginHandler {
511
+ pluginType = PLUGIN_TYPES.CUI;
512
+ contributionKey = "cui";
513
+ requiresI18n = true;
514
+ createConfiguration(options) {
515
+ const configPrefix = this.getConfigPrefix(options);
516
+ const experienceId = `${configPrefix}.cui.experience`;
517
+ const contribution = {
518
+ id: configPrefix,
519
+ title: `${configPrefix}.cui.title`,
520
+ namespace: options.appProject,
521
+ experienceId
522
+ };
523
+ const experience = this.createExperience(options, experienceId);
524
+ return {
525
+ contributions: {
526
+ cui: [contribution]
527
+ },
528
+ experiences: {
529
+ [experienceId]: experience
530
+ }
531
+ };
532
+ }
533
+ };
534
+
535
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/custom-handler.ts
536
+ var CustomPluginHandler = class extends BasePluginHandler {
537
+ pluginType = PLUGIN_TYPES.CUSTOM;
538
+ contributionKey = "custom";
539
+ requiresI18n = true;
540
+ createConfiguration(options) {
541
+ const configPrefix = this.getConfigPrefix(options);
542
+ const experienceId = `${configPrefix}.${options.contributionKey || "custom"}.experience`;
543
+ const userContributionKey = options.contributionKey || "custom";
544
+ const contribution = {
545
+ id: configPrefix,
546
+ title: `${configPrefix}.${userContributionKey}.title`,
547
+ namespace: options.appProject,
548
+ experienceId
549
+ // TODO: Add additional fields as required by the plugin-explorer specification
550
+ // Refer to the plugin-explorer documentation for your specific contribution type
551
+ };
552
+ const experience = this.createExperience(options, experienceId);
553
+ return {
554
+ contributions: {
555
+ [userContributionKey]: [contribution]
556
+ },
557
+ experiences: {
558
+ [experienceId]: experience
559
+ }
560
+ };
561
+ }
562
+ getTemplatePath() {
563
+ return this.contributionKey || "custom";
564
+ }
565
+ getComponentPath(options) {
566
+ const pathKey = options.contributionKey || "custom";
567
+ return `${options.appDirectory}/${pathKey}/${options.nameDashCase}/${options.nameDashCase}.tsx`;
568
+ }
569
+ };
570
+
571
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/default-handler.ts
572
+ var DefaultComponentHandler = class extends BasePluginHandler {
573
+ pluginType = "component";
574
+ contributionKey = "components";
575
+ requiresI18n = false;
576
+ createConfiguration(options) {
577
+ const compPath = this.getComponentPath(options);
578
+ const viewConfig = {
579
+ id: `${options.appProject}.${options.nameCamelCase}`,
580
+ title: "ddk.ncui.config.title",
581
+ namespace: options.appProject,
582
+ component: options.namePascalCase,
583
+ location: `./src/${compPath}`
584
+ };
585
+ return {
586
+ contributions: {},
587
+ experiences: {},
588
+ views: {
589
+ [this.getTabViewKey()]: [viewConfig]
590
+ }
591
+ };
592
+ }
593
+ getTabViewKey() {
594
+ return "ddk.ncui.settings.tabView";
595
+ }
596
+ getTemplatePath() {
597
+ return "files";
598
+ }
599
+ };
600
+
601
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/nav-handler.ts
602
+ var NavPluginHandler = class extends BasePluginHandler {
603
+ pluginType = PLUGIN_TYPES.NAV;
604
+ contributionKey = "nav";
605
+ requiresI18n = true;
606
+ createConfiguration(options) {
607
+ const configPrefix = this.getConfigPrefix(options);
608
+ const experienceId = `${configPrefix}.nav.experience`;
609
+ const contribution = {
610
+ id: `${configPrefix}.nav`,
611
+ title: `${configPrefix}.nav.title`,
612
+ namespace: options.appProject,
613
+ navDescriptor: options.nameLowerCase,
614
+ experienceId
615
+ };
616
+ const experience = this.createExperience(options, experienceId);
617
+ return {
618
+ contributions: {
619
+ navViews: [contribution]
620
+ },
621
+ experiences: {
622
+ [experienceId]: experience
623
+ }
624
+ };
625
+ }
626
+ };
627
+
628
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/setting-handler.ts
629
+ var SettingPluginHandler = class extends BasePluginHandler {
630
+ pluginType = PLUGIN_TYPES.SETTING;
631
+ contributionKey = "setting";
632
+ requiresI18n = true;
633
+ createConfiguration(options) {
634
+ const configPrefix = this.getConfigPrefix(options);
635
+ const experienceId = `${configPrefix}.settings.experience`;
636
+ const contribution = {
637
+ id: `${configPrefix}.setting`,
638
+ title: `${configPrefix}.setting.title`,
639
+ namespace: options.appProject,
640
+ settingsGroup: options.group || "general",
641
+ experienceId
642
+ };
643
+ const experience = this.createExperience(options, experienceId);
644
+ return {
645
+ contributions: {
646
+ settings: [contribution]
647
+ },
648
+ experiences: {
649
+ [experienceId]: experience
650
+ }
651
+ };
652
+ }
653
+ };
654
+
655
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/setup-handler.ts
656
+ var SetupPluginHandler = class extends BasePluginHandler {
657
+ pluginType = PLUGIN_TYPES.SETUP;
658
+ contributionKey = "setup";
659
+ requiresI18n = true;
660
+ createConfiguration(options) {
661
+ const configPrefix = this.getConfigPrefix(options);
662
+ const experienceId = `${configPrefix}.setup.experience`;
663
+ const contribution = {
664
+ id: `${configPrefix}.setup`,
665
+ title: `${configPrefix}.setup.title`,
666
+ namespace: options.appProject,
667
+ setupDescriptor: options.nameCamelCase,
668
+ experienceId
669
+ };
670
+ const experience = this.createExperience(options, experienceId);
671
+ return {
672
+ contributions: {
673
+ setupStep: [contribution]
674
+ },
675
+ experiences: {
676
+ [experienceId]: experience
677
+ }
678
+ };
679
+ }
680
+ };
681
+
682
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/trouble-action-handler.ts
683
+ var TroubleActionPluginHandler = class extends BasePluginHandler {
684
+ pluginType = PLUGIN_TYPES.TROUBLE_ACTION;
685
+ contributionKey = "trouble-action";
686
+ requiresI18n = true;
687
+ createConfiguration(options) {
688
+ const configPrefix = this.getConfigPrefix(options);
689
+ const experienceId = `${configPrefix}.troubleAction.experience`;
690
+ const contribution = {
691
+ id: `${configPrefix}.troubleAction`,
692
+ title: `${configPrefix}.troubleAction.title`,
693
+ namespace: options.appProject,
694
+ troubleType: options.nameCamelCase,
695
+ experienceId
696
+ };
697
+ const experience = this.createExperience(options, experienceId);
698
+ return {
699
+ contributions: {
700
+ troubleActions: [contribution]
701
+ },
702
+ experiences: {
703
+ [experienceId]: experience
704
+ }
705
+ };
706
+ }
707
+ };
708
+
709
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/utility-handler.ts
710
+ var UtilityPluginHandler = class extends BasePluginHandler {
711
+ pluginType = PLUGIN_TYPES.UTILITY;
712
+ contributionKey = "utility";
713
+ requiresI18n = true;
714
+ createConfiguration(options) {
715
+ const configPrefix = this.getConfigPrefix(options);
716
+ const experienceId = `${configPrefix}.util.experience`;
717
+ const contribution = {
718
+ id: `${configPrefix}.util`,
719
+ title: `${configPrefix}.utility.title`,
720
+ namespace: options.appProject,
721
+ utilDescriptor: options.nameCamelCase,
722
+ experienceId
723
+ };
724
+ const experience = this.createExperience(options, experienceId);
725
+ return {
726
+ contributions: {
727
+ utilities: [contribution]
728
+ },
729
+ experiences: {
730
+ [experienceId]: experience
731
+ }
732
+ };
733
+ }
734
+ };
735
+
736
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/factory.ts
737
+ var PluginHandlerFactory = class {
738
+ static handlers = /* @__PURE__ */ new Map([
739
+ [PLUGIN_TYPES.CUI, CuiPluginHandler],
740
+ [PLUGIN_TYPES.UTILITY, UtilityPluginHandler],
741
+ [PLUGIN_TYPES.SETTING, SettingPluginHandler],
742
+ [PLUGIN_TYPES.SETUP, SetupPluginHandler],
743
+ [PLUGIN_TYPES.NAV, NavPluginHandler],
744
+ [PLUGIN_TYPES.CONTROL_POUR, ControlPourPluginHandler],
745
+ [PLUGIN_TYPES.TROUBLE_ACTION, TroubleActionPluginHandler],
746
+ [PLUGIN_TYPES.CUSTOM, CustomPluginHandler]
747
+ ]);
748
+ static createHandler(pluginType) {
749
+ if (!pluginType) {
750
+ return new DefaultComponentHandler();
751
+ }
752
+ const HandlerClass = this.handlers.get(pluginType);
753
+ if (!HandlerClass) {
754
+ console.warn(
755
+ `No handler found for plugin type: ${pluginType}. Using default handler.`
756
+ );
757
+ return new DefaultComponentHandler();
758
+ }
759
+ return new HandlerClass();
760
+ }
761
+ static isValidPluginType(type) {
762
+ return this.handlers.has(type);
763
+ }
764
+ };
6
765
 
7
- export const metadata = {
766
+ // ../kos-codegen-core/src/lib/generators/component/utils/file-generator.ts
767
+ import * as path8 from "path";
768
+ function generateComponentFiles(codegenFs, templateBaseDir, templateSubPath, targetPath, options) {
769
+ generateFilesFromTemplates(
770
+ codegenFs,
771
+ path8.join(templateBaseDir, templateSubPath),
772
+ targetPath,
773
+ options
774
+ );
775
+ if (options.useEmotionCss) {
776
+ deleteCssFile(codegenFs, targetPath, options);
777
+ }
778
+ }
779
+ function deleteCssFile(codegenFs, targetPath, options) {
780
+ const cssPath = path8.join(targetPath, `${options.nameDashCase}.css`);
781
+ if (codegenFs.exists(cssPath)) {
782
+ codegenFs.delete(cssPath);
783
+ }
784
+ }
785
+
786
+ // ../kos-codegen-core/src/lib/generators/component/utils/kos-config-builder.ts
787
+ var KosConfigBuilder = class _KosConfigBuilder {
788
+ contributions = {};
789
+ experiences = {};
790
+ views = {};
791
+ /**
792
+ * Adds plugin configuration to the builder
793
+ */
794
+ addPluginConfiguration(config) {
795
+ Object.entries(config.contributions).forEach(([key, value]) => {
796
+ this.contributions[key] = [...this.contributions[key] || [], ...value];
797
+ });
798
+ Object.assign(this.experiences, config.experiences);
799
+ if (config.views) {
800
+ Object.entries(config.views).forEach(([key, value]) => {
801
+ this.views[key] = [...this.views[key] || [], ...value];
802
+ });
803
+ }
804
+ return this;
805
+ }
806
+ /**
807
+ * Applies the built configuration to the .kos.json file
808
+ */
809
+ applyToFile(codegenFs, kosConfigPath) {
810
+ updateJson(codegenFs, kosConfigPath, (json) => {
811
+ const structure = this.initializeStructure(json);
812
+ Object.entries(this.contributions).forEach(([key, value]) => {
813
+ structure.contributes[key] = [
814
+ ...structure.contributes[key] || [],
815
+ ...value
816
+ ];
817
+ });
818
+ structure.contributes.experiences = {
819
+ ...structure.contributes.experiences,
820
+ ...this.experiences
821
+ };
822
+ if (Object.keys(this.views).length > 0) {
823
+ structure.contributes.views = structure.contributes.views || {};
824
+ Object.entries(this.views).forEach(([key, value]) => {
825
+ structure.contributes.views[key] = [
826
+ ...structure.contributes.views[key] || [],
827
+ ...value
828
+ ];
829
+ });
830
+ }
831
+ return json;
832
+ });
833
+ }
834
+ /**
835
+ * Initializes the deep JSON structure
836
+ */
837
+ initializeStructure(json) {
838
+ json.kos ??= {};
839
+ json.kos.ui ??= {};
840
+ json.kos.ui.plugin ??= {};
841
+ json.kos.ui.plugin.contributes ??= {};
842
+ return json.kos.ui.plugin;
843
+ }
844
+ /**
845
+ * Creates a new builder instance
846
+ */
847
+ static create() {
848
+ return new _KosConfigBuilder();
849
+ }
850
+ };
851
+
852
+ // ../kos-codegen-core/src/lib/generators/component/utils/localization.ts
853
+ import * as path9 from "path";
854
+ function updateLocalization(codegenFs, projectRoot, options, pluginType) {
855
+ const localePath = path9.join(
856
+ projectRoot,
857
+ "assets",
858
+ "locales",
859
+ "en",
860
+ `${options.appProject}.json`
861
+ );
862
+ if (!codegenFs.exists(localePath)) {
863
+ console.warn(`Locale file not found: ${localePath}`);
864
+ return;
865
+ }
866
+ updateJson(codegenFs, localePath, (json) => {
867
+ json[options.appProject] = json[options.appProject] || {};
868
+ json[options.appProject][options.nameCamelCase] = json[options.appProject][options.nameCamelCase] || {};
869
+ json[options.appProject][options.nameCamelCase][pluginType] = {
870
+ ...json[options.appProject][options.nameCamelCase][pluginType],
871
+ title: options.nameCamelCase
872
+ };
873
+ return json;
874
+ });
875
+ }
876
+
877
+ // ../kos-codegen-core/src/lib/generators/component/utils/validation.ts
878
+ var ValidationError = class extends Error {
879
+ constructor(message) {
880
+ super(message);
881
+ this.name = "ValidationError";
882
+ }
883
+ };
884
+ function validateOptions(codegenFs, options, projects) {
885
+ if (!options.name) {
886
+ throw new ValidationError("Component name is required");
887
+ }
888
+ if (!options.appProject) {
889
+ throw new ValidationError("App project is required");
890
+ }
891
+ const project = findProjectByName(codegenFs.root, options.appProject, projects);
892
+ if (!project) {
893
+ throw new ValidationError(
894
+ `Project "${options.appProject}" not found in workspace`
895
+ );
896
+ }
897
+ if (options.pluginType && !PluginHandlerFactory.isValidPluginType(options.pluginType)) {
898
+ console.warn(
899
+ `Unknown plugin type "${options.pluginType}". Component will be generated with default configuration.`
900
+ );
901
+ }
902
+ if (options.pluginType === "setting" && !options.group) {
903
+ throw new ValidationError(
904
+ "Settings group is required for setting plugin type"
905
+ );
906
+ }
907
+ }
908
+
909
+ // ../kos-codegen-core/src/lib/generators/component/generate-component.ts
910
+ function generateComponent(codegenFs, templateDir, options, projects) {
911
+ validateOptions(codegenFs, options, projects);
912
+ const normalized = prepareOptions(codegenFs, options, projects);
913
+ const projectConfig = findProjectByName(
914
+ codegenFs.root,
915
+ normalized.appProject,
916
+ projects
917
+ );
918
+ if (!projectConfig) {
919
+ throw new Error(
920
+ `Project "${normalized.appProject}" not found in workspace`
921
+ );
922
+ }
923
+ const projectRoot = projectConfig.sourceRoot;
924
+ if (!projectRoot) {
925
+ throw new Error(
926
+ `No source root found for project ${normalized.appProject}`
927
+ );
928
+ }
929
+ generateFiles(codegenFs, templateDir, projectRoot, normalized);
930
+ if (options.pluginType) {
931
+ updatePluginConfiguration(codegenFs, projectConfig, normalized);
932
+ }
933
+ }
934
+ function prepareOptions(codegenFs, options, projects) {
935
+ const normalized = normalizeOptions(
936
+ codegenFs,
937
+ {
938
+ ...options,
939
+ modelProject: "__NONE__"
940
+ },
941
+ projects
942
+ );
943
+ const kosConfig = getKosProjectConfiguration(
944
+ codegenFs,
945
+ options.appProject,
946
+ projects
947
+ );
948
+ const componentLocation = kosConfig?.generator?.defaults?.component?.folder || "";
949
+ normalized.appDirectory = options.appDirectory || componentLocation;
950
+ normalized.type = CONTRIBUTION_TYPE_MAP[options.pluginType || ""] || options.type;
951
+ if (options.contributionKey) {
952
+ normalized.contributionKey = options.contributionKey;
953
+ }
954
+ return normalized;
955
+ }
956
+ function generateFiles(codegenFs, templateDir, projectRoot, options) {
957
+ const handler = PluginHandlerFactory.createHandler(options.pluginType);
958
+ const templatePath = handler.getTemplatePath();
959
+ const targetPath = path10.join(
960
+ projectRoot,
961
+ options.appDirectory,
962
+ options.type,
963
+ options.nameDashCase
964
+ );
965
+ generateComponentFiles(
966
+ codegenFs,
967
+ templateDir,
968
+ templatePath,
969
+ targetPath,
970
+ options
971
+ );
972
+ }
973
+ function updatePluginConfiguration(codegenFs, projectConfig, options) {
974
+ const kosConfigPath = path10.join(projectConfig.root, ".kos.json");
975
+ if (!codegenFs.exists(kosConfigPath)) {
976
+ console.warn(`No .kos.json found at ${kosConfigPath}`);
977
+ return;
978
+ }
979
+ const handler = PluginHandlerFactory.createHandler(options.pluginType);
980
+ const pluginConfig = handler.createConfiguration(options);
981
+ const builder = KosConfigBuilder.create();
982
+ builder.addPluginConfiguration(pluginConfig);
983
+ builder.applyToFile(codegenFs, kosConfigPath);
984
+ if (handler.requiresLocalization() && projectConfig.sourceRoot) {
985
+ updateLocalization(
986
+ codegenFs,
987
+ projectConfig.sourceRoot,
988
+ options,
989
+ handler.getContributionKey()
990
+ );
991
+ }
992
+ }
993
+
994
+ // src/lib/utils/action-factory.mjs
995
+ var actionFactory = (action, metadata2) => {
996
+ return () => {
997
+ const _actions = [{ type: action }];
998
+ if (metadata2.invalidateCache) {
999
+ _actions.push({ type: "clearCache" });
1000
+ }
1001
+ return _actions;
1002
+ };
1003
+ };
1004
+
1005
+ // src/lib/utils/nx-context.mjs
1006
+ import { existsSync as existsSync4, readFileSync as readFileSync6, readdirSync as readdirSync3, statSync } from "fs";
1007
+ import path12 from "path";
1008
+ import { fileURLToPath } from "url";
1009
+
1010
+ // src/lib/utils/cache.mjs
1011
+ import fs6 from "fs";
1012
+ import path11 from "path";
1013
+ var CACHE_PATH = path11.resolve(".nx/cli-cache.json");
1014
+ var CACHE_TTL = 600 * 1e3;
1015
+ var ARGS = process.argv;
1016
+ var DISABLE_CACHE = process.env.DISABLE_CACHE === "true" || process.env.REFRESH === "true";
1017
+ var _cache = {};
1018
+ var _loaded = false;
1019
+ function ensureCacheDir() {
1020
+ const dir = path11.dirname(CACHE_PATH);
1021
+ if (!fs6.existsSync(dir))
1022
+ fs6.mkdirSync(dir, { recursive: true });
1023
+ }
1024
+ function loadCacheFromDisk() {
1025
+ if (_loaded)
1026
+ return;
1027
+ _loaded = true;
1028
+ try {
1029
+ if (fs6.existsSync(CACHE_PATH)) {
1030
+ const data = fs6.readFileSync(CACHE_PATH, "utf-8");
1031
+ _cache = JSON.parse(data);
1032
+ }
1033
+ } catch (err) {
1034
+ console.warn("Failed to load CLI cache:", err);
1035
+ _cache = {};
1036
+ }
1037
+ }
1038
+ function saveCacheToDisk() {
1039
+ try {
1040
+ ensureCacheDir();
1041
+ fs6.writeFileSync(CACHE_PATH, JSON.stringify(_cache, null, 2));
1042
+ } catch (err) {
1043
+ console.warn("Failed to save CLI cache:", err);
1044
+ }
1045
+ }
1046
+ function isFresh(entry, ttl = CACHE_TTL) {
1047
+ if (!entry || !entry.timestamp)
1048
+ return false;
1049
+ return Date.now() - entry.timestamp < ttl;
1050
+ }
1051
+ function getCached(key, ttl = CACHE_TTL) {
1052
+ if (DISABLE_CACHE)
1053
+ return null;
1054
+ loadCacheFromDisk();
1055
+ const entry = _cache[key];
1056
+ if (isFresh(entry, ttl))
1057
+ return entry.data;
1058
+ return null;
1059
+ }
1060
+ function setCached(key, data) {
1061
+ loadCacheFromDisk();
1062
+ _cache[key] = {
1063
+ data,
1064
+ timestamp: Date.now()
1065
+ };
1066
+ saveCacheToDisk();
1067
+ }
1068
+
1069
+ // src/lib/utils/nx-context.mjs
1070
+ var __dirname2 = path12.dirname(fileURLToPath(import.meta.url));
1071
+ function findKosJsonFiles(dir = process.cwd(), files = []) {
1072
+ try {
1073
+ const entries = readdirSync3(dir);
1074
+ for (const entry of entries) {
1075
+ if (entry === "node_modules" || entry === ".git" || entry === ".nx" || entry === "dist" || entry === "coverage" || entry === ".vscode" || entry === ".idea" || entry.startsWith(".") && entry !== ".kos.json") {
1076
+ continue;
1077
+ }
1078
+ const fullPath = path12.join(dir, entry);
1079
+ try {
1080
+ const stat = statSync(fullPath);
1081
+ if (stat.isFile() && entry === ".kos.json") {
1082
+ files.push(fullPath);
1083
+ } else if (stat.isDirectory()) {
1084
+ if (entry !== "tmp" && entry !== "temp" && entry !== "build") {
1085
+ findKosJsonFiles(fullPath, files);
1086
+ }
1087
+ }
1088
+ } catch (error) {
1089
+ continue;
1090
+ }
1091
+ }
1092
+ } catch (error) {
1093
+ }
1094
+ return files;
1095
+ }
1096
+ async function getAllProjects() {
1097
+ const cached = getCached("allProjects");
1098
+ if (cached)
1099
+ return cached;
1100
+ const projectMap = discoverProjects(process.cwd());
1101
+ const projects = Array.from(projectMap.keys());
1102
+ setCached("allProjects", projects);
1103
+ return projects;
1104
+ }
1105
+ async function getAllKosProjects() {
1106
+ const cached = getCached("allKosProjects");
1107
+ if (cached)
1108
+ return cached;
1109
+ if (process.env.KOS_CLI_QUIET !== "true") {
1110
+ console.warn(`[kos-cli] Discovering KOS projects by scanning .kos.json files...`);
1111
+ }
1112
+ const projectDirs = ["apps", "libs", "packages"];
1113
+ const kosJsonFiles = [];
1114
+ const workspaceRoot = process.cwd();
1115
+ for (const dir of projectDirs) {
1116
+ const dirPath = path12.join(workspaceRoot, dir);
1117
+ if (existsSync4(dirPath)) {
1118
+ findKosJsonFiles(dirPath, kosJsonFiles);
1119
+ }
1120
+ }
1121
+ const rootKosJson = path12.join(workspaceRoot, ".kos.json");
1122
+ if (existsSync4(rootKosJson)) {
1123
+ kosJsonFiles.push(rootKosJson);
1124
+ }
1125
+ if (kosJsonFiles.length === 0) {
1126
+ if (process.env.KOS_CLI_QUIET !== "true") {
1127
+ console.warn(`[kos-cli] No .kos.json files found in common directories, performing full workspace scan...`);
1128
+ }
1129
+ findKosJsonFiles(workspaceRoot, kosJsonFiles);
1130
+ }
1131
+ const kosProjects = [];
1132
+ for (const kosJsonPath of kosJsonFiles) {
1133
+ try {
1134
+ const kosConfig = JSON.parse(readFileSync6(kosJsonPath, "utf-8"));
1135
+ const projectDir = path12.dirname(kosJsonPath);
1136
+ let projectName = null;
1137
+ const projectJsonPath = path12.join(projectDir, "project.json");
1138
+ if (existsSync4(projectJsonPath)) {
1139
+ try {
1140
+ const projectJson = JSON.parse(readFileSync6(projectJsonPath, "utf-8"));
1141
+ projectName = projectJson.name;
1142
+ } catch (error) {
1143
+ projectName = path12.basename(projectDir);
1144
+ }
1145
+ } else {
1146
+ projectName = path12.basename(projectDir);
1147
+ }
1148
+ if (kosConfig.type === "root") {
1149
+ continue;
1150
+ }
1151
+ kosProjects.push({
1152
+ name: projectName,
1153
+ path: projectDir,
1154
+ kosJsonPath,
1155
+ config: kosConfig,
1156
+ projectType: kosConfig.generator?.projectType
1157
+ });
1158
+ } catch (error) {
1159
+ console.warn(`[kos-cli] Error reading ${kosJsonPath}: ${error.message}`);
1160
+ }
1161
+ }
1162
+ setCached("allKosProjects", kosProjects);
1163
+ return kosProjects;
1164
+ }
1165
+ async function getProjectsByMultipleTypes(targetTypes) {
1166
+ const cacheKey = `projectsByMultipleTypes:${targetTypes.join(",")}`;
1167
+ const cached = getCached(cacheKey);
1168
+ if (cached)
1169
+ return cached;
1170
+ console.warn(`[kos-cli] Filtering projects for projectTypes: ${targetTypes.join(", ")}...`);
1171
+ const allKosProjects = await getAllKosProjects();
1172
+ const filteredProjects = [];
1173
+ for (const kosProject of allKosProjects) {
1174
+ const projectType = kosProject.projectType;
1175
+ const hasAnyTargetType = targetTypes.some((targetType) => {
1176
+ return Array.isArray(projectType) ? projectType.includes(targetType) : projectType === targetType;
1177
+ });
1178
+ if (hasAnyTargetType) {
1179
+ filteredProjects.push(kosProject.name);
1180
+ }
1181
+ }
1182
+ setCached(cacheKey, filteredProjects);
1183
+ return filteredProjects;
1184
+ }
1185
+ async function getComponentCompatibleProjects() {
1186
+ return await getProjectsByMultipleTypes(["ui", "splash", "model-component"]);
1187
+ }
1188
+ async function getComponentCompatibleProjectsWithFallback() {
1189
+ const componentProjects = await getComponentCompatibleProjects();
1190
+ if (componentProjects.length > 0) {
1191
+ if (process.env.KOS_CLI_QUIET !== "true") {
1192
+ console.warn(`[kos-cli] Found ${componentProjects.length} component-compatible projects`);
1193
+ }
1194
+ return componentProjects;
1195
+ } else {
1196
+ if (process.env.KOS_CLI_QUIET !== "true") {
1197
+ console.warn(`[kos-cli] No component-compatible projects found, showing all projects`);
1198
+ }
1199
+ return await getAllProjects();
1200
+ }
1201
+ }
1202
+
1203
+ // src/lib/utils/validators.mjs
1204
+ function required(value) {
1205
+ return value && value.trim() !== "" ? true : "This field is required.";
1206
+ }
1207
+
1208
+ // src/lib/generators/component/index.mjs
1209
+ var metadata = {
8
1210
  key: "component",
9
1211
  name: "KOS React Component",
10
1212
  namedArguments: {
@@ -14,26 +1216,22 @@ export const metadata = {
14
1216
  componentProject: "componentProject"
15
1217
  }
16
1218
  };
17
-
18
- export default async function (plop) {
1219
+ async function component_default(plop) {
19
1220
  const componentProjects = await getComponentCompatibleProjectsWithFallback();
20
-
21
- plop.setActionType("createComponent", async function (answers) {
22
- const command = `npx nx generate @kosdev-code/kos-nx-plugin:kos-component \
23
- --name=${answers.componentName} \
24
- --appProject=${answers.componentProject} \
25
- --type=components \
26
- --no-interactive`;
27
-
28
- try {
29
- await execute(command);
30
- } catch (error) {
31
- throw new Error(error);
32
- }
33
-
1221
+ plop.setActionType("createComponent", async function(answers) {
1222
+ const cwd = process.cwd();
1223
+ const codegenFs = new TrackingFileSystem(new DirectFileSystem(cwd));
1224
+ generateComponent(codegenFs, getTemplateDir("kos-component"), {
1225
+ name: answers.componentName,
1226
+ appProject: answers.componentProject,
1227
+ type: "components",
1228
+ useEmotionCss: false,
1229
+ appDirectory: "",
1230
+ modelDirectory: ""
1231
+ });
1232
+ await formatFiles(codegenFs.root, codegenFs.writtenPaths);
34
1233
  return `Component ${answers.componentName} created in ${answers.componentProject}`;
35
1234
  });
36
-
37
1235
  plop.setGenerator("component", {
38
1236
  description: "Create a new KOS Component",
39
1237
  prompts: [
@@ -41,15 +1239,20 @@ export default async function (plop) {
41
1239
  type: "input",
42
1240
  name: "componentName",
43
1241
  message: "Enter the name of the component",
44
- validate: required,
1242
+ validate: required
45
1243
  },
46
1244
  {
47
1245
  type: "list",
48
1246
  name: "componentProject",
49
1247
  message: "Which project should the component be created in?",
50
- choices: componentProjects,
51
- },
1248
+ choices: componentProjects
1249
+ }
52
1250
  ],
53
- actions: actionFactory("createComponent", metadata),
1251
+ actions: actionFactory("createComponent", metadata)
54
1252
  });
55
1253
  }
1254
+ export {
1255
+ component_default as default,
1256
+ metadata
1257
+ };
1258
+ //# sourceMappingURL=index.mjs.map