create-kimesh 0.2.40 → 0.2.41

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,4 +1,4 @@
1
- import { main$1 as main } from "./main-DnvYiSHH.js";
1
+ import { main } from "./main.mjs";
2
2
 
3
3
  //#region src/utils/monorepo.d.ts
4
4
  /**
@@ -164,18 +164,13 @@ interface ModuleFile {
164
164
  interface ModuleConfigUpdate {
165
165
  /** Imports to add at the top of the config file */
166
166
  imports?: Array<{
167
- /** Module to import from */
168
- from: string;
169
- /** Named imports (e.g., ['tailwindcss']) */
170
- named?: string[];
171
- /** Default import name */
167
+ /** Module to import from */from: string; /** Named imports (e.g., ['tailwindcss']) */
168
+ named?: string[]; /** Default import name */
172
169
  default?: string;
173
170
  }>;
174
171
  /** Vite plugins to add */
175
172
  vitePlugins?: Array<{
176
- /** Plugin name (e.g., 'tailwindcss') */
177
- name: string;
178
- /** Plugin call expression (e.g., 'tailwindcss()') */
173
+ /** Plugin name (e.g., 'tailwindcss') */name: string; /** Plugin call expression (e.g., 'tailwindcss()') */
179
174
  call: string;
180
175
  }>;
181
176
  }
@@ -354,10 +349,6 @@ declare function promptHostAppSelection(candidates: HostAppCandidate[]): Promise
354
349
  * @returns Selected directory path
355
350
  */
356
351
  declare function promptLayerDirectory(recommendedDir: string, monorepoRoot: string): Promise<string>;
357
- /**
358
- * Prompt user whether to include example files
359
- */
360
-
361
352
  /**
362
353
  * Prompt user whether to update host app
363
354
  *
package/dist/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import { a as transformTemplateToLayer, i as toPascalCase, n as generatePackageName, o as validateLayerName, t as DEFAULT_KIMESH_VERSION } from "./layer-C6EP_Uly.mjs";
2
+ import { A as hasUnmetDependencies, B as promptNpmScope, C as fetchTemplate, D as isValidTemplateName, E as getTemplateSource, F as isValidModuleId, G as promptProjectName, H as promptUpdateHost, I as parseModulesArg, K as validateProjectName, L as promptHostAppSelection, M as AVAILABLE_MODULES, N as getModule, O as promptModuleSelection, P as getModuleIds, R as promptLayerDirectory, S as fetchAllTemplates, T as getTemplateNames, U as promptDirectoryConflict, V as promptProjectType, W as promptNewDirectoryName, _ as detectPreferredPackageManager, a as findHostApps, b as installDependencies, c as collectPackages, d as installModules, f as installNpmPackages, g as promptPackageManager, h as promptInstallDeps, i as detectMonorepoRoot, j as resolveModules, k as getModuleDisplayHint, l as generateModuleFiles, m as promptGitInit, n as addLayerToHost, o as getRecommendedLayerDir, p as updateKimeshConfig, r as canUpdateHost, s as isInWorkspace, t as main, u as getInstallSummary, v as downloadProjectTemplate, w as getDefaultTemplateName, x as promptTemplateSelection, y as initGitRepo, z as promptLayerName } from "./main-CNUdQYlu.mjs";
3
+
4
+ export { AVAILABLE_MODULES, DEFAULT_KIMESH_VERSION, addLayerToHost, canUpdateHost, collectPackages, detectMonorepoRoot, detectPreferredPackageManager, downloadProjectTemplate, fetchAllTemplates, fetchTemplate, findHostApps, generateModuleFiles, generatePackageName, getDefaultTemplateName, getInstallSummary, getModule, getModuleDisplayHint, getModuleIds, getRecommendedLayerDir, getTemplateNames, getTemplateSource, hasUnmetDependencies, initGitRepo, installDependencies, installModules, installNpmPackages, isInWorkspace, isValidModuleId, isValidTemplateName, main, parseModulesArg, promptDirectoryConflict, promptGitInit, promptHostAppSelection, promptInstallDeps, promptLayerDirectory, promptLayerName, promptModuleSelection, promptNewDirectoryName, promptNpmScope, promptPackageManager, promptProjectName, promptProjectType, promptTemplateSelection, promptUpdateHost, resolveModules, toPascalCase, transformTemplateToLayer, updateKimeshConfig, validateLayerName, validateProjectName };
@@ -2,7 +2,31 @@ import { existsSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
4
4
 
5
+ //#region \0rolldown/runtime.js
6
+ var __defProp = Object.defineProperty;
7
+ var __exportAll = (all, no_symbols) => {
8
+ let target = {};
9
+ for (var name in all) {
10
+ __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ }
15
+ if (!no_symbols) {
16
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
17
+ }
18
+ return target;
19
+ };
20
+
21
+ //#endregion
5
22
  //#region src/utils/layer.ts
23
+ var layer_exports = /* @__PURE__ */ __exportAll({
24
+ DEFAULT_KIMESH_VERSION: () => DEFAULT_KIMESH_VERSION,
25
+ generatePackageName: () => generatePackageName,
26
+ toPascalCase: () => toPascalCase,
27
+ transformTemplateToLayer: () => transformTemplateToLayer,
28
+ validateLayerName: () => validateLayerName
29
+ });
6
30
  /**
7
31
  * Default version for @kimesh/* dependencies.
8
32
  * This should match the version of create-kimesh package.
@@ -68,16 +92,13 @@ async function updatePackageJsonForLayer(layerPath, packageName) {
68
92
  * Update kimesh.config.ts for layer usage
69
93
  */
