shadcn-svelte 0.4.0 → 0.4.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 +19 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6126,13 +6126,6 @@ var add = new Command().command("add").description("add components to your proje
|
|
|
6126
6126
|
process.cwd()
|
|
6127
6127
|
).option("-p, --path <path>", "the path to add the component to.").action(async (components, opts) => {
|
|
6128
6128
|
const highlight = logger.highlight;
|
|
6129
|
-
logger.warn(
|
|
6130
|
-
"Running the following command will overwrite existing files."
|
|
6131
|
-
);
|
|
6132
|
-
logger.warn(
|
|
6133
|
-
"Make sure you have committed your changes before proceeding."
|
|
6134
|
-
);
|
|
6135
|
-
logger.warn("");
|
|
6136
6129
|
try {
|
|
6137
6130
|
const options = addOptionsSchema.parse({
|
|
6138
6131
|
components,
|
|
@@ -6214,6 +6207,7 @@ ${highlight(selectedComponents)}`
|
|
|
6214
6207
|
}
|
|
6215
6208
|
const spinner = ora(`Installing components...`).start();
|
|
6216
6209
|
let skippedDeps = /* @__PURE__ */ new Set();
|
|
6210
|
+
let componentPaths = [];
|
|
6217
6211
|
for (const item2 of payload) {
|
|
6218
6212
|
spinner.text = `Installing ${item2.name}...`;
|
|
6219
6213
|
const targetDir = await getItemTargetPath(
|
|
@@ -6227,6 +6221,10 @@ ${highlight(selectedComponents)}`
|
|
|
6227
6221
|
if (!existsSync3(targetDir)) {
|
|
6228
6222
|
await fs2.mkdir(targetDir, { recursive: true });
|
|
6229
6223
|
}
|
|
6224
|
+
const componentPath = path4.relative(
|
|
6225
|
+
process.cwd(),
|
|
6226
|
+
path4.resolve(targetDir, item2.name)
|
|
6227
|
+
);
|
|
6230
6228
|
const existingComponent = item2.files.filter(
|
|
6231
6229
|
(file) => existsSync3(path4.resolve(targetDir, item2.name, file.name))
|
|
6232
6230
|
);
|
|
@@ -6234,9 +6232,11 @@ ${highlight(selectedComponents)}`
|
|
|
6234
6232
|
if (selectedComponents.includes(item2.name)) {
|
|
6235
6233
|
logger.warn(
|
|
6236
6234
|
`
|
|
6237
|
-
Component ${
|
|
6238
|
-
|
|
6239
|
-
)}
|
|
6235
|
+
Component ${highlight(
|
|
6236
|
+
item2.name
|
|
6237
|
+
)} already exists at ${highlight(
|
|
6238
|
+
componentPath
|
|
6239
|
+
)}. Use ${chalk2.green("--overwrite")} to overwrite.`
|
|
6240
6240
|
);
|
|
6241
6241
|
spinner.stop();
|
|
6242
6242
|
process.exitCode = 1;
|
|
@@ -6276,6 +6276,7 @@ Component ${item2.name} already exists. Use ${chalk2.green(
|
|
|
6276
6276
|
}
|
|
6277
6277
|
);
|
|
6278
6278
|
}
|
|
6279
|
+
componentPaths.push(componentPath);
|
|
6279
6280
|
}
|
|
6280
6281
|
logger.info("");
|
|
6281
6282
|
logger.info("");
|
|
@@ -6288,6 +6289,12 @@ Component ${item2.name} already exists. Use ${chalk2.green(
|
|
|
6288
6289
|
);
|
|
6289
6290
|
}
|
|
6290
6291
|
spinner.succeed(`Done.`);
|
|
6292
|
+
logger.info(
|
|
6293
|
+
`Components installed at:
|
|
6294
|
+
- ${[...componentPaths].join(
|
|
6295
|
+
"\n- "
|
|
6296
|
+
)}`
|
|
6297
|
+
);
|
|
6291
6298
|
} catch (error) {
|
|
6292
6299
|
handleError(error);
|
|
6293
6300
|
}
|
|
@@ -6629,7 +6636,8 @@ async function runInit(cwd, config) {
|
|
|
6629
6636
|
".js",
|
|
6630
6637
|
".cjs"
|
|
6631
6638
|
);
|
|
6632
|
-
|
|
6639
|
+
if (cjsConfig.endsWith(".cjs"))
|
|
6640
|
+
await fs3.unlink(cjsConfig).catch((e) => e);
|
|
6633
6641
|
const baseColor = await getRegistryBaseColor(config.tailwind.baseColor);
|
|
6634
6642
|
if (baseColor) {
|
|
6635
6643
|
await fs3.writeFile(
|