sigma-ui 1.1.1 → 1.1.2
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/dist/index.js +122 -132
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -8,22 +8,80 @@ import process6 from "node:process";
|
|
|
8
8
|
import { Command as Command4 } from "commander";
|
|
9
9
|
|
|
10
10
|
// src/commands/add.ts
|
|
11
|
-
import {
|
|
12
|
-
import { existsSync as existsSync2, promises as fs3 } from "node:fs";
|
|
11
|
+
import { existsSync as existsSync3, promises as fs3 } from "node:fs";
|
|
13
12
|
import process3 from "node:process";
|
|
14
|
-
import
|
|
13
|
+
import path5 from "pathe";
|
|
15
14
|
import { consola as consola3 } from "consola";
|
|
16
15
|
import { colors as colors2 } from "consola/utils";
|
|
17
16
|
import { Command } from "commander";
|
|
18
17
|
import ora from "ora";
|
|
19
18
|
import prompts from "prompts";
|
|
20
19
|
import { z as z2 } from "zod";
|
|
21
|
-
|
|
20
|
+
|
|
21
|
+
// src/utils/package-manager.ts
|
|
22
|
+
import { execSync } from "node:child_process";
|
|
23
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
24
|
+
import path from "pathe";
|
|
25
|
+
async function detectPackageManager(cwd) {
|
|
26
|
+
const lockFiles = [
|
|
27
|
+
{ name: "pnpm", files: ["pnpm-lock.yaml", "pnpm-workspace.yaml"] },
|
|
28
|
+
{ name: "yarn", files: ["yarn.lock"] },
|
|
29
|
+
{ name: "bun", files: ["bun.lockb"] },
|
|
30
|
+
{ name: "npm", files: ["package-lock.json"] }
|
|
31
|
+
];
|
|
32
|
+
for (const pm of lockFiles) {
|
|
33
|
+
for (const file of pm.files) {
|
|
34
|
+
if (existsSync(path.join(cwd, file))) {
|
|
35
|
+
return { name: pm.name };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const packageJsonPath = path.join(cwd, "package.json");
|
|
41
|
+
if (existsSync(packageJsonPath)) {
|
|
42
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
43
|
+
if (packageJson.packageManager) {
|
|
44
|
+
const [name, version] = packageJson.packageManager.split("@");
|
|
45
|
+
return { name, version };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
return { name: "pnpm" };
|
|
51
|
+
}
|
|
52
|
+
async function addDependency(dependencies, options8 = { cwd: process.cwd() }) {
|
|
53
|
+
await installPackages(dependencies, "dependencies", options8);
|
|
54
|
+
}
|
|
55
|
+
async function addDevDependency(dependencies, options8 = { cwd: process.cwd() }) {
|
|
56
|
+
await installPackages(dependencies, "devDependencies", options8);
|
|
57
|
+
}
|
|
58
|
+
async function installPackages(dependencies, type2, options8 = { cwd: process.cwd() }) {
|
|
59
|
+
const pm = await detectPackageManager(options8.cwd);
|
|
60
|
+
const devFlag = type2 === "devDependencies" ? "-D " : "";
|
|
61
|
+
let command = "";
|
|
62
|
+
switch (pm?.name) {
|
|
63
|
+
case "npm":
|
|
64
|
+
command = `npm install ${devFlag}${dependencies.join(" ")}`;
|
|
65
|
+
break;
|
|
66
|
+
case "yarn":
|
|
67
|
+
command = `yarn add ${devFlag}${dependencies.join(" ")}`;
|
|
68
|
+
break;
|
|
69
|
+
case "bun":
|
|
70
|
+
command = `bun add ${devFlag}${dependencies.join(" ")}`;
|
|
71
|
+
break;
|
|
72
|
+
case "pnpm":
|
|
73
|
+
default:
|
|
74
|
+
command = `pnpm add ${devFlag}${dependencies.join(" ")}`;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
const stdio = options8.silent ? "pipe" : "inherit";
|
|
78
|
+
execSync(command, { cwd: options8.cwd, stdio });
|
|
79
|
+
}
|
|
22
80
|
|
|
23
81
|
// src/utils/transformers/index.ts
|
|
24
82
|
import { promises as fs } from "node:fs";
|
|
25
83
|
import { tmpdir } from "node:os";
|
|
26
|
-
import
|
|
84
|
+
import path2 from "pathe";
|
|
27
85
|
import { Project, ScriptKind } from "ts-morph";
|
|
28
86
|
|
|
29
87
|
// src/utils/transformers/transform-import.ts
|
|
@@ -67,8 +125,8 @@ var project = new Project({
|
|
|
67
125
|
compilerOptions: {}
|
|
68
126
|
});
|
|
69
127
|
async function createTempSourceFile(filename) {
|
|
70
|
-
const dir = await fs.mkdtemp(
|
|
71
|
-
return
|
|
128
|
+
const dir = await fs.mkdtemp(path2.join(tmpdir(), "sigma-ui-"));
|
|
129
|
+
return path2.join(dir, filename);
|
|
72
130
|
}
|
|
73
131
|
async function transform(opts) {
|
|
74
132
|
const tempFile = await createTempSourceFile(opts.filename);
|
|
@@ -82,9 +140,9 @@ async function transform(opts) {
|
|
|
82
140
|
}
|
|
83
141
|
|
|
84
142
|
// src/utils/get-config.ts
|
|
85
|
-
import { existsSync } from "node:fs";
|
|
143
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
86
144
|
import process2 from "node:process";
|
|
87
|
-
import
|
|
145
|
+
import path3 from "pathe";
|
|
88
146
|
import { loadConfig as c12LoadConfig } from "c12";
|
|
89
147
|
import { loadConfig } from "tsconfig-paths";
|
|
90
148
|
import consola from "consola";
|
|
@@ -238,14 +296,14 @@ async function handleConfigIsMissing() {
|
|
|
238
296
|
}
|
|
239
297
|
async function resolveConfigPaths(cwd, config) {
|
|
240
298
|
let tsConfig;
|
|
241
|
-
let tsConfigPath =
|
|
299
|
+
let tsConfigPath = path3.resolve(
|
|
242
300
|
cwd,
|
|
243
301
|
config.tsConfigPath
|
|
244
302
|
);
|
|
245
303
|
tsConfig = loadConfig(tsConfigPath);
|
|
246
304
|
if ("paths" in tsConfig && Object.keys(tsConfig.paths).length === 0) {
|
|
247
|
-
tsConfigPath =
|
|
248
|
-
if (
|
|
305
|
+
tsConfigPath = path3.resolve(cwd, "./tsconfig.app.json");
|
|
306
|
+
if (existsSync2(tsConfigPath)) {
|
|
249
307
|
tsConfig = loadConfig(tsConfigPath);
|
|
250
308
|
}
|
|
251
309
|
}
|
|
@@ -257,8 +315,8 @@ async function resolveConfigPaths(cwd, config) {
|
|
|
257
315
|
return configSchema.parse({
|
|
258
316
|
...config,
|
|
259
317
|
resolvedPaths: {
|
|
260
|
-
tailwindConfig:
|
|
261
|
-
tailwindCss:
|
|
318
|
+
tailwindConfig: path3.resolve(cwd, config.tailwind.config),
|
|
319
|
+
tailwindCss: path3.resolve(cwd, config.cssPath),
|
|
262
320
|
utils: resolveImport(config.aliases.utils, tsConfig),
|
|
263
321
|
components: resolveImport(config.aliases.components, tsConfig)
|
|
264
322
|
}
|
|
@@ -297,7 +355,7 @@ function handleError(error) {
|
|
|
297
355
|
|
|
298
356
|
// src/utils/registry/index.ts
|
|
299
357
|
import fs2 from "node:fs";
|
|
300
|
-
import
|
|
358
|
+
import path4 from "pathe";
|
|
301
359
|
|
|
302
360
|
// ../../apps/docs/src/lib/registry/themes.ts
|
|
303
361
|
var themes = [
|
|
@@ -756,7 +814,7 @@ function getItemTargetPath(config, item, override) {
|
|
|
756
814
|
if (!(parent in config.resolvedPaths)) {
|
|
757
815
|
return null;
|
|
758
816
|
}
|
|
759
|
-
return
|
|
817
|
+
return path4.join(
|
|
760
818
|
config.resolvedPaths[parent] ?? "",
|
|
761
819
|
type2
|
|
762
820
|
);
|
|
@@ -818,8 +876,8 @@ function parseOptions(components, opts) {
|
|
|
818
876
|
});
|
|
819
877
|
}
|
|
820
878
|
function validateAndResolveCwd(cwd) {
|
|
821
|
-
const resolvedCwd =
|
|
822
|
-
if (!
|
|
879
|
+
const resolvedCwd = path5.resolve(cwd);
|
|
880
|
+
if (!existsSync3(resolvedCwd)) {
|
|
823
881
|
consola3.error(`The path ${resolvedCwd} does not exist. Try again.`);
|
|
824
882
|
process3.exit(1);
|
|
825
883
|
}
|
|
@@ -880,7 +938,7 @@ async function processPayload(payload, options8, config, baseColor, cwd, selecte
|
|
|
880
938
|
const targetDir = getItemTargetPath(
|
|
881
939
|
config,
|
|
882
940
|
item,
|
|
883
|
-
options8.path ?
|
|
941
|
+
options8.path ? path5.resolve(cwd, options8.path) : void 0
|
|
884
942
|
);
|
|
885
943
|
if (!targetDir) {
|
|
886
944
|
continue;
|
|
@@ -891,12 +949,12 @@ async function processPayload(payload, options8, config, baseColor, cwd, selecte
|
|
|
891
949
|
}
|
|
892
950
|
async function processItem(item, targetDir, options8, config, baseColor, cwd, selectedComponents, spinner) {
|
|
893
951
|
try {
|
|
894
|
-
if (!
|
|
952
|
+
if (!existsSync3(targetDir)) {
|
|
895
953
|
await fs3.mkdir(targetDir, { recursive: true });
|
|
896
954
|
}
|
|
897
|
-
const componentPath =
|
|
955
|
+
const componentPath = path5.resolve(targetDir, item.name);
|
|
898
956
|
const existingComponent = item.files.filter(
|
|
899
|
-
(file) =>
|
|
957
|
+
(file) => existsSync3(path5.resolve(componentPath, file.name))
|
|
900
958
|
);
|
|
901
959
|
if (existingComponent.length && !options8.overwrite) {
|
|
902
960
|
if (selectedComponents.includes(item.name)) {
|
|
@@ -936,62 +994,25 @@ async function installDependencies(item, cwd) {
|
|
|
936
994
|
].filter(Boolean);
|
|
937
995
|
for (const task of installTasks) {
|
|
938
996
|
try {
|
|
939
|
-
consola3.info(`
|
|
997
|
+
consola3.info(`Installing ${task.type}: ${task.deps.join(", ")}`);
|
|
940
998
|
await task.installer(task.deps, { cwd });
|
|
941
|
-
consola3.success(`Successfully installed ${task.type}
|
|
999
|
+
consola3.success(`Successfully installed ${task.type}.`);
|
|
942
1000
|
} catch (error) {
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
let command = "";
|
|
949
|
-
const depsString = task.deps.join(" ");
|
|
950
|
-
const devFlag = task.type === "devDependencies" ? "-D " : "";
|
|
951
|
-
switch (pm?.name) {
|
|
952
|
-
case "npm":
|
|
953
|
-
command = `npm install ${devFlag}${depsString}`;
|
|
954
|
-
break;
|
|
955
|
-
case "yarn":
|
|
956
|
-
command = `yarn add ${devFlag}${depsString}`;
|
|
957
|
-
break;
|
|
958
|
-
case "bun":
|
|
959
|
-
command = `bun add ${devFlag}${depsString}`;
|
|
960
|
-
break;
|
|
961
|
-
case "pnpm":
|
|
962
|
-
default:
|
|
963
|
-
command = `pnpm add ${devFlag}${depsString}`;
|
|
964
|
-
break;
|
|
965
|
-
}
|
|
966
|
-
try {
|
|
967
|
-
consola3.info(`Running: ${command}`);
|
|
968
|
-
execSync(command, { cwd, stdio: "inherit" });
|
|
969
|
-
consola3.success(`Successfully installed ${task.type} using direct pnpm execution.`);
|
|
970
|
-
} catch (fallbackError) {
|
|
971
|
-
const errorMessage = fallbackError instanceof Error ? fallbackError.message : "Unknown error";
|
|
972
|
-
consola3.error(`Fallback pnpm execution failed for ${task.type}:`, errorMessage);
|
|
973
|
-
throw new ComponentInstallError(
|
|
974
|
-
`Failed to install ${task.type} (nypm and fallback failed): ${errorMessage}`,
|
|
975
|
-
item.name
|
|
976
|
-
);
|
|
977
|
-
}
|
|
978
|
-
} else {
|
|
979
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
980
|
-
throw new ComponentInstallError(
|
|
981
|
-
`Failed to install ${task.type} using nypm: ${errorMessage}`,
|
|
982
|
-
item.name
|
|
983
|
-
);
|
|
984
|
-
}
|
|
1001
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
1002
|
+
throw new ComponentInstallError(
|
|
1003
|
+
`Failed to install ${task.type}: ${errorMessage}`,
|
|
1004
|
+
item.name
|
|
1005
|
+
);
|
|
985
1006
|
}
|
|
986
1007
|
}
|
|
987
1008
|
}
|
|
988
1009
|
async function writeComponentFiles(item, componentDir, config, baseColor) {
|
|
989
|
-
if (!
|
|
1010
|
+
if (!existsSync3(componentDir)) {
|
|
990
1011
|
await fs3.mkdir(componentDir, { recursive: true });
|
|
991
1012
|
}
|
|
992
1013
|
const files = item.files.map((file) => ({
|
|
993
1014
|
...file,
|
|
994
|
-
path:
|
|
1015
|
+
path: path5.resolve(componentDir, file.name)
|
|
995
1016
|
}));
|
|
996
1017
|
for (const file of files) {
|
|
997
1018
|
const content = await transform({
|
|
@@ -1006,9 +1027,9 @@ async function writeComponentFiles(item, componentDir, config, baseColor) {
|
|
|
1006
1027
|
}
|
|
1007
1028
|
|
|
1008
1029
|
// src/commands/diff.ts
|
|
1009
|
-
import { existsSync as
|
|
1030
|
+
import { existsSync as existsSync4, promises as fs4 } from "node:fs";
|
|
1010
1031
|
import process4 from "node:process";
|
|
1011
|
-
import
|
|
1032
|
+
import path6 from "pathe";
|
|
1012
1033
|
import { consola as consola4 } from "consola";
|
|
1013
1034
|
import { colors as colors3 } from "consola/utils";
|
|
1014
1035
|
import { Command as Command2 } from "commander";
|
|
@@ -1039,8 +1060,8 @@ function parseOptions2(name, opts) {
|
|
|
1039
1060
|
});
|
|
1040
1061
|
}
|
|
1041
1062
|
function validateAndResolveCwd2(cwd) {
|
|
1042
|
-
const resolvedCwd =
|
|
1043
|
-
if (!
|
|
1063
|
+
const resolvedCwd = path6.resolve(cwd);
|
|
1064
|
+
if (!existsSync4(resolvedCwd)) {
|
|
1044
1065
|
consola4.error(`The path ${resolvedCwd} does not exist. Try again.`);
|
|
1045
1066
|
process4.exit(1);
|
|
1046
1067
|
}
|
|
@@ -1068,8 +1089,8 @@ async function handleAllComponentsDiff(config, registryIndex) {
|
|
|
1068
1089
|
function findProjectComponents(registryIndex, targetDir) {
|
|
1069
1090
|
return registryIndex.filter((item) => {
|
|
1070
1091
|
return item.files.some((file) => {
|
|
1071
|
-
const fullPath =
|
|
1072
|
-
return
|
|
1092
|
+
const fullPath = path6.resolve(targetDir, item.name, file);
|
|
1093
|
+
return existsSync4(fullPath);
|
|
1073
1094
|
});
|
|
1074
1095
|
});
|
|
1075
1096
|
}
|
|
@@ -1132,8 +1153,8 @@ async function diffComponent(component, config) {
|
|
|
1132
1153
|
}
|
|
1133
1154
|
async function processItemFiles(item, targetDir, config, baseColor, changes) {
|
|
1134
1155
|
for (const file of item.files) {
|
|
1135
|
-
const filePath =
|
|
1136
|
-
if (!
|
|
1156
|
+
const filePath = path6.resolve(targetDir, item.name, file.name);
|
|
1157
|
+
if (!existsSync4(filePath)) {
|
|
1137
1158
|
continue;
|
|
1138
1159
|
}
|
|
1139
1160
|
const fileContent = await fs4.readFile(filePath, "utf8");
|
|
@@ -1170,17 +1191,15 @@ function printDiff(diff3) {
|
|
|
1170
1191
|
}
|
|
1171
1192
|
|
|
1172
1193
|
// src/commands/init.ts
|
|
1173
|
-
import { existsSync as
|
|
1194
|
+
import { existsSync as existsSync6, promises as fs8 } from "node:fs";
|
|
1174
1195
|
import process5 from "node:process";
|
|
1175
1196
|
import path14 from "pathe";
|
|
1176
1197
|
import { Command as Command3 } from "commander";
|
|
1177
1198
|
import { template } from "lodash-es";
|
|
1178
1199
|
import ora2 from "ora";
|
|
1179
1200
|
import prompts2 from "prompts";
|
|
1180
|
-
import { addDependency as addDependency2, addDevDependency as addDevDependency2, detectPackageManager as detectPackageManager2 } from "nypm";
|
|
1181
1201
|
import { consola as consola5 } from "consola";
|
|
1182
1202
|
import { colors as colors4 } from "consola/utils";
|
|
1183
|
-
import { execSync as execSync2 } from "node:child_process";
|
|
1184
1203
|
|
|
1185
1204
|
// ../../node_modules/.pnpm/prettier@3.5.0/node_modules/prettier/index.mjs
|
|
1186
1205
|
import { createRequire as __prettierCreateRequire } from "module";
|
|
@@ -1195,13 +1214,13 @@ import path42 from "path";
|
|
|
1195
1214
|
import * as path32 from "path";
|
|
1196
1215
|
import fs5 from "fs/promises";
|
|
1197
1216
|
import path22 from "path";
|
|
1198
|
-
import * as
|
|
1217
|
+
import * as path7 from "path";
|
|
1199
1218
|
import path8 from "path";
|
|
1200
1219
|
import fs22 from "fs/promises";
|
|
1201
1220
|
import fs32 from "fs/promises";
|
|
1202
1221
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
1203
1222
|
import fs42 from "fs/promises";
|
|
1204
|
-
import
|
|
1223
|
+
import path72 from "path";
|
|
1205
1224
|
import { pathToFileURL as pathToFileURL4 } from "url";
|
|
1206
1225
|
import assert3 from "assert";
|
|
1207
1226
|
import { statSync, realpathSync } from "fs";
|
|
@@ -13700,15 +13719,15 @@ async function isDirectory(directory, options8) {
|
|
|
13700
13719
|
return stats.isDirectory();
|
|
13701
13720
|
}
|
|
13702
13721
|
var is_directory_default = isDirectory;
|
|
13703
|
-
var toAbsolutePath = (value) =>
|
|
13722
|
+
var toAbsolutePath = (value) => path7.resolve(toPath(value));
|
|
13704
13723
|
function* iterateDirectoryUp(from, to) {
|
|
13705
13724
|
from = toAbsolutePath(from);
|
|
13706
|
-
const { root: root2 } =
|
|
13725
|
+
const { root: root2 } = path7.parse(from);
|
|
13707
13726
|
to = to ? toAbsolutePath(to) : root2;
|
|
13708
13727
|
if (from !== to && !from.startsWith(to)) {
|
|
13709
13728
|
return;
|
|
13710
13729
|
}
|
|
13711
|
-
for (let directory = from; directory !== to; directory =
|
|
13730
|
+
for (let directory = from; directory !== to; directory = path7.dirname(directory)) {
|
|
13712
13731
|
yield directory;
|
|
13713
13732
|
}
|
|
13714
13733
|
yield to;
|
|
@@ -19062,7 +19081,7 @@ async function loadExternalConfig(externalConfig, configFile) {
|
|
|
19062
19081
|
}
|
|
19063
19082
|
var load_external_config_default = loadExternalConfig;
|
|
19064
19083
|
async function loadConfig2(configFile) {
|
|
19065
|
-
const { base: fileName, ext: extension } =
|
|
19084
|
+
const { base: fileName, ext: extension } = path72.parse(configFile);
|
|
19066
19085
|
const load2 = fileName === "package.json" ? loadConfigFromPackageJson : fileName === "package.yaml" ? loadConfigFromPackageYaml : loaders_default[extension];
|
|
19067
19086
|
if (!load2) {
|
|
19068
19087
|
throw new Error(
|
|
@@ -24085,7 +24104,7 @@ var src_default = index_exports;
|
|
|
24085
24104
|
import { Project as Project2, SyntaxKind as SyntaxKind2 } from "ts-morph";
|
|
24086
24105
|
|
|
24087
24106
|
// src/utils/get-project-info.ts
|
|
24088
|
-
import { existsSync as
|
|
24107
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
24089
24108
|
import path13 from "pathe";
|
|
24090
24109
|
import fs7 from "fs-extra";
|
|
24091
24110
|
import { readPackageJSON } from "pkg-types";
|
|
@@ -24101,16 +24120,16 @@ async function getProjectInfo() {
|
|
|
24101
24120
|
};
|
|
24102
24121
|
try {
|
|
24103
24122
|
const tsconfig = await getTsConfig();
|
|
24104
|
-
const isNuxt =
|
|
24123
|
+
const isNuxt = existsSync5(path13.resolve("./nuxt.config.js")) || existsSync5(path13.resolve("./nuxt.config.ts"));
|
|
24105
24124
|
const sigmaUiNuxtModuleInfo = isNuxt ? await getSigmaUiNuxtInfo() : void 0;
|
|
24106
24125
|
return {
|
|
24107
24126
|
tsconfig,
|
|
24108
24127
|
isNuxt,
|
|
24109
24128
|
sigmaUiNuxtModuleInfo,
|
|
24110
|
-
isVueVite:
|
|
24111
|
-
srcDir:
|
|
24112
|
-
srcComponentsUiDir:
|
|
24113
|
-
componentsUiDir:
|
|
24129
|
+
isVueVite: existsSync5(path13.resolve("./vite.config.js")) || existsSync5(path13.resolve("./vite.config.ts")),
|
|
24130
|
+
srcDir: existsSync5(path13.resolve("./src")),
|
|
24131
|
+
srcComponentsUiDir: existsSync5(path13.resolve("./src/components/ui")),
|
|
24132
|
+
componentsUiDir: existsSync5(path13.resolve("./components/ui"))
|
|
24114
24133
|
};
|
|
24115
24134
|
} catch (error) {
|
|
24116
24135
|
console.log(error);
|
|
@@ -24743,7 +24762,7 @@ var init = new Command3().name("init").description("initialize your project and
|
|
|
24743
24762
|
const spinner = ora2("Fetching data...").start();
|
|
24744
24763
|
const options8 = initOptionsSchema.parse(opts);
|
|
24745
24764
|
const cwd = path14.resolve(options8.cwd);
|
|
24746
|
-
if (!
|
|
24765
|
+
if (!existsSync6(cwd)) {
|
|
24747
24766
|
consola5.error(`The path ${cwd} does not exist. Please try again.`);
|
|
24748
24767
|
process5.exit(1);
|
|
24749
24768
|
}
|
|
@@ -24899,7 +24918,11 @@ async function handleNuxtProject() {
|
|
|
24899
24918
|
const { isNuxt, sigmaUiNuxtModuleInfo } = await getProjectInfo();
|
|
24900
24919
|
if (isNuxt) {
|
|
24901
24920
|
consola5.log("");
|
|
24902
|
-
|
|
24921
|
+
if (sigmaUiNuxtModuleInfo) {
|
|
24922
|
+
consola5.info(`Detected a Nuxt project with 'sigma-ui-nuxt' v${sigmaUiNuxtModuleInfo.version}`);
|
|
24923
|
+
} else {
|
|
24924
|
+
consola5.warn(`Detected a Nuxt project without 'sigma-ui-nuxt' module. It's recommended to install it.`);
|
|
24925
|
+
}
|
|
24903
24926
|
}
|
|
24904
24927
|
}
|
|
24905
24928
|
async function runInit(cwd, config) {
|
|
@@ -25000,50 +25023,17 @@ async function installDependencies2(config, cwd) {
|
|
|
25000
25023
|
const deps = [...baseDeps, ...PROJECT_DEPENDENCIES.sharedBase].filter(Boolean);
|
|
25001
25024
|
const devDeps = baseDevDeps.filter(Boolean);
|
|
25002
25025
|
const installTasks = [
|
|
25003
|
-
config.framework === "nuxt" && PROJECT_DEPENDENCIES.nuxt.length && { type: "devDependencies", deps: PROJECT_DEPENDENCIES.nuxt, installer:
|
|
25004
|
-
deps.length && { type: "dependencies", deps, installer:
|
|
25005
|
-
devDeps.length && { type: "devDependencies", deps: devDeps, installer:
|
|
25026
|
+
config.framework === "nuxt" && PROJECT_DEPENDENCIES.nuxt.length && { type: "devDependencies", deps: PROJECT_DEPENDENCIES.nuxt, installer: addDevDependency },
|
|
25027
|
+
deps.length && { type: "dependencies", deps, installer: addDependency },
|
|
25028
|
+
devDeps.length && { type: "devDependencies", deps: devDeps, installer: addDevDependency }
|
|
25006
25029
|
].filter(Boolean);
|
|
25007
25030
|
for (const task of installTasks) {
|
|
25008
25031
|
try {
|
|
25009
25032
|
dependenciesSpinner.text = `Installing ${task.type}...`;
|
|
25010
25033
|
await task.installer(task.deps, { cwd, silent: true });
|
|
25011
25034
|
} catch (error) {
|
|
25012
|
-
|
|
25013
|
-
|
|
25014
|
-
if (isCorepackError) {
|
|
25015
|
-
consola5.info(`Falling back to direct package manager execution for ${task.type}...`);
|
|
25016
|
-
const pm = await detectPackageManager2(cwd);
|
|
25017
|
-
let command = "";
|
|
25018
|
-
const depsString = task.deps.join(" ");
|
|
25019
|
-
const devFlag = task.type === "devDependencies" ? "-D " : "";
|
|
25020
|
-
switch (pm?.name) {
|
|
25021
|
-
case "npm":
|
|
25022
|
-
command = `npm install ${devFlag}${depsString}`;
|
|
25023
|
-
break;
|
|
25024
|
-
case "yarn":
|
|
25025
|
-
command = `yarn add ${devFlag}${depsString}`;
|
|
25026
|
-
break;
|
|
25027
|
-
case "bun":
|
|
25028
|
-
command = `bun add ${devFlag}${depsString}`;
|
|
25029
|
-
break;
|
|
25030
|
-
case "pnpm":
|
|
25031
|
-
default:
|
|
25032
|
-
command = `pnpm add ${devFlag}${depsString}`;
|
|
25033
|
-
break;
|
|
25034
|
-
}
|
|
25035
|
-
try {
|
|
25036
|
-
consola5.info(`Running: ${command}`);
|
|
25037
|
-
execSync2(command, { cwd, stdio: "inherit" });
|
|
25038
|
-
consola5.success(`Successfully installed ${task.type} using direct package manager execution.`);
|
|
25039
|
-
} catch (fallbackError) {
|
|
25040
|
-
const errorMessage = fallbackError instanceof Error ? fallbackError.message : "Unknown error";
|
|
25041
|
-
consola5.error(`Fallback package manager execution failed for ${task.type}:`, errorMessage);
|
|
25042
|
-
}
|
|
25043
|
-
} else {
|
|
25044
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
25045
|
-
consola5.error(`Failed to install ${task.type} using nypm: ${errorMessage}`);
|
|
25046
|
-
}
|
|
25035
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
25036
|
+
consola5.error(`Failed to install ${task.type}: ${errorMessage}`);
|
|
25047
25037
|
}
|
|
25048
25038
|
}
|
|
25049
25039
|
dependenciesSpinner?.succeed();
|
|
@@ -25075,7 +25065,7 @@ async function getDirectoryPath(key2, resolvedPath) {
|
|
|
25075
25065
|
}
|
|
25076
25066
|
async function updateViteConfig() {
|
|
25077
25067
|
const viteConfigPath = path14.join(process5.cwd(), "vite.config.ts");
|
|
25078
|
-
if (!
|
|
25068
|
+
if (!existsSync6(viteConfigPath)) {
|
|
25079
25069
|
consola5.warn(`Vite config file not found at ${viteConfigPath}`);
|
|
25080
25070
|
return;
|
|
25081
25071
|
}
|