benflux-ui 0.1.3 → 0.1.4

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.
@@ -70,6 +70,9 @@ async function hasTailwind(cwd) {
70
70
  const version = await detectTailwindVersion(cwd);
71
71
  return version !== null;
72
72
  }
73
+ async function hasSrcDir(cwd) {
74
+ return import_fs_extra.default.pathExists(import_path.default.join(cwd, "src"));
75
+ }
73
76
  async function getComponentsPath(cwd) {
74
77
  const candidates = [
75
78
  "src/components/ui",
@@ -83,11 +86,8 @@ async function getComponentsPath(cwd) {
83
86
  return candidate;
84
87
  }
85
88
  }
86
- const framework = await detectFramework(cwd);
87
- if (framework === "next") {
88
- return "src/components/ui";
89
- }
90
- return "src/components/ui";
89
+ const useSrc = await hasSrcDir(cwd);
90
+ return useSrc ? "src/components/ui" : "components/ui";
91
91
  }
92
92
 
93
93
  // src/commands/init.ts
@@ -97,6 +97,7 @@ async function initCommand(options) {
97
97
  const framework = await detectFramework(cwd);
98
98
  const pm = await detectPackageManager(cwd);
99
99
  const hasTw = await hasTailwind(cwd);
100
+ const useSrc = await hasSrcDir(cwd);
100
101
  const defaultPath = await getComponentsPath(cwd);
101
102
  clack.note(
102
103
  [
@@ -149,25 +150,28 @@ async function initCommand(options) {
149
150
  const componentsPath = import_path2.default.join(cwd, settings.componentsDir);
150
151
  await import_fs_extra2.default.ensureDir(componentsPath);
151
152
  spinner3.stop(`Components directory: ${import_picocolors.default.cyan(settings.componentsDir)}`);
153
+ const libDir = useSrc ? "src/lib" : "lib";
154
+ const globalsCss = useSrc ? "src/app/globals.css" : "app/globals.css";
155
+ const componentsAlias = `@/${settings.componentsDir.replace(/^src\//, "")}`;
152
156
  spinner3.start("Creating benflux-ui.json config...");
153
157
  const config = {
154
158
  $schema: "https://benflux-ui.vercel.app/schema.json",
155
159
  style: "default",
156
160
  typescript: settings.typescript,
157
161
  tailwind: {
158
- config: hasTw ? "tailwind.config.ts" : "tailwind.config.ts",
159
- css: "src/app/globals.css",
162
+ config: "tailwind.config.ts",
163
+ css: globalsCss,
160
164
  baseColor: "default"
161
165
  },
162
166
  aliases: {
163
- components: `@/${settings.componentsDir.replace("src/", "")}`,
167
+ components: componentsAlias,
164
168
  utils: "@/lib/utils"
165
169
  }
166
170
  };
167
171
  await import_fs_extra2.default.writeJson(import_path2.default.join(cwd, "benflux-ui.json"), config, { spaces: 2 });
168
172
  spinner3.stop("benflux-ui.json created");
169
173
  spinner3.start("Creating utility functions...");
170
- const utilsDir = import_path2.default.join(cwd, "src/lib");
174
+ const utilsDir = import_path2.default.join(cwd, libDir);
171
175
  await import_fs_extra2.default.ensureDir(utilsDir);
172
176
  await import_fs_extra2.default.writeFile(
173
177
  import_path2.default.join(utilsDir, "utils.ts"),
@@ -179,7 +183,7 @@ export function cn(...inputs: ClassValue[]) {
179
183
  }
180
184
  `
181
185
  );
182
- spinner3.stop("lib/utils.ts created");
186
+ spinner3.stop(`${libDir}/utils.ts created`);
183
187
  if (settings.installDeps) {
184
188
  spinner3.start(`Installing core dependencies with ${pm}...`);
185
189
  try {
@@ -209,11 +213,11 @@ export function cn(...inputs: ClassValue[]) {
209
213
  }
210
214
 
211
215
  // src/commands/add.ts
212
- var import_path3 = __toESM(require("path"));
213
216
  var clack2 = __toESM(require("@clack/prompts"));
214
- var import_picocolors2 = __toESM(require("picocolors"));
215
- var import_fs_extra3 = __toESM(require("fs-extra"));
216
217
  var import_execa2 = require("execa");
218
+ var import_fs_extra3 = __toESM(require("fs-extra"));
219
+ var import_path3 = __toESM(require("path"));
220
+ var import_picocolors2 = __toESM(require("picocolors"));
217
221
 
218
222
  // src/utils/registry.ts
219
223
  var REGISTRY = [
@@ -828,7 +832,7 @@ async function addCommand(components, options) {
828
832
  (a, b) => a.category === b.category ? a.name.localeCompare(b.name) : a.category.localeCompare(b.category)
829
833
  );
830
834
  const selected = await clack2.multiselect({
831
- message: "Which components would you like to add?",
835
+ message: "Which components would you like to add? \u2191\u2193 navigate \xB7 Space select \xB7 Enter confirm",
832
836
  options: sorted.map((c) => ({
833
837
  label: c.name,
834
838
  hint: `${categoryLabel[c.category] ?? c.category} \u2014 ${c.description}`,
@@ -844,7 +848,9 @@ async function addCommand(components, options) {
844
848
  const validComponents = selectedComponents.map((name) => {
845
849
  const component = getComponent(name);
846
850
  if (!component) {
847
- clack2.log.warn(`Component ${import_picocolors2.default.yellow(name)} not found. Use ${import_picocolors2.default.cyan("benflux-ui list")} to see available components.`);
851
+ clack2.log.warn(
852
+ `Component ${import_picocolors2.default.yellow(name)} not found. Use ${import_picocolors2.default.cyan("benflux-ui list")} to see available components.`
853
+ );
848
854
  return null;
849
855
  }
850
856
  return component;
@@ -893,25 +899,26 @@ async function addCommand(components, options) {
893
899
  for (const file of component.files) {
894
900
  const targetPath = import_path3.default.join(cwd, defaultDir, import_path3.default.basename(file));
895
901
  if (await import_fs_extra3.default.pathExists(targetPath) && !options.overwrite) {
896
- spinner3.stop(`${import_picocolors2.default.yellow("skipped")} ${component.name} (already exists \u2014 use --overwrite to replace)`);
902
+ spinner3.stop(
903
+ `${import_picocolors2.default.yellow("skipped")} ${component.name} (already exists \u2014 use --overwrite to replace)`
904
+ );
897
905
  continue;
898
906
  }
899
- const sourcePath = import_path3.default.join(
900
- cwd,
901
- "node_modules/@benflux-ui/react/src",
902
- file
903
- );
904
- if (await import_fs_extra3.default.pathExists(sourcePath)) {
905
- await import_fs_extra3.default.ensureDir(import_path3.default.dirname(targetPath));
906
- await import_fs_extra3.default.copy(sourcePath, targetPath);
907
+ await import_fs_extra3.default.ensureDir(import_path3.default.dirname(targetPath));
908
+ const localSrc = import_path3.default.join(cwd, "node_modules/@benflux-ui/react/src", file);
909
+ if (await import_fs_extra3.default.pathExists(localSrc)) {
910
+ await import_fs_extra3.default.copy(localSrc, targetPath);
907
911
  } else {
908
- await import_fs_extra3.default.ensureDir(import_path3.default.dirname(targetPath));
909
- await import_fs_extra3.default.writeFile(
910
- targetPath,
911
- `// ${component.name} \u2014 Install @benflux-ui/react to get the full component
912
- export {} from "@benflux-ui/react"
913
- `
914
- );
912
+ const url = `https://unpkg.com/@benflux-ui/react@latest/src/${file}`;
913
+ try {
914
+ const res = await fetch(url);
915
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
916
+ const source = await res.text();
917
+ await import_fs_extra3.default.writeFile(targetPath, source, "utf-8");
918
+ } catch (err) {
919
+ spinner3.stop(import_picocolors2.default.red(`Failed to fetch ${file}: ${err.message}`));
920
+ clack2.log.warn(`Download manually from: ${url}`);
921
+ }
915
922
  }
916
923
  }
917
924
  spinner3.stop(`${import_picocolors2.default.green("\u2713")} Added ${component.name}`);
@@ -921,7 +928,11 @@ export {} from "@benflux-ui/react"
921
928
  import_picocolors2.default.green("\u2713") + " Components added successfully!",
922
929
  "",
923
930
  import_picocolors2.default.bold("Usage:"),
924
- ` ${import_picocolors2.default.cyan(`import { ${validComponents.map((c) => c?.name.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("")).join(", ")} } from "@benflux-ui/react"`)}`
931
+ ` ${import_picocolors2.default.cyan(
932
+ `import { ${validComponents.map(
933
+ (c) => c?.name.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("")
934
+ ).join(", ")} } from "@benflux-ui/react"`
935
+ )}`
925
936
  ].join("\n")
926
937
  );
927
938
  }