70
94
  async function updateKimeshConfigForLayer(layerPath, layerName) {
71
- const configPath = join(layerPath, "kimesh.config.ts");
72
- const pascalName = toPascalCase(layerName);
73
- const newConfig = `export default defineKmConfig({
95
+ await writeFile(join(layerPath, "kimesh.config.ts"), `export default defineKmConfig({
74
96
  name: "${layerName}",
75
97
  components: {
76
- prefix: "${pascalName}",
98
+ prefix: "${toPascalCase(layerName)}",
77
99
  },
78
100
  });
79
- `;
80
- await writeFile(configPath, newConfig);
101
+ `);
81
102
  }
82
103
  /**
83
104
  * Restructure routes from app pattern to layer pattern
@@ -96,12 +117,8 @@ async function restructureRoutesForLayer(layerPath, layerName) {
96
117
  const routesDir = join(layerPath, "src", "routes");
97
118
  const layerRoutesDir = join(routesDir, layerName);
98
119
  if (!existsSync(layerRoutesDir)) await mkdir(layerRoutesDir, { recursive: true });
99
- const newIndexPath = join(layerRoutesDir, "index.vue");
100
- const indexContent = generateLayerIndexRoute(layerName);
101
- await writeFile(newIndexPath, indexContent);
102
- const layoutPath = join(routesDir, `${layerName}.vue`);
103
- const layoutContent = generateLayerLayoutRoute(layerName);
104
- await writeFile(layoutPath, layoutContent);
120
+ await writeFile(join(layerRoutesDir, "index.vue"), generateLayerIndexRoute(layerName));
121
+ await writeFile(join(routesDir, `${layerName}.vue`), generateLayerLayoutRoute(layerName));
105
122
  }
106
123
  /**
107
124
  * Clean up files that aren't needed for layers
@@ -121,14 +138,13 @@ async function cleanupForLayer(layerPath) {
121
138
  * Generate a layout route for the layer
122
139
  */
