shadcn-svelte 0.4.1 → 0.5.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.
- package/dist/index.js +42 -15
- 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
|
}
|
|
@@ -6730,9 +6737,16 @@ var update = new Command3().command("update").description("update components in
|
|
|
6730
6737
|
const component = registryIndex.find(
|
|
6731
6738
|
(comp) => comp.name === file.name
|
|
6732
6739
|
);
|
|
6733
|
-
|
|
6740
|
+
if (component) {
|
|
6741
|
+
existingComponents.push(component);
|
|
6742
|
+
}
|
|
6734
6743
|
}
|
|
6735
6744
|
}
|
|
6745
|
+
existingComponents.push({
|
|
6746
|
+
name: "utils",
|
|
6747
|
+
type: "components:ui",
|
|
6748
|
+
files: []
|
|
6749
|
+
});
|
|
6736
6750
|
let selectedComponents = options.all ? existingComponents : [];
|
|
6737
6751
|
if (!selectedComponents.length && components !== void 0) {
|
|
6738
6752
|
selectedComponents = existingComponents.filter(
|
|
@@ -6752,19 +6766,32 @@ var update = new Command3().command("update").description("update components in
|
|
|
6752
6766
|
"Which component(s) would you like to update?"
|
|
6753
6767
|
);
|
|
6754
6768
|
}
|
|
6769
|
+
const spinner = ora3(
|
|
6770
|
+
`Updating ${selectedComponents.length} component(s) and dependencies...`
|
|
6771
|
+
).start();
|
|
6755
6772
|
if (selectedComponents.length === 0) {
|
|
6756
|
-
|
|
6773
|
+
spinner.info("No components selected. Nothing to update.");
|
|
6757
6774
|
process.exitCode = 0;
|
|
6758
6775
|
return;
|
|
6759
6776
|
}
|
|
6777
|
+
if (selectedComponents.find((item2) => item2.name === "utils")) {
|
|
6778
|
+
const utilsPath = config.resolvedPaths.utils + ".ts";
|
|
6779
|
+
if (!existsSync5(utilsPath)) {
|
|
6780
|
+
spinner.fail(
|
|
6781
|
+
`utils at ${logger.highlight(
|
|
6782
|
+
utilsPath
|
|
6783
|
+
)} does not exist.`
|
|
6784
|
+
);
|
|
6785
|
+
process.exitCode = 1;
|
|
6786
|
+
return;
|
|
6787
|
+
}
|
|
6788
|
+
await fs4.writeFile(utilsPath, UTILS);
|
|
6789
|
+
}
|
|
6760
6790
|
const tree = await resolveTree(
|
|
6761
6791
|
registryIndex,
|
|
6762
6792
|
selectedComponents.map((com) => com.name)
|
|
6763
6793
|
);
|
|
6764
6794
|
const payload = await fetchTree(config.style, tree);
|
|
6765
|
-
const spinner = ora3(
|
|
6766
|
-
`Updating ${selectedComponents.length} component(s) and dependencies...`
|
|
6767
|
-
).start();
|
|
6768
6795
|
for (const item2 of payload) {
|
|
6769
6796
|
spinner.text = `Updating ${item2.name}...`;
|
|
6770
6797
|
const targetDir = await getItemTargetPath(config, item2);
|