package/dist/index.js CHANGED
@@ -88,6 +88,9 @@ async function hasTailwind(cwd) {
88
88
  const version = await detectTailwindVersion(cwd);
89
89
  return version !== null;
90
90
  }
91
+ async function hasSrcDir(cwd) {
92
+ return import_fs_extra.default.pathExists(import_path.default.join(cwd, "src"));
93
+ }
91
94
  async function getComponentsPath(cwd) {
92
95
  const candidates = [
93
96
  "src/components/ui",
@@ -101,11 +104,8 @@ async function getComponentsPath(cwd) {
101
104
  return candidate;
102
105
  }
103
106
  }
104
- const framework = await detectFramework(cwd);
105
- if (framework === "next") {
106
- return "src/components/ui";
107
- }
108
- return "src/components/ui";
107
+ const useSrc = await hasSrcDir(cwd);
108
+ return useSrc ? "src/components/ui" : "components/ui";
109
109
  }
110
110
 
111
111
  // src/commands/init.ts
@@ -115,6 +115,7 @@ async function initCommand(options) {
115
115
  const framework = await detectFramework(cwd);
116
116
  const pm = await detectPackageManager(cwd);
117
117
  const hasTw = await hasTailwind(cwd);
118
+ const useSrc = await hasSrcDir(cwd);
118
119
  const defaultPath = await getComponentsPath(cwd);
119
120
  clack.note(
120
121
  [
@@ -167,25 +168,28 @@ async function initCommand(options) {
167
168
  const componentsPath = import_path2.default.join(cwd, settings.componentsDir);
168
169
  await import_fs_extra2.default.ensureDir(componentsPath);
169
170
  spinner3.stop(`Components directory: ${import_picocolors.default.cyan(settings.componentsDir)}`);
171
+ const libDir = useSrc ? "src/lib" : "lib";
172
+ const globalsCss = useSrc ? "src/app/globals.css" : "app/globals.css";
173
+ const componentsAlias = `@/${settings.componentsDir.replace(/^src\//, "")}`;
170
174
  spinner3.start("Creating benflux-ui.json config...");
171
175
  const config = {
172
176
  $schema: "https://benflux-ui.vercel.app/schema.json",
173
177
  style: "default",
174
178
  typescript: settings.typescript,
175
179
  tailwind: {
176
- config: hasTw ? "tailwind.config.ts" : "tailwind.config.ts",
177
- css: "src/app/globals.css",
180
+ config: "tailwind.config.ts",
181
+ css: globalsCss,
178
182
  baseColor: "default"
179
183
  },
180
184
  aliases: {
181
- components: `@/${settings.componentsDir.replace("src/", "")}`,
185
+ components: componentsAlias,
182
186
  utils: "@/lib/utils"
183
187
  }
184
188
  };
185
189
  await import_fs_extra2.default.writeJson(import_path2.default.join(cwd, "benflux-ui.json"), config, { spaces: 2 });
186
190
  spinner3.stop("benflux-ui.json created");
187
191
  spinner3.start("Creating utility functions...");
188
- const utilsDir = import_path2.default.join(cwd, "src/lib");
192
+ const utilsDir = import_path2.default.join(cwd, libDir);
189
193
  await import_fs_extra2.default.ensureDir(utilsDir);
190
194
  await import_fs_extra2.default.writeFile(
191
195
  import_path2.default.join(utilsDir, "utils.ts"),
@@ -197,7 +201,7 @@ export function cn(...inputs: ClassValue[]) {
197
201
  }
198
202
  `
199
203
  );
200
- spinner3.stop("lib/utils.ts created");
204
+ spinner3.stop(`${libDir}/utils.ts created`);
201
205
  if (settings.installDeps) {
202
206
  spinner3.start(`Installing core dependencies with ${pm}...`);
203
207
  try {
@@ -227,11 +231,11 @@ export function cn(...inputs: ClassValue[]) {
227
231
  }
228
232
 
229
233
  // src/commands/add.ts
230
- var import_path3 = __toESM(require("path"));
231
234
  var clack2 = __toESM(require("@clack/prompts"));
232
- var import_picocolors2 = __toESM(require("picocolors"));
233
- var import_fs_extra3 = __toESM(require("fs-extra"));
234
235
  var import_execa2 = require("execa");
236
+ var import_fs_extra3 = __toESM(require("fs-extra"));
237
+ var import_path3 = __toESM(require("path"));
238
+ var import_picocolors2 = __toESM(require("picocolors"));
235
239
 
236
240
  // src/utils/registry.ts
237
241
  var REGISTRY = [
@@ -855,7 +859,7 @@ async function addCommand(components, options) {
855
859
  (a, b) => a.category === b.category ? a.name.localeCompare(b.name) : a.category.localeCompare(b.category)
856
860
  );
857
861
  const selected = await clack2.multiselect({
858
- message: "Which components would you like to add?",
862
+ message: "Which components would you like to add? \u2191\u2193 navigate \xB7 Space select \xB7 Enter confirm",
859
863
  options: sorted.map((c) => ({
860
864
  label: c.name,
861
865
  hint: `${categoryLabel[c.category] ?? c.category} \u2014 ${c.description}`,
@@ -871,7 +875,9 @@ async function addCommand(components, options) {
871
875
  const validComponents = selectedComponents.map((name) => {
872
876
  const component = getComponent(name);
873
877
  if (!component) {
874
- clack2.log.warn(`Component ${import_picocolors2.default.yellow(name)} not found. Use ${import_picocolors2.default.cyan("benflux-ui list")} to see available components.`);
878
+ clack2.log.warn(
879
+ `Component ${import_picocolors2.default.yellow(name)} not found. Use ${import_picocolors2.default.cyan("benflux-ui list")} to see available components.`
880
+ );
875
881
  return null;
876
882
  }
877
883
  return component;
@@ -920,25 +926,26 @@ async function addCommand(components, options) {
920
926
  for (const file of component.files) {
921
927
  const targetPath = import_path3.default.join(cwd, defaultDir, import_path3.default.basename(file));
922
928
  if (await import_fs_extra3.default.pathExists(targetPath) && !options.overwrite) {
923
- spinner3.stop(`${import_picocolors2.default.yellow("skipped")} ${component.name} (already exists \u2014 use --overwrite to replace)`);
929
+ spinner3.stop(
930
+ `${import_picocolors2.default.yellow("skipped")} ${component.name} (already exists \u2014 use --overwrite to replace)`
931
+ );
924
932
  continue;
925
933
  }
926
- const sourcePath = import_path3.default.join(
927
- cwd,
928
- "node_modules/@benflux-ui/react/src",
929
- file
930
- );
931
- if (await import_fs_extra3.default.pathExists(sourcePath)) {
932
- await import_fs_extra3.default.ensureDir(import_path3.default.dirname(targetPath));
933
- await import_fs_extra3.default.copy(sourcePath, targetPath);
934
+ await import_fs_extra3.default.ensureDir(import_path3.default.dirname(targetPath));
935
+ const localSrc = import_path3.default.join(cwd, "node_modules/@benflux-ui/react/src", file);
936
+ if (await import_fs_extra3.default.pathExists(localSrc)) {
937
+ await import_fs_extra3.default.copy(localSrc, targetPath);
934
938
  } else {
935
- await import_fs_extra3.default.ensureDir(import_path3.default.dirname(targetPath));
936
- await import_fs_extra3.default.writeFile(
937
- targetPath,
938
- `// ${component.name} \u2014 Install @benflux-ui/react to get the full component
939
- export {} from "@benflux-ui/react"
940
- `
941
- );
939
+ const url = `https://unpkg.com/@benflux-ui/react@latest/src/${file}`;
940
+ try {
941
+ const res = await fetch(url);
942
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
943
+ const source = await res.text();
944
+ await import_fs_extra3.default.writeFile(targetPath, source, "utf-8");
945
+ } catch (err) {
946
+ spinner3.stop(import_picocolors2.default.red(`Failed to fetch ${file}: ${err.message}`));
947
+ clack2.log.warn(`Download manually from: ${url}`);
948
+ }
942
949
  }
943
950
  }
944
951
  spinner3.stop(`${import_picocolors2.default.green("\u2713")} Added ${component.name}`);
@@ -948,7 +955,11 @@ export {} from "@benflux-ui/react"
948
955
  import_picocolors2.default.green("\u2713") + " Components added successfully!",
949
956
  "",
950
957
  import_picocolors2.default.bold("Usage:"),
951
- ` ${import_picocolors2.default.cyan(`import { ${validComponents.map((c) => c?.name.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("")).join(", ")} } from "@benflux-ui/react"`)}`
958
+ ` ${import_picocolors2.default.cyan(
959
+ `import { ${validComponents.map(
960
+ (c) => c?.name.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("")
961
+ ).join(", ")} } from "@benflux-ui/react"`
962
+ )}`
952
963
  ].join("\n")
953
964
  );
954
965
  }