123
140
  function generateLayerLayoutRoute(layerName) {
124
- const pascalName = toPascalCase(layerName);
125
141
  return `<script setup lang="ts">
126
142
  /**
127
- * ${pascalName} Layer Layout
143
+ * ${toPascalCase(layerName)} Layer Layout
128
144
  *
129
145
  * This layout wraps all routes under /${layerName}/*
130
146
  */
131
- </script>
147
+ <\/script>
132
148
 
133
149
  <template>
134
150
  <div class="${layerName}-layout">
@@ -154,7 +170,7 @@ function generateLayerIndexRoute(layerName) {
154
170
  *
155
171
  * Route: /${layerName}
156
172
  */
157
- </script>
173
+ <\/script>
158
174
 
159
175
  <template>
160
176
  <div class="${layerName}-page">
@@ -191,7 +207,6 @@ function validateLayerName(name) {
191
207
  if (!/^[a-z][a-z0-9-]*$/.test(name)) return "Layer name must start with a letter and contain only lowercase letters, numbers, and hyphens";
192
208
  if (name.length < 2) return "Layer name must be at least 2 characters";
193
209
  if (name.length > 50) return "Layer name must be at most 50 characters";
194
- return void 0;
195
210
  }
196
211
  /**
197
212
  * Generate a package name from layer name and optional scope
@@ -201,12 +216,9 @@ function validateLayerName(name) {
201
216
  * @returns Full package name
202
217
  */
203
218
  function generatePackageName(layerName, scope) {
204
- if (scope) {
205
- const normalizedScope = scope.startsWith("@") ? scope : `@${scope}`;
206
- return `${normalizedScope}/${layerName}`;
207
- }
219
+ if (scope) return `${scope.startsWith("@") ? scope : `@${scope}`}/${layerName}`;
208
220
  return layerName;
209
221
  }
210
222
 
211
223
  //#endregion
212
- export { DEFAULT_KIMESH_VERSION, generatePackageName, toPascalCase, transformTemplateToLayer, validateLayerName };
224
+ export { transformTemplateToLayer as a, toPascalCase as i, generatePackageName as n, validateLayerName as o, layer_exports as r, DEFAULT_KIMESH_VERSION as t };
@@ -1,13 +1,7 @@
1
- import { DEFAULT_KIMESH_VERSION, generatePackageName, transformTemplateToLayer, validateLayerName } from "./layer-CgUaXN1I.js";
1
+ import { a as transformTemplateToLayer, n as generatePackageName, o as validateLayerName, t as DEFAULT_KIMESH_VERSION } from "./layer-C6EP_Uly.mjs";
2
2
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { dirname, join, relative, resolve } from "node:path";
4
4
  import { defineCommand } from "citty";
5
- import * as clack$6 from "@clack/prompts";
6
- import * as clack$5 from "@clack/prompts";
7
- import * as clack$4 from "@clack/prompts";
8
- import * as clack$3 from "@clack/prompts";
9
- import * as clack$2 from "@clack/prompts";
10
- import * as clack$1 from "@clack/prompts";
11
5
  import * as clack from "@clack/prompts";
12
6
  import pc from "picocolors";
13
7
  import { readFile, readdir, rm, writeFile } from "node:fs/promises";
@@ -31,7 +25,6 @@ function validateProjectName(name) {
31
25
  const trimmed = name.trim();
32
26
  if (!trimmed) return "Project name cannot be empty";
33
27
  if (!PROJECT_NAME_REGEX.test(trimmed)) return "Project name can only contain letters, numbers, hyphens, and underscores";
34
- return void 0;
35
28
  }
36
29
  /**
37
30
  * Prompt the user for a project name
@@ -40,14 +33,14 @@ function validateProjectName(name) {
40
33
  * @returns The validated project name
41
34
  */
42
35
  async function promptProjectName(defaultName = "kimesh-app") {
43
- const result = await clack$6.text({
36
+ const result = await clack.text({
44
37
  message: "What is your project name?",
45
38
  placeholder: defaultName,
46
39
  defaultValue: defaultName,
47
40
  validate: (value) => validateProjectName(value || defaultName)
48
41
  });
49
- if (clack$6.isCancel(result)) {
50
- clack$6.cancel("Operation cancelled");
42
+ if (clack.isCancel(result)) {
43
+ clack.cancel("Operation cancelled");
51
44
  process.exit(0);
52
45
  }
53
46
  return result.trim();
@@ -78,12 +71,12 @@ const CONFLICT_OPTIONS = [
78
71
  * @param dirname - The name of the existing directory
79
72
  * @returns The chosen action: 'override', 'different', or 'abort'
80
73
  */
81
- async function promptDirectoryConflict(dirname$1) {
82
- const result = await clack$5.select({
83
- message: `Directory "${dirname$1}" already exists. What would you like to do?`,
74
+ async function promptDirectoryConflict(dirname) {
75
+ const result = await clack.select({
76
+ message: `Directory "${dirname}" already exists. What would you like to do?`,
84
77
  options: CONFLICT_OPTIONS
85
78
  });
86
- if (clack$5.isCancel(result)) return "abort";
79
+ if (clack.isCancel(result)) return "abort";
87
80
  return result;
88
81
  }
89
82
  /**
@@ -93,18 +86,17 @@ async function promptDirectoryConflict(dirname$1) {
93
86
  * @returns The new directory name
94
87
  */
95
88
  async function promptNewDirectoryName(currentName) {
96
- const result = await clack$5.text({
89
+ const result = await clack.text({
97
90
  message: "Enter a new directory name:",
98
91
  placeholder: `${currentName}-new`,
99
92
  validate: (value) => {
100
93
  const trimmed = value.trim();
101
94
  if (!trimmed) return "Directory name cannot be empty";
102
95
  if (!/^[\w-]+$/.test(trimmed)) return "Directory name can only contain letters, numbers, hyphens, and underscores";
103
- return void 0;
104
96
  }
105
97
  });
106
- if (clack$5.isCancel(result)) {
107
- clack$5.cancel("Operation cancelled");
98
+ if (clack.isCancel(result)) {
99
+ clack.cancel("Operation cancelled");
108
100
  process.exit(0);
109
101
  }
110
102
  return result.trim();
@@ -118,7 +110,7 @@ async function promptNewDirectoryName(currentName) {
118
110
  * @returns Selected project type
119
111
  */
120
112
  async function promptProjectType() {
121
- const result = await clack$4.select({
113
+ const result = await clack.select({
122
114
  message: "What would you like to create?",
123
115
  options: [{
124
116
  value: "app",
@@ -131,8 +123,8 @@ async function promptProjectType() {
131
123
  }],
132
124
  initialValue: "app"
133
125
  });
134
- if (clack$4.isCancel(result)) {
135
- clack$4.cancel("Operation cancelled");
126
+ if (clack.isCancel(result)) {
127
+ clack.cancel("Operation cancelled");
136
128
  process.exit(0);
137
129
  }
138
130
  return result;
@@ -144,17 +136,16 @@ async function promptProjectType() {
144
136
  * @returns Layer name
145
137
  */
146
138
  async function promptLayerName(defaultName = "my-layer") {
147
- const result = await clack$4.text({
139
+ const result = await clack.text({
148
140
  message: "Layer name:",
149
141
  placeholder: defaultName,
150
142
  defaultValue: defaultName,
151
143
  validate: (value) => {
152
- const error = validateLayerName(value || defaultName);
153
- return error;
144
+ return validateLayerName(value || defaultName);
154
145
  }
155
146
  });
156
- if (clack$4.isCancel(result)) {
157
- clack$4.cancel("Operation cancelled");
147
+ if (clack.isCancel(result)) {
148
+ clack.cancel("Operation cancelled");
158
149
  process.exit(0);
159
150
  }
160
151
  return result;
@@ -167,7 +158,7 @@ async function promptLayerName(defaultName = "my-layer") {
167
158
  */
168
159
  async function promptNpmScope(defaultScope) {
169
160
  const placeholder = "e.g., myorg";
170
- const result = await clack$4.text({
161
+ const result = await clack.text({
171
162
  message: "NPM scope (optional):",
172
163
  placeholder,
173
164
  defaultValue: defaultScope ?? "",
@@ -176,11 +167,10 @@ async function promptNpmScope(defaultScope) {
176
167
  if (value === placeholder || value.startsWith("e.g.,")) return void 0;
177
168
  if (value.startsWith("@")) return "Don't include @ in the scope";
178
169
  if (!/^[a-z][a-z0-9-]*$/.test(value)) return "Scope must start with a letter and contain only lowercase letters, numbers, and hyphens";
179
- return void 0;
180
170
  }
181
171
  });
182
- if (clack$4.isCancel(result)) {
183
- clack$4.cancel("Operation cancelled");
172
+ if (clack.isCancel(result)) {
173
+ clack.cancel("Operation cancelled");
184
174
  process.exit(0);
185
175
  }
186
176
  if (!result || result === placeholder || result.startsWith("e.g.,")) return "";
@@ -203,13 +193,13 @@ async function promptHostAppSelection(candidates) {
203
193
  label: candidate.name,
204
194
  hint: candidate.hasKimeshConfig ? pc.green("✓ Has kimesh.config.ts") : pc.dim("No kimesh.config.ts")
205
195
  }))];
206
- const result = await clack$4.select({
196
+ const result = await clack.select({
207
197
  message: "Which host app should extend this layer?",
208
198
  options,
209
199
  initialValue: candidates.find((c) => c.hasKimeshConfig) || null
210
200
  });
211
- if (clack$4.isCancel(result)) {
212
- clack$4.cancel("Operation cancelled");
201
+ if (clack.isCancel(result)) {
202
+ clack.cancel("Operation cancelled");
213
203
  process.exit(0);
214
204
  }
215
205
  return result;
@@ -223,18 +213,17 @@ async function promptHostAppSelection(candidates) {
223
213
  */
224
214
  async function promptLayerDirectory(recommendedDir, monorepoRoot) {
225
215
  const relativeRecommended = recommendedDir.replace(monorepoRoot + "/", "");
226
- const result = await clack$4.text({
216
+ const result = await clack.text({
227
217
  message: "Layer directory (relative to monorepo root):",
228
218
  placeholder: relativeRecommended,
229
219
  defaultValue: relativeRecommended,
230
220
  validate: (value) => {
231
221
  if (!value) return "Directory is required";
232
222
  if (value.startsWith("/")) return "Path must be relative";
233
- return void 0;
234
223
  }
235
224
  });
236
- if (clack$4.isCancel(result)) {
237
- clack$4.cancel("Operation cancelled");
225
+ if (clack.isCancel(result)) {
226
+ clack.cancel("Operation cancelled");
238
227
  process.exit(0);
239
228
  }
240
229
  return result;
@@ -246,12 +235,12 @@ async function promptLayerDirectory(recommendedDir, monorepoRoot) {
246
235
  * @returns Whether to update host
247
236
  */
248
237
  async function promptUpdateHost(hostName) {
249
- const result = await clack$4.confirm({
238
+ const result = await clack.confirm({
250
239
  message: `Add layer to ${pc.cyan(hostName)}'s configuration?`,
251
240
  initialValue: true
252
241
  });