package/dist/index.mjs CHANGED
@@ -41,6 +41,9 @@ async function hasTailwind(cwd) {
41
41
  const version = await detectTailwindVersion(cwd);
42
42
  return version !== null;
43
43
  }
44
+ async function hasSrcDir(cwd) {
45
+ return fs.pathExists(path.join(cwd, "src"));
46
+ }
44
47
  async function getComponentsPath(cwd) {
45
48
  const candidates = [
46
49
  "src/components/ui",
@@ -54,11 +57,8 @@ async function getComponentsPath(cwd) {
54
57
  return candidate;
55
58
  }
56
59
  }
57
- const framework = await detectFramework(cwd);
58
- if (framework === "next") {
59
- return "src/components/ui";
60
- }
61
- return "src/components/ui";
60
+ const useSrc = await hasSrcDir(cwd);
61
+ return useSrc ? "src/components/ui" : "components/ui";
62
62
  }
63
63
 
64
64
  // src/commands/init.ts
@@ -68,6 +68,7 @@ async function initCommand(options) {
68
68
  const framework = await detectFramework(cwd);
69
69
  const pm = await detectPackageManager(cwd);
70
70
  const hasTw = await hasTailwind(cwd);
71
+ const useSrc = await hasSrcDir(cwd);
71
72
  const defaultPath = await getComponentsPath(cwd);
72
73
  clack.note(
73
74
  [
@@ -120,25 +121,28 @@ async function initCommand(options) {
120
121
  const componentsPath = path2.join(cwd, settings.componentsDir);
121
122
  await fs2.ensureDir(componentsPath);
122
123
  spinner3.stop(`Components directory: ${pc.cyan(settings.componentsDir)}`);
124
+ const libDir = useSrc ? "src/lib" : "lib";
125
+ const globalsCss = useSrc ? "src/app/globals.css" : "app/globals.css";
126
+ const componentsAlias = `@/${settings.componentsDir.replace(/^src\//, "")}`;
123
127
  spinner3.start("Creating benflux-ui.json config...");
124
128
  const config = {
125
129
  $schema: "https://benflux-ui.vercel.app/schema.json",
126
130
  style: "default",
127
131
  typescript: settings.typescript,
128
132
  tailwind: {
129
- config: hasTw ? "tailwind.config.ts" : "tailwind.config.ts",
130
- css: "src/app/globals.css",
133
+ config: "tailwind.config.ts",
134
+ css: globalsCss,
131
135
  baseColor: "default"
132
136
  },
133
137
  aliases: {
134
- components: `@/${settings.componentsDir.replace("src/", "")}`,
138
+ components: componentsAlias,
135
139
  utils: "@/lib/utils"
136
140
  }
137
141
  };
138
142
  await fs2.writeJson(path2.join(cwd, "benflux-ui.json"), config, { spaces: 2 });
139
143
  spinner3.stop("benflux-ui.json created");
140
144
  spinner3.start("Creating utility functions...");
141
- const utilsDir = path2.join(cwd, "src/lib");
145
+ const utilsDir = path2.join(cwd, libDir);
142
146
  await fs2.ensureDir(utilsDir);
143
147
  await fs2.writeFile(
144
148
  path2.join(utilsDir, "utils.ts"),
@@ -150,7 +154,7 @@ export function cn(...inputs: ClassValue[]) {
150
154
  }
151
155
  `
152
156
  );
153
- spinner3.stop("lib/utils.ts created");
157
+ spinner3.stop(`${libDir}/utils.ts created`);
154
158
  if (settings.installDeps) {
155
159
  spinner3.start(`Installing core dependencies with ${pm}...`);
156
160
  try {
@@ -180,11 +184,11 @@ export function cn(...inputs: ClassValue[]) {
180
184
  }
181
185
 
182
186
  // src/commands/add.ts
183
- import path3 from "path";
184
187
  import * as clack2 from "@clack/prompts";
185
- import pc2 from "picocolors";
186
- import fs3 from "fs-extra";
187
188
  import { execa as execa2 } from "execa";
189
+ import fs3 from "fs-extra";
190
+ import path3 from "path";
191
+ import pc2 from "picocolors";
188
192
 
189
193
  // src/utils/registry.ts
190
194
  var REGISTRY = [
@@ -808,7 +812,7 @@ async function addCommand(components, options) {
808
812
  (a, b) => a.category === b.category ? a.name.localeCompare(b.name) : a.category.localeCompare(b.category)
809
813
  );
810
814
  const selected = await clack2.multiselect({
811
- message: "Which components would you like to add?",
815
+ message: "Which components would you like to add? \u2191\u2193 navigate \xB7 Space select \xB7 Enter confirm",
812
816
  options: sorted.map((c) => ({
813
817
  label: c.name,
814
818
  hint: `${categoryLabel[c.category] ?? c.category} \u2014 ${c.description}`,
@@ -824,7 +828,9 @@ async function addCommand(components, options) {
824
828
  const validComponents = selectedComponents.map((name) => {
825
829
  const component = getComponent(name);
826
830
  if (!component) {
827
- clack2.log.warn(`Component ${pc2.yellow(name)} not found. Use ${pc2.cyan("benflux-ui list")} to see available components.`);
831
+ clack2.log.warn(
832
+ `Component ${pc2.yellow(name)} not found. Use ${pc2.cyan("benflux-ui list")} to see available components.`
833
+ );
828
834
  return null;
829
835
  }
830
836
  return component;
@@ -873,25 +879,26 @@ async function addCommand(components, options) {
873
879
  for (const file of component.files) {
874
880
  const targetPath = path3.join(cwd, defaultDir, path3.basename(file));
875
881
  if (await fs3.pathExists(targetPath) && !options.overwrite) {
876
- spinner3.stop(`${pc2.yellow("skipped")} ${component.name} (already exists \u2014 use --overwrite to replace)`);
882
+ spinner3.stop(
883
+ `${pc2.yellow("skipped")} ${component.name} (already exists \u2014 use --overwrite to replace)`
884
+ );
877
885
  continue;
878
886
  }
879
- const sourcePath = path3.join(
880
- cwd,
881
- "node_modules/@benflux-ui/react/src",
882
- file
883
- );
884
- if (await fs3.pathExists(sourcePath)) {
885
- await fs3.ensureDir(path3.dirname(targetPath));
886
- await fs3.copy(sourcePath, targetPath);
887
+ await fs3.ensureDir(path3.dirname(targetPath));
888
+ const localSrc = path3.join(cwd, "node_modules/@benflux-ui/react/src", file);
889
+ if (await fs3.pathExists(localSrc)) {
890
+ await fs3.copy(localSrc, targetPath);
887
891
  } else {
888
- await fs3.ensureDir(path3.dirname(targetPath));
889
- await fs3.writeFile(
890
- targetPath,
891
- `// ${component.name} \u2014 Install @benflux-ui/react to get the full component
892
- export {} from "@benflux-ui/react"
893
- `
894
- );
892
+ const url = `https://unpkg.com/@benflux-ui/react@latest/src/${file}`;
893
+ try {
894
+ const res = await fetch(url);
895
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
896
+ const source = await res.text();
897
+ await fs3.writeFile(targetPath, source, "utf-8");
898
+ } catch (err) {
899
+ spinner3.stop(pc2.red(`Failed to fetch ${file}: ${err.message}`));
900
+ clack2.log.warn(`Download manually from: ${url}`);
901
+ }
895
902
  }
896
903
  }
897
904
  spinner3.stop(`${pc2.green("\u2713")} Added ${component.name}`);
@@ -901,7 +908,11 @@ export {} from "@benflux-ui/react"
901
908
  pc2.green("\u2713") + " Components added successfully!",
902
909
  "",
903
910
  pc2.bold("Usage:"),
904
- ` ${pc2.cyan(`import { ${validComponents.map((c) => c?.name.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("")).join(", ")} } from "@benflux-ui/react"`)}`
911
+ ` ${pc2.cyan(
912
+ `import { ${validComponents.map(
913
+ (c) => c?.name.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("")
914
+ ).join(", ")} } from "@benflux-ui/react"`
915
+ )}`
905
916
  ].join("\n")
906
917
  );
907
918
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "benflux-ui",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "CLI for adding Benflux UI components to your project",
5
5
  "keywords": [
6
6
  "benflux-ui",