253
- if (clack$4.isCancel(result)) {
254
- clack$4.cancel("Operation cancelled");
242
+ if (clack.isCancel(result)) {
243
+ clack.cancel("Operation cancelled");
255
244
  process.exit(0);
256
245
  }
257
246
  return result;
@@ -419,9 +408,8 @@ function resolveModules(selectedIds) {
419
408
  }
420
409
  }
421
410
  }
422
- const modules = Array.from(selected).map((id) => getModule(id)).filter((m) => m !== void 0).sort((a, b) => a.installOrder - b.installOrder);
423
411
  return {
424
- modules,
412
+ modules: Array.from(selected).map((id) => getModule(id)).filter((m) => m !== void 0).sort((a, b) => a.installOrder - b.installOrder),
425
413
  autoAdded
426
414
  };
427
415
  }
@@ -458,13 +446,13 @@ async function promptModuleSelection() {
458
446
  label: mod.label,
459
447
  hint: getModuleDisplayHint(mod)
460
448
  }));
461
- const result = await clack$3.multiselect({
449
+ const result = await clack.multiselect({
462
450
  message: "Which modules would you like to include? (space to select, enter to confirm)",
463
451
  options,
464
452
  required: false
465
453
  });
466
- if (clack$3.isCancel(result)) {
467
- clack$3.cancel("Operation cancelled");
454
+ if (clack.isCancel(result)) {
455
+ clack.cancel("Operation cancelled");
468
456
  process.exit(0);
469
457
  }
470
458
  return result;
@@ -493,7 +481,7 @@ const TEMPLATE_NAMES = ["minimal"];
493
481
  /**
494
482
  * Cache for fetched templates
495
483
  */
496
- const templateCache = new Map();
484
+ const templateCache = /* @__PURE__ */ new Map();
497
485
  /**
498
486
  * Fetch a template definition from the registry
499
487
  * Falls back to built-in definition if registry is not available
@@ -504,8 +492,7 @@ const templateCache = new Map();
504
492
  async function fetchTemplate(name) {
505
493
  if (templateCache.has(name)) return templateCache.get(name);
506
494
  try {
507
- const url = `${REGISTRY_BASE_URL}/${name}.json`;
508
- const template = await ofetch(url);
495
+ const template = await ofetch(`${REGISTRY_BASE_URL}/${name}.json`);
509
496
  if (!template.name || !template.description || !template.defaultDir) throw new Error(`Invalid template definition for "${name}"`);
510
497
  templateCache.set(name, template);
511
498
  return template;
@@ -573,13 +560,13 @@ async function promptTemplateSelection(templates) {
573
560
  label: t.name,
574
561
  hint: t.description
575
562
  }));
576
- const result = await clack$2.select({
563
+ const result = await clack.select({
577
564
  message: "Which template would you like to use?",
578
565
  options,
579
566
  initialValue: defaultTemplate
580
567
  });
581
- if (clack$2.isCancel(result)) {
582
- clack$2.cancel("Operation cancelled");
568
+ if (clack.isCancel(result)) {
569
+ clack.cancel("Operation cancelled");
583
570
  process.exit(0);
584
571
  }
585
572
  const selected = templates.find((t) => t.name === result);
@@ -607,8 +594,7 @@ async function downloadProjectTemplate(options) {
607
594
  dir,
608
595
  error: `Directory "${dir}" already exists`
609
596
  };
610
- const source = getTemplateSource(template.name);
611
- const result = await downloadTemplate(source, {
597
+ const result = await downloadTemplate(getTemplateSource(template.name), {
612
598
  dir,
613
599
  force: true,
614
600
  install: false
@@ -655,12 +641,11 @@ async function updatePackageJson$1(dir, options) {
655
641
  */
656
642
  function fixWorkspaceVersions(pkg, kimeshVersion) {
657
643
  const fixedVersion = `^${kimeshVersion}`;
658
- const depTypes = [
644
+ for (const depType of [
659
645
  "dependencies",
660
646
  "devDependencies",
661
647
  "peerDependencies"
662
- ];
663
- for (const depType of depTypes) {
648
+ ]) {
664
649
  const deps = pkg[depType];
665
650
  if (!deps || typeof deps !== "object") continue;
666
651
  for (const [name, version] of Object.entries(deps)) if (name.startsWith("@kimesh/") && version === "workspace:*") deps[name] = fixedVersion;
@@ -675,8 +660,7 @@ function fixWorkspaceVersions(pkg, kimeshVersion) {
675
660
  async function initGitRepo(dir) {
676
661
  try {
677
662
  const { exec } = await import("tinyexec");
678
- const result = await exec("git", ["init"], { nodeOptions: { cwd: dir } });
679
- return result.exitCode === 0;
663
+ return (await exec("git", ["init"], { nodeOptions: { cwd: dir } })).exitCode === 0;
680
664
  } catch {
681
665
  return false;
682
666
  }
@@ -691,10 +675,9 @@ async function initGitRepo(dir) {
691
675
  async function installDependencies(dir, packageManager) {
692
676
  try {
693
677
  const { installDependencies: nypmInstall, detectPackageManager } = await import("nypm");
694
- const pm = packageManager || (await detectPackageManager(dir))?.name;
695
678
  await nypmInstall({
696
679
  cwd: dir,
697
- packageManager: pm,
680
+ packageManager: packageManager || (await detectPackageManager(dir))?.name,
698
681
  silent: false
699
682
  });
700
683
  return true;
@@ -751,13 +734,13 @@ const PACKAGE_MANAGER_OPTIONS = [
751
734
  */
752
735
  async function promptPackageManager() {
753
736
  const detected = await detectPreferredPackageManager();
754
- const result = await clack$1.select({
737
+ const result = await clack.select({
755
738
  message: "Which package manager would you like to use?",
756
739
  options: PACKAGE_MANAGER_OPTIONS,
757
740
  initialValue: detected
758
741
  });
759
- if (clack$1.isCancel(result)) {
760
- clack$1.cancel("Operation cancelled");
742
+ if (clack.isCancel(result)) {
743
+ clack.cancel("Operation cancelled");
761
744
  process.exit(0);
762
745
  }
763
746
  return result;
@@ -768,11 +751,11 @@ async function promptPackageManager() {
768
751
  * @returns Whether to install dependencies
769
752
  */
770
753
  async function promptInstallDeps() {
771
- const result = await clack$1.confirm({
754
+ const result = await clack.confirm({
772
755
  message: "Would you like to install dependencies now?",
773
756
  initialValue: true
774
757
  });
775
- if (clack$1.isCancel(result)) return false;
758
+ if (clack.isCancel(result)) return false;
776
759
  return result;
777
760
  }
778
761
  /**
@@ -781,11 +764,11 @@ async function promptInstallDeps() {
781
764
  * @returns Whether to initialize git
782
765
  */
783
766
  async function promptGitInit() {
784
- const result = await clack$1.confirm({
767
+ const result = await clack.confirm({
785
768
  message: "Would you like to initialize a git repository?",
786
769
  initialValue: true
787
770
  });
788
- if (clack$1.isCancel(result)) return false;
771
+ if (clack.isCancel(result)) return false;
789
772
  return result;
790
773
  }
791
774
 
@@ -795,8 +778,8 @@ async function promptGitInit() {
795
778
  * Collect all packages from modules
796
779
  */
797
780
  function collectPackages(modules) {
798
- const dependencies = new Set();
799
- const devDependencies = new Set();
781
+ const dependencies = /* @__PURE__ */ new Set();
782
+ const devDependencies = /* @__PURE__ */ new Set();
800
783
  for (const mod of modules) {
801
784
  if (mod.packages) for (const pkg of mod.packages) dependencies.add(pkg);
802
785
  if (mod.devPackages) for (const pkg of mod.devPackages) devDependencies.add(pkg);
@@ -848,8 +831,7 @@ async function updateKimeshConfig$1(projectDir, modules) {
848
831
  for (const mod of modules) if (mod.config) allConfigUpdates.push(mod.config);
849
832
  if (allConfigUpdates.length === 0) return false;
850
833
  try {
851
- const configContent = readFileSync(configPath, "utf-8");
852
- const mod = parseModule(configContent);
834
+ const mod = parseModule(readFileSync(configPath, "utf-8"));
853
835
  for (const config of allConfigUpdates) applyConfigUpdate(mod, config);
854
836
  const { code } = generateCode(mod);
855
837
  writeFileSync(configPath, code, "utf-8");
@@ -876,8 +858,7 @@ function applyConfigUpdate(mod, config) {
876
858
  });
877
859
  }
878
860
  if (config.vitePlugins) {
879
- const exports = mod.exports;
880
- const defaultExport = exports.default;
861
+ const defaultExport = mod.exports.default;
881
862
  if (defaultExport && typeof defaultExport === "object") {
882
863
  const vite = defaultExport.vite;
883
864
  if (vite && typeof vite === "object") {
@@ -956,8 +937,7 @@ async function detectMonorepoRoot(cwd) {
956
937
  while (currentDir !== root) {
957
938
  const pnpmWorkspacePath = join(currentDir, "pnpm-workspace.yaml");
958
939
  if (existsSync(pnpmWorkspacePath)) try {
959
- const content = await readFile(pnpmWorkspacePath, "utf-8");
960
- const parsed = parse(content);
940
+ const parsed = parse(await readFile(pnpmWorkspacePath, "utf-8"));
961
941
  return {
962
942
  root: currentDir,
963
943
  packageManager: "pnpm",
@@ -1000,8 +980,7 @@ async function detectMonorepoRoot(cwd) {
1000
980
  */
1001
981
  async function findHostApps(monorepoRoot) {
1002
982
  const candidates = [];
1003
- const appDirs = ["apps", "packages"];
1004
- for (const appDir of appDirs) {
983
+ for (const appDir of ["apps", "packages"]) {
1005
984
  const appDirPath = join(monorepoRoot, appDir);
1006
985
  if (!existsSync(appDirPath)) continue;
1007
986
  try {
@@ -1041,10 +1020,7 @@ async function findHostApps(monorepoRoot) {
1041
1020
  */
1042
1021
  function getRecommendedLayerDir(monorepoRoot, workspaces) {
1043
1022
  for (const pattern of workspaces) {
1044
- if (pattern.includes("layers/")) {
1045
- const layersDir = pattern.replace("/*", "").replace("/**", "");
1046
- return join(monorepoRoot, layersDir);
1047
- }
1023
+ if (pattern.includes("layers/")) return join(monorepoRoot, pattern.replace("/*", "").replace("/**", ""));
1048
1024
  if (pattern.includes("packages/")) return join(monorepoRoot, "packages");
1049
1025
  }
1050
1026
  return join(monorepoRoot, "packages");
@@ -1168,9 +1144,7 @@ async function updateKimeshConfig(options) {
1168
1144
  const extendsArray = configObject.extends;
1169
1145
  if (extendsArray) {
1170
1146
  if (extendsArray.$ast?.elements && Array.isArray(extendsArray.$ast.elements)) {
1171
- const elements = extendsArray.$ast.elements;
1172
- const hasLayer = elements.some((el) => el.value === layerName);
1173
- if (hasLayer) return {
1147
+ if (extendsArray.$ast.elements.some((el) => el.value === layerName)) return {
1174
1148
  success: true,
1175
1149
  updated: false
1176
1150
  };
@@ -1193,10 +1167,9 @@ async function updateKimeshConfig(options) {
1193
1167
  updated: true
1194
1168
  };
1195
1169
  } catch {
1196
- const content = await readFile(configPath, "utf-8");
1197
1170
  return await updateKimeshConfigRegex({
1198
1171
  configPath,
1199
- content,
1172
+ content: await readFile(configPath, "utf-8"),
1200
1173
  layerName
1201
1174
  });
1202
1175
  }
@@ -1226,12 +1199,10 @@ async function updateKimeshConfigRegex(options) {
1226
1199
  newContent = content.replace(extendsArrayPattern, newExtends);
1227
1200
  } else {
1228
1201
  const defineConfigPattern = /(defineConfig\s*\(\s*\{)/;
1229
- const defineMatch = content.match(defineConfigPattern);
1230
- if (defineMatch) newContent = content.replace(defineConfigPattern, `$1\n extends: [\n "${layerName}",\n ],`);
1202
+ if (content.match(defineConfigPattern)) newContent = content.replace(defineConfigPattern, `$1\n extends: [\n "${layerName}",\n ],`);
1231
1203
  else {
1232
1204
  const exportDefaultPattern = /(export\s+default\s*\{)/;
1233
- const exportMatch = content.match(exportDefaultPattern);
1234
- if (exportMatch) newContent = content.replace(exportDefaultPattern, `$1\n extends: [\n "${layerName}",\n ],`);
1205
+ if (content.match(exportDefaultPattern)) newContent = content.replace(exportDefaultPattern, `$1\n extends: [\n "${layerName}",\n ],`);
1235
1206
  else return {
1236
1207
  success: false,
1237
1208
  updated: false,
@@ -1340,7 +1311,7 @@ async function runLayerFlow(args) {
1340
1311
  let layerName;
1341
1312
  if (args.dir) {
1342
1313
  layerName = args.dir;
1343
- const nameError = (await import("./layer-DyFo-o5X.js")).validateLayerName(layerName);
1314
+ const nameError = (await import("./layer-C6EP_Uly.mjs").then((n) => n.r)).validateLayerName(layerName);
1344
1315
  if (nameError) {
1345
1316
  clack.log.error(nameError);
1346
1317
  clack.outro(pc.red("Operation failed"));
@@ -1352,8 +1323,7 @@ async function runLayerFlow(args) {
1352
1323
  const packageName = generatePackageName(layerName, npmScope);
1353
1324
  let layerPath;
1354
1325
  if (monorepo) {
1355
- const recommendedDir = getRecommendedLayerDir(monorepo.root, monorepo.workspaces);
1356
- const fullRecommendedPath = join(recommendedDir, layerName);
1326
+ const fullRecommendedPath = join(getRecommendedLayerDir(monorepo.root, monorepo.workspaces), layerName);
1357
1327
  if (args.dir) layerPath = fullRecommendedPath;
1358
1328
  else {
1359
1329
  const layerDir = await promptLayerDirectory(fullRecommendedPath, monorepo.root);
@@ -1372,8 +1342,7 @@ async function runLayerFlow(args) {
1372
1342
  if (hostCandidates.length > 0) {
1373
1343
  selectedHost = await promptHostAppSelection(hostCandidates);
1374
1344
  if (selectedHost) {
1375
- const shouldUpdate = await promptUpdateHost(selectedHost.name);
1376
- if (!shouldUpdate) selectedHost = null;
1345
+ if (!await promptUpdateHost(selectedHost.name)) selectedHost = null;
1377
1346
  }
1378
1347
  }
1379
1348
  }
@@ -1446,9 +1415,7 @@ async function runLayerFlow(args) {
1446
1415
  if (shouldInstall) {
1447
1416
  const installSpinner = clack.spinner();
1448
1417
  installSpinner.start(`Installing dependencies with ${packageManager}...`);
1449
- const installPath = monorepo?.root || layerPath;
1450
- const installSuccess = await installDependencies(installPath, packageManager);
1451
- if (installSuccess) installSpinner.stop("Dependencies installed successfully!");
1418
+ if (await installDependencies(monorepo?.root || layerPath, packageManager)) installSpinner.stop("Dependencies installed successfully!");
1452
1419
  else installSpinner.stop("Failed to install dependencies (skipping)");
1453
1420
  }
1454
1421
  clack.log.success("Layer created successfully!");
@@ -1518,11 +1485,8 @@ async function runAppFlow(args) {
1518
1485
  else if (args.pm) {
1519
1486
  clack.log.warn(`Invalid package manager "${args.pm}". Using auto-detection.`);
1520
1487
  packageManager = await detectPreferredPackageManager();
1521
- } else {
1522
- const hasNonInteractiveFlags = args.install !== void 0 || args.git !== void 0;
1523
- if (hasNonInteractiveFlags) packageManager = await detectPreferredPackageManager();
1524
- else packageManager = await promptPackageManager();
1525
- }
1488
+ } else if (args.install !== void 0 || args.git !== void 0) packageManager = await detectPreferredPackageManager();
1489
+ else packageManager = await promptPackageManager();
1526
1490
  let selectedModuleIds = [];
1527
1491
  if (args.modules !== void 0) selectedModuleIds = parseModulesArg(args.modules);
1528
1492
  else if (!args.dir) selectedModuleIds = await promptModuleSelection();
@@ -1568,15 +1532,13 @@ async function runAppFlow(args) {
1568
1532
  if (shouldGitInit) {
1569
1533
  const gitSpinner = clack.spinner();
1570
1534
  gitSpinner.start("Initializing git repository...");
1571
- const gitSuccess = await initGitRepo(projectPath);
1572
- if (gitSuccess) gitSpinner.stop("Git repository initialized");
1535
+ if (await initGitRepo(projectPath)) gitSpinner.stop("Git repository initialized");
1573
1536
  else gitSpinner.stop("Failed to initialize git (skipping)");
1574
1537
  }
1575
1538
  if (shouldInstall) {
1576
1539
  const installSpinner = clack.spinner();
1577
1540
  installSpinner.start(`Installing dependencies with ${packageManager}...`);
1578
- const installSuccess = await installDependencies(projectPath, packageManager);
1579
- if (installSuccess) installSpinner.stop("Dependencies installed successfully!");
1541
+ if (await installDependencies(projectPath, packageManager)) installSpinner.stop("Dependencies installed successfully!");
1580
1542
  else installSpinner.stop("Failed to install dependencies (skipping)");
1581
1543
  }
1582
1544
  if (resolvedModules.length > 0) {
@@ -1613,4 +1575,4 @@ async function runAppFlow(args) {
1613
1575
  }
1614
1576
 
1615
1577
  //#endregion
1616
- export { AVAILABLE_MODULES, addLayerToHost, canUpdateHost, collectPackages, detectMonorepoRoot, detectPreferredPackageManager, downloadProjectTemplate, fetchAllTemplates, fetchTemplate, findHostApps, generateModuleFiles, getDefaultTemplateName, getInstallSummary, getModule, getModuleDisplayHint, getModuleIds, getRecommendedLayerDir, getTemplateNames, getTemplateSource, hasUnmetDependencies, initGitRepo, installDependencies, installModules, installNpmPackages, isInWorkspace, isValidModuleId, isValidTemplateName, main, parseModulesArg, promptDirectoryConflict, promptGitInit, promptHostAppSelection, promptInstallDeps, promptLayerDirectory, promptLayerName, promptModuleSelection, promptNewDirectoryName, promptNpmScope, promptPackageManager, promptProjectName, promptProjectType, promptTemplateSelection, promptUpdateHost, resolveModules, updateKimeshConfig$1 as updateKimeshConfig, validateProjectName };
1578
+ export { hasUnmetDependencies as A, promptNpmScope as B, fetchTemplate as C, isValidTemplateName as D, getTemplateSource as E, isValidModuleId as F, promptProjectName as G, promptUpdateHost as H, parseModulesArg as I, validateProjectName as K, promptHostAppSelection as L, AVAILABLE_MODULES as M, getModule as N, promptModuleSelection as O, getModuleIds as P, promptLayerDirectory as R, fetchAllTemplates as S, getTemplateNames as T, promptDirectoryConflict as U, promptProjectType as V, promptNewDirectoryName as W, detectPreferredPackageManager as _, findHostApps as a, installDependencies as b, collectPackages as c, installModules as d, installNpmPackages as f, promptPackageManager as g, promptInstallDeps as h, detectMonorepoRoot as i, resolveModules as j, getModuleDisplayHint as k, generateModuleFiles as l, promptGitInit as m, addLayerToHost as n, getRecommendedLayerDir as o, updateKimeshConfig$1 as p, canUpdateHost as r, isInWorkspace as s, main as t, getInstallSummary as u, downloadProjectTemplate as v, getDefaultTemplateName as w, promptTemplateSelection as x, initGitRepo as y, promptLayerName as z };
@@ -1,7 +1,7 @@
1
- import * as citty0 from "citty";
1
+ import * as citty from "citty";
2
2
 
3
3
  //#region src/main.d.ts
4
- declare const main: citty0.CommandDef<{
4
+ declare const main: citty.CommandDef<{
5
5
  dir: {
6
6
  type: "positional";
7
7
  description: string;
@@ -49,4 +49,4 @@ declare const main: citty0.CommandDef<{
49
49
  };
50
50
  }>;
51
51
  //#endregion
52
- export { main as main$1 };
52
+ export { main };
package/dist/main.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import { t as main } from "./main-CNUdQYlu.mjs";
2
+
3
+ export { main };
@@ -1,5 +1,4 @@
1
- import { main } from "./main-Gw3X5n3V.js";
2
- import "./layer-CgUaXN1I.js";
1
+ import { t as main } from "./main-CNUdQYlu.mjs";
3
2
  import { runMain } from "citty";
4
3
 
5
4
  //#region src/run.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kimesh",
3
- "version": "0.2.40",
3
+ "version": "0.2.41",
4
4
  "description": "Create a new Kimesh project",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,12 +14,12 @@
14
14
  "bin"
15
15
  ],
16
16
  "type": "module",
17
- "main": "./dist/index.js",
18
- "types": "./dist/index.d.ts",
17
+ "main": "./dist/index.mjs",
18
+ "types": "./dist/index.d.mts",
19
19
  "exports": {
20
20
  ".": {
21
- "types": "./dist/index.d.ts",
22
- "import": "./dist/index.js"
21
+ "types": "./dist/index.d.mts",
22
+ "import": "./dist/index.mjs"
23
23
  }
24
24
  },
25
25
  "scripts": {
@@ -32,15 +32,15 @@
32
32
  "citty": "^0.1.6",
33
33
  "giget": "^2.0.0",
34
34
  "magicast": "^0.3.5",
35
- "nypm": "^0.6.0",
36
- "ofetch": "^1.4.1",
35
+ "nypm": "^0.6.5",
36
+ "ofetch": "^1.5.1",
37
37
  "picocolors": "^1.1.1",
38
38
  "tinyexec": "^0.3.2",
39
- "yaml": "^2.7.0"
39
+ "yaml": "^2.8.2"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/node": "^22.13.1",
43
- "tsdown": "^0.11.7",
44
- "typescript": "^5.8.2"
42
+ "@types/node": "^25.3.0",
43
+ "tsdown": "^0.20.3",
44
+ "typescript": "^5.9.3"
45
45
  }
46
46
  }
package/dist/index.js DELETED
@@ -1,4 +0,0 @@
1
- import { AVAILABLE_MODULES, addLayerToHost, canUpdateHost, collectPackages, detectMonorepoRoot, detectPreferredPackageManager, downloadProjectTemplate, fetchAllTemplates, fetchTemplate, findHostApps, generateModuleFiles, getDefaultTemplateName, getInstallSummary, getModule, getModuleDisplayHint, getModuleIds, getRecommendedLayerDir, getTemplateNames, getTemplateSource, hasUnmetDependencies, initGitRepo, installDependencies, installModules, installNpmPackages, isInWorkspace, isValidModuleId, isValidTemplateName, main, parseModulesArg, promptDirectoryConflict, promptGitInit, promptHostAppSelection, promptInstallDeps, promptLayerDirectory, promptLayerName, promptModuleSelection, promptNewDirectoryName, promptNpmScope, promptPackageManager, promptProjectName, promptProjectType, promptTemplateSelection, promptUpdateHost, resolveModules, updateKimeshConfig, validateProjectName } from "./main-Gw3X5n3V.js";
2
- import { DEFAULT_KIMESH_VERSION, generatePackageName, toPascalCase, transformTemplateToLayer, validateLayerName } from "./layer-CgUaXN1I.js";
3
-
4
- export { AVAILABLE_MODULES, DEFAULT_KIMESH_VERSION, addLayerToHost, canUpdateHost, collectPackages, detectMonorepoRoot, detectPreferredPackageManager, downloadProjectTemplate, fetchAllTemplates, fetchTemplate, findHostApps, generateModuleFiles, generatePackageName, getDefaultTemplateName, getInstallSummary, getModule, getModuleDisplayHint, getModuleIds, getRecommendedLayerDir, getTemplateNames, getTemplateSource, hasUnmetDependencies, initGitRepo, installDependencies, installModules, installNpmPackages, isInWorkspace, isValidModuleId, isValidTemplateName, main, parseModulesArg, promptDirectoryConflict, promptGitInit, promptHostAppSelection, promptInstallDeps, promptLayerDirectory, promptLayerName, promptModuleSelection, promptNewDirectoryName, promptNpmScope, promptPackageManager, promptProjectName, promptProjectType, promptTemplateSelection, promptUpdateHost, resolveModules, toPascalCase, transformTemplateToLayer, updateKimeshConfig, validateLayerName, validateProjectName };
@@ -1,3 +0,0 @@
1
- import { DEFAULT_KIMESH_VERSION, generatePackageName, toPascalCase, transformTemplateToLayer, validateLayerName } from "./layer-CgUaXN1I.js";
2
-
3
- export { validateLayerName };
package/dist/main.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { main$1 as main } from "./main-DnvYiSHH.js";
2
- export { main };
package/dist/main.js DELETED
@@ -1,4 +0,0 @@
1
- import { main } from "./main-Gw3X5n3V.js";
2
- import "./layer-CgUaXN1I.js";
3
-
4
- export { main };
File without changes