bunkit-cli 0.6.1 → 0.7.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 +1522 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22656,6 +22656,9 @@ var init_types2 = __esm(() => {
|
|
|
22656
22656
|
tsStrictness: exports_external.enum(["strict", "moderate", "loose"]).default("strict"),
|
|
22657
22657
|
uiLibrary: exports_external.enum(["shadcn", "none"]).optional(),
|
|
22658
22658
|
cssFramework: exports_external.enum(["tailwind", "vanilla", "css-modules"]).optional(),
|
|
22659
|
+
shadcnStyle: exports_external.enum(["new-york", "default"]).optional(),
|
|
22660
|
+
shadcnBaseColor: exports_external.enum(["neutral", "gray", "zinc", "stone", "slate"]).optional(),
|
|
22661
|
+
shadcnRadius: exports_external.string().optional(),
|
|
22659
22662
|
testing: exports_external.enum(["bun-test", "vitest", "none"]).default("bun-test"),
|
|
22660
22663
|
docker: exports_external.boolean().default(false),
|
|
22661
22664
|
cicd: exports_external.boolean().default(false),
|
|
@@ -22807,7 +22810,10 @@ function createTemplateContext(config) {
|
|
|
22807
22810
|
docker: config.docker,
|
|
22808
22811
|
cicd: config.cicd,
|
|
22809
22812
|
envExample: config.envExample,
|
|
22810
|
-
pathAliases: config.pathAliases
|
|
22813
|
+
pathAliases: config.pathAliases,
|
|
22814
|
+
shadcnStyle: config.shadcnStyle,
|
|
22815
|
+
shadcnBaseColor: config.shadcnBaseColor,
|
|
22816
|
+
shadcnRadius: config.shadcnRadius
|
|
22811
22817
|
};
|
|
22812
22818
|
}
|
|
22813
22819
|
var import_fs_extra2;
|
|
@@ -24182,6 +24188,41 @@ class dD extends x {
|
|
|
24182
24188
|
}
|
|
24183
24189
|
var A;
|
|
24184
24190
|
A = new WeakMap;
|
|
24191
|
+
var kD = Object.defineProperty;
|
|
24192
|
+
var $D = (e, u, t) => (u in e) ? kD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
24193
|
+
var H = (e, u, t) => ($D(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
24194
|
+
var SD = class extends x {
|
|
24195
|
+
constructor(u) {
|
|
24196
|
+
super(u, false), H(this, "options"), H(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u.cursorAt), 0), this.on("key", (t) => {
|
|
24197
|
+
t === "a" && this.toggleAll();
|
|
24198
|
+
}), this.on("cursor", (t) => {
|
|
24199
|
+
switch (t) {
|
|
24200
|
+
case "left":
|
|
24201
|
+
case "up":
|
|
24202
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
24203
|
+
break;
|
|
24204
|
+
case "down":
|
|
24205
|
+
case "right":
|
|
24206
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
24207
|
+
break;
|
|
24208
|
+
case "space":
|
|
24209
|
+
this.toggleValue();
|
|
24210
|
+
break;
|
|
24211
|
+
}
|
|
24212
|
+
});
|
|
24213
|
+
}
|
|
24214
|
+
get _value() {
|
|
24215
|
+
return this.options[this.cursor].value;
|
|
24216
|
+
}
|
|
24217
|
+
toggleAll() {
|
|
24218
|
+
const u = this.value.length === this.options.length;
|
|
24219
|
+
this.value = u ? [] : this.options.map((t) => t.value);
|
|
24220
|
+
}
|
|
24221
|
+
toggleValue() {
|
|
24222
|
+
const u = this.value.includes(this._value);
|
|
24223
|
+
this.value = u ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
|
|
24224
|
+
}
|
|
24225
|
+
};
|
|
24185
24226
|
var OD = Object.defineProperty;
|
|
24186
24227
|
var PD = (e, u, t) => (u in e) ? OD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
24187
24228
|
var J = (e, u, t) => (PD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
@@ -24353,6 +24394,47 @@ ${import_picocolors2.default.cyan(d2)}
|
|
|
24353
24394
|
}
|
|
24354
24395
|
} }).prompt();
|
|
24355
24396
|
};
|
|
24397
|
+
var fe = (t) => {
|
|
24398
|
+
const n = (r2, i) => {
|
|
24399
|
+
const s = r2.label ?? String(r2.value);
|
|
24400
|
+
return i === "active" ? `${import_picocolors2.default.cyan(A2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors2.default.green(T)} ${import_picocolors2.default.dim(s)} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : i === "active-selected" ? `${import_picocolors2.default.green(T)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(F)} ${import_picocolors2.default.dim(s)}`;
|
|
24401
|
+
};
|
|
24402
|
+
return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r2) {
|
|
24403
|
+
if (this.required && r2.length === 0)
|
|
24404
|
+
return `Please select at least one option.
|
|
24405
|
+
${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
|
|
24406
|
+
}, render() {
|
|
24407
|
+
const r2 = `${import_picocolors2.default.gray(o)}
|
|
24408
|
+
${b2(this.state)} ${t.message}
|
|
24409
|
+
`, i = (s, c) => {
|
|
24410
|
+
const a = this.value.includes(s.value);
|
|
24411
|
+
return c && a ? n(s, "active-selected") : a ? n(s, "selected") : n(s, c ? "active" : "inactive");
|
|
24412
|
+
};
|
|
24413
|
+
switch (this.state) {
|
|
24414
|
+
case "submit":
|
|
24415
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none")}`;
|
|
24416
|
+
case "cancel": {
|
|
24417
|
+
const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors2.default.dim(", "));
|
|
24418
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${s.trim() ? `${s}
|
|
24419
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
24420
|
+
}
|
|
24421
|
+
case "error": {
|
|
24422
|
+
const s = this.error.split(`
|
|
24423
|
+
`).map((c, a) => a === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(c)}` : ` ${c}`).join(`
|
|
24424
|
+
`);
|
|
24425
|
+
return `${r2 + import_picocolors2.default.yellow(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
24426
|
+
${import_picocolors2.default.yellow(o)} `)}
|
|
24427
|
+
${s}
|
|
24428
|
+
`;
|
|
24429
|
+
}
|
|
24430
|
+
default:
|
|
24431
|
+
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
24432
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
24433
|
+
${import_picocolors2.default.cyan(d2)}
|
|
24434
|
+
`;
|
|
24435
|
+
}
|
|
24436
|
+
} }).prompt();
|
|
24437
|
+
};
|
|
24356
24438
|
var Me = (t = "", n = "") => {
|
|
24357
24439
|
const r2 = `
|
|
24358
24440
|
${t}
|
|
@@ -24424,7 +24506,7 @@ var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
|
24424
24506
|
}, R2 = (m2) => m2.replace(/\.+$/, ""), O2 = (m2) => {
|
|
24425
24507
|
const h2 = (performance.now() - m2) / 1000, w2 = Math.floor(h2 / 60), I2 = Math.floor(h2 % 60);
|
|
24426
24508
|
return w2 > 0 ? `[${w2}m ${I2}s]` : `[${I2}s]`;
|
|
24427
|
-
},
|
|
24509
|
+
}, H2 = (m2 = "") => {
|
|
24428
24510
|
a = true, s = fD(), l2 = R2(m2), g2 = performance.now(), process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
24429
24511
|
`);
|
|
24430
24512
|
let h2 = 0, w2 = 0;
|
|
@@ -24450,7 +24532,7 @@ var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
|
24450
24532
|
`) : process.stdout.write(`${w2} ${l2}
|
|
24451
24533
|
`), E(), s();
|
|
24452
24534
|
};
|
|
24453
|
-
return { start:
|
|
24535
|
+
return { start: H2, stop: N2, message: (m2 = "") => {
|
|
24454
24536
|
l2 = R2(m2 ?? l2);
|
|
24455
24537
|
} };
|
|
24456
24538
|
};
|
|
@@ -25074,6 +25156,1183 @@ updates:
|
|
|
25074
25156
|
await writeFile(join(projectPath, ".github/dependabot.yml"), dependabotConfig);
|
|
25075
25157
|
}
|
|
25076
25158
|
|
|
25159
|
+
// ../templates/src/generators/shadcn.ts
|
|
25160
|
+
init_dist();
|
|
25161
|
+
init_src();
|
|
25162
|
+
|
|
25163
|
+
// ../templates/src/generators/shadcn-themes.ts
|
|
25164
|
+
var neutralTheme = {
|
|
25165
|
+
light: {
|
|
25166
|
+
radius: "0.625rem",
|
|
25167
|
+
background: "oklch(1 0 0)",
|
|
25168
|
+
foreground: "oklch(0.145 0 0)",
|
|
25169
|
+
card: "oklch(1 0 0)",
|
|
25170
|
+
cardForeground: "oklch(0.145 0 0)",
|
|
25171
|
+
popover: "oklch(1 0 0)",
|
|
25172
|
+
popoverForeground: "oklch(0.145 0 0)",
|
|
25173
|
+
primary: "oklch(0.205 0 0)",
|
|
25174
|
+
primaryForeground: "oklch(0.985 0 0)",
|
|
25175
|
+
secondary: "oklch(0.97 0 0)",
|
|
25176
|
+
secondaryForeground: "oklch(0.205 0 0)",
|
|
25177
|
+
muted: "oklch(0.97 0 0)",
|
|
25178
|
+
mutedForeground: "oklch(0.556 0 0)",
|
|
25179
|
+
accent: "oklch(0.97 0 0)",
|
|
25180
|
+
accentForeground: "oklch(0.205 0 0)",
|
|
25181
|
+
destructive: "oklch(0.577 0.245 27.325)",
|
|
25182
|
+
destructiveForeground: "oklch(0.577 0.245 27.325)",
|
|
25183
|
+
border: "oklch(0.922 0 0)",
|
|
25184
|
+
input: "oklch(0.922 0 0)",
|
|
25185
|
+
ring: "oklch(0.708 0 0)",
|
|
25186
|
+
chart1: "oklch(0.646 0.222 41.116)",
|
|
25187
|
+
chart2: "oklch(0.6 0.118 184.704)",
|
|
25188
|
+
chart3: "oklch(0.398 0.07 227.392)",
|
|
25189
|
+
chart4: "oklch(0.828 0.189 84.429)",
|
|
25190
|
+
chart5: "oklch(0.769 0.188 70.08)",
|
|
25191
|
+
sidebar: "oklch(0.985 0 0)",
|
|
25192
|
+
sidebarForeground: "oklch(0.145 0 0)",
|
|
25193
|
+
sidebarPrimary: "oklch(0.205 0 0)",
|
|
25194
|
+
sidebarPrimaryForeground: "oklch(0.985 0 0)",
|
|
25195
|
+
sidebarAccent: "oklch(0.97 0 0)",
|
|
25196
|
+
sidebarAccentForeground: "oklch(0.205 0 0)",
|
|
25197
|
+
sidebarBorder: "oklch(0.922 0 0)",
|
|
25198
|
+
sidebarRing: "oklch(0.708 0 0)"
|
|
25199
|
+
},
|
|
25200
|
+
dark: {
|
|
25201
|
+
background: "oklch(0.145 0 0)",
|
|
25202
|
+
foreground: "oklch(0.985 0 0)",
|
|
25203
|
+
card: "oklch(0.145 0 0)",
|
|
25204
|
+
cardForeground: "oklch(0.985 0 0)",
|
|
25205
|
+
popover: "oklch(0.145 0 0)",
|
|
25206
|
+
popoverForeground: "oklch(0.985 0 0)",
|
|
25207
|
+
primary: "oklch(0.985 0 0)",
|
|
25208
|
+
primaryForeground: "oklch(0.205 0 0)",
|
|
25209
|
+
secondary: "oklch(0.269 0 0)",
|
|
25210
|
+
secondaryForeground: "oklch(0.985 0 0)",
|
|
25211
|
+
muted: "oklch(0.269 0 0)",
|
|
25212
|
+
mutedForeground: "oklch(0.708 0 0)",
|
|
25213
|
+
accent: "oklch(0.269 0 0)",
|
|
25214
|
+
accentForeground: "oklch(0.985 0 0)",
|
|
25215
|
+
destructive: "oklch(0.396 0.141 25.723)",
|
|
25216
|
+
destructiveForeground: "oklch(0.637 0.237 25.331)",
|
|
25217
|
+
border: "oklch(0.269 0 0)",
|
|
25218
|
+
input: "oklch(0.269 0 0)",
|
|
25219
|
+
ring: "oklch(0.439 0 0)",
|
|
25220
|
+
chart1: "oklch(0.488 0.243 264.376)",
|
|
25221
|
+
chart2: "oklch(0.696 0.17 162.48)",
|
|
25222
|
+
chart3: "oklch(0.769 0.188 70.08)",
|
|
25223
|
+
chart4: "oklch(0.627 0.265 303.9)",
|
|
25224
|
+
chart5: "oklch(0.645 0.246 16.439)",
|
|
25225
|
+
sidebar: "oklch(0.205 0 0)",
|
|
25226
|
+
sidebarForeground: "oklch(0.985 0 0)",
|
|
25227
|
+
sidebarPrimary: "oklch(0.488 0.243 264.376)",
|
|
25228
|
+
sidebarPrimaryForeground: "oklch(0.985 0 0)",
|
|
25229
|
+
sidebarAccent: "oklch(0.269 0 0)",
|
|
25230
|
+
sidebarAccentForeground: "oklch(0.985 0 0)",
|
|
25231
|
+
sidebarBorder: "oklch(0.269 0 0)",
|
|
25232
|
+
sidebarRing: "oklch(0.439 0 0)"
|
|
25233
|
+
}
|
|
25234
|
+
};
|
|
25235
|
+
var grayTheme = {
|
|
25236
|
+
light: {
|
|
25237
|
+
radius: "0.625rem",
|
|
25238
|
+
background: "oklch(1 0 0)",
|
|
25239
|
+
foreground: "oklch(0.13 0.028 261.692)",
|
|
25240
|
+
card: "oklch(1 0 0)",
|
|
25241
|
+
cardForeground: "oklch(0.13 0.028 261.692)",
|
|
25242
|
+
popover: "oklch(1 0 0)",
|
|
25243
|
+
popoverForeground: "oklch(0.13 0.028 261.692)",
|
|
25244
|
+
primary: "oklch(0.21 0.034 264.665)",
|
|
25245
|
+
primaryForeground: "oklch(0.985 0.002 247.839)",
|
|
25246
|
+
secondary: "oklch(0.967 0.003 264.542)",
|
|
25247
|
+
secondaryForeground: "oklch(0.21 0.034 264.665)",
|
|
25248
|
+
muted: "oklch(0.967 0.003 264.542)",
|
|
25249
|
+
mutedForeground: "oklch(0.551 0.027 264.364)",
|
|
25250
|
+
accent: "oklch(0.967 0.003 264.542)",
|
|
25251
|
+
accentForeground: "oklch(0.21 0.034 264.665)",
|
|
25252
|
+
destructive: "oklch(0.577 0.245 27.325)",
|
|
25253
|
+
destructiveForeground: "oklch(0.577 0.245 27.325)",
|
|
25254
|
+
border: "oklch(0.928 0.006 264.531)",
|
|
25255
|
+
input: "oklch(0.928 0.006 264.531)",
|
|
25256
|
+
ring: "oklch(0.707 0.022 261.325)",
|
|
25257
|
+
chart1: "oklch(0.646 0.222 41.116)",
|
|
25258
|
+
chart2: "oklch(0.6 0.118 184.704)",
|
|
25259
|
+
chart3: "oklch(0.398 0.07 227.392)",
|
|
25260
|
+
chart4: "oklch(0.828 0.189 84.429)",
|
|
25261
|
+
chart5: "oklch(0.769 0.188 70.08)",
|
|
25262
|
+
sidebar: "oklch(0.985 0.002 247.839)",
|
|
25263
|
+
sidebarForeground: "oklch(0.13 0.028 261.692)",
|
|
25264
|
+
sidebarPrimary: "oklch(0.21 0.034 264.665)",
|
|
25265
|
+
sidebarPrimaryForeground: "oklch(0.985 0.002 247.839)",
|
|
25266
|
+
sidebarAccent: "oklch(0.967 0.003 264.542)",
|
|
25267
|
+
sidebarAccentForeground: "oklch(0.21 0.034 264.665)",
|
|
25268
|
+
sidebarBorder: "oklch(0.928 0.006 264.531)",
|
|
25269
|
+
sidebarRing: "oklch(0.707 0.022 261.325)"
|
|
25270
|
+
},
|
|
25271
|
+
dark: {
|
|
25272
|
+
background: "oklch(0.13 0.028 261.692)",
|
|
25273
|
+
foreground: "oklch(0.985 0.002 247.839)",
|
|
25274
|
+
card: "oklch(0.21 0.034 264.665)",
|
|
25275
|
+
cardForeground: "oklch(0.985 0.002 247.839)",
|
|
25276
|
+
popover: "oklch(0.21 0.034 264.665)",
|
|
25277
|
+
popoverForeground: "oklch(0.985 0.002 247.839)",
|
|
25278
|
+
primary: "oklch(0.928 0.006 264.531)",
|
|
25279
|
+
primaryForeground: "oklch(0.21 0.034 264.665)",
|
|
25280
|
+
secondary: "oklch(0.278 0.033 256.848)",
|
|
25281
|
+
secondaryForeground: "oklch(0.985 0.002 247.839)",
|
|
25282
|
+
muted: "oklch(0.278 0.033 256.848)",
|
|
25283
|
+
mutedForeground: "oklch(0.707 0.022 261.325)",
|
|
25284
|
+
accent: "oklch(0.278 0.033 256.848)",
|
|
25285
|
+
accentForeground: "oklch(0.985 0.002 247.839)",
|
|
25286
|
+
destructive: "oklch(0.704 0.191 22.216)",
|
|
25287
|
+
destructiveForeground: "oklch(0.704 0.191 22.216)",
|
|
25288
|
+
border: "oklch(1 0 0 / 10%)",
|
|
25289
|
+
input: "oklch(1 0 0 / 15%)",
|
|
25290
|
+
ring: "oklch(0.551 0.027 264.364)",
|
|
25291
|
+
chart1: "oklch(0.488 0.243 264.376)",
|
|
25292
|
+
chart2: "oklch(0.696 0.17 162.48)",
|
|
25293
|
+
chart3: "oklch(0.769 0.188 70.08)",
|
|
25294
|
+
chart4: "oklch(0.627 0.265 303.9)",
|
|
25295
|
+
chart5: "oklch(0.645 0.246 16.439)",
|
|
25296
|
+
sidebar: "oklch(0.21 0.034 264.665)",
|
|
25297
|
+
sidebarForeground: "oklch(0.985 0.002 247.839)",
|
|
25298
|
+
sidebarPrimary: "oklch(0.488 0.243 264.376)",
|
|
25299
|
+
sidebarPrimaryForeground: "oklch(0.985 0.002 247.839)",
|
|
25300
|
+
sidebarAccent: "oklch(0.278 0.033 256.848)",
|
|
25301
|
+
sidebarAccentForeground: "oklch(0.985 0.002 247.839)",
|
|
25302
|
+
sidebarBorder: "oklch(1 0 0 / 10%)",
|
|
25303
|
+
sidebarRing: "oklch(0.551 0.027 264.364)"
|
|
25304
|
+
}
|
|
25305
|
+
};
|
|
25306
|
+
var zincTheme = {
|
|
25307
|
+
light: {
|
|
25308
|
+
radius: "0.625rem",
|
|
25309
|
+
background: "oklch(1 0 0)",
|
|
25310
|
+
foreground: "oklch(0.141 0.005 285.823)",
|
|
25311
|
+
card: "oklch(1 0 0)",
|
|
25312
|
+
cardForeground: "oklch(0.141 0.005 285.823)",
|
|
25313
|
+
popover: "oklch(1 0 0)",
|
|
25314
|
+
popoverForeground: "oklch(0.141 0.005 285.823)",
|
|
25315
|
+
primary: "oklch(0.21 0.006 285.885)",
|
|
25316
|
+
primaryForeground: "oklch(0.985 0 0)",
|
|
25317
|
+
secondary: "oklch(0.967 0.001 286.375)",
|
|
25318
|
+
secondaryForeground: "oklch(0.21 0.006 285.885)",
|
|
25319
|
+
muted: "oklch(0.967 0.001 286.375)",
|
|
25320
|
+
mutedForeground: "oklch(0.552 0.016 285.938)",
|
|
25321
|
+
accent: "oklch(0.967 0.001 286.375)",
|
|
25322
|
+
accentForeground: "oklch(0.21 0.006 285.885)",
|
|
25323
|
+
destructive: "oklch(0.577 0.245 27.325)",
|
|
25324
|
+
destructiveForeground: "oklch(0.577 0.245 27.325)",
|
|
25325
|
+
border: "oklch(0.92 0.004 286.32)",
|
|
25326
|
+
input: "oklch(0.92 0.004 286.32)",
|
|
25327
|
+
ring: "oklch(0.705 0.015 286.067)",
|
|
25328
|
+
chart1: "oklch(0.646 0.222 41.116)",
|
|
25329
|
+
chart2: "oklch(0.6 0.118 184.704)",
|
|
25330
|
+
chart3: "oklch(0.398 0.07 227.392)",
|
|
25331
|
+
chart4: "oklch(0.828 0.189 84.429)",
|
|
25332
|
+
chart5: "oklch(0.769 0.188 70.08)",
|
|
25333
|
+
sidebar: "oklch(0.985 0 0)",
|
|
25334
|
+
sidebarForeground: "oklch(0.141 0.005 285.823)",
|
|
25335
|
+
sidebarPrimary: "oklch(0.21 0.006 285.885)",
|
|
25336
|
+
sidebarPrimaryForeground: "oklch(0.985 0 0)",
|
|
25337
|
+
sidebarAccent: "oklch(0.967 0.001 286.375)",
|
|
25338
|
+
sidebarAccentForeground: "oklch(0.21 0.006 285.885)",
|
|
25339
|
+
sidebarBorder: "oklch(0.92 0.004 286.32)",
|
|
25340
|
+
sidebarRing: "oklch(0.705 0.015 286.067)"
|
|
25341
|
+
},
|
|
25342
|
+
dark: {
|
|
25343
|
+
background: "oklch(0.141 0.005 285.823)",
|
|
25344
|
+
foreground: "oklch(0.985 0 0)",
|
|
25345
|
+
card: "oklch(0.21 0.006 285.885)",
|
|
25346
|
+
cardForeground: "oklch(0.985 0 0)",
|
|
25347
|
+
popover: "oklch(0.21 0.006 285.885)",
|
|
25348
|
+
popoverForeground: "oklch(0.985 0 0)",
|
|
25349
|
+
primary: "oklch(0.92 0.004 286.32)",
|
|
25350
|
+
primaryForeground: "oklch(0.21 0.006 285.885)",
|
|
25351
|
+
secondary: "oklch(0.274 0.006 286.033)",
|
|
25352
|
+
secondaryForeground: "oklch(0.985 0 0)",
|
|
25353
|
+
muted: "oklch(0.274 0.006 286.033)",
|
|
25354
|
+
mutedForeground: "oklch(0.705 0.015 286.067)",
|
|
25355
|
+
accent: "oklch(0.274 0.006 286.033)",
|
|
25356
|
+
accentForeground: "oklch(0.985 0 0)",
|
|
25357
|
+
destructive: "oklch(0.704 0.191 22.216)",
|
|
25358
|
+
destructiveForeground: "oklch(0.704 0.191 22.216)",
|
|
25359
|
+
border: "oklch(1 0 0 / 10%)",
|
|
25360
|
+
input: "oklch(1 0 0 / 15%)",
|
|
25361
|
+
ring: "oklch(0.552 0.016 285.938)",
|
|
25362
|
+
chart1: "oklch(0.488 0.243 264.376)",
|
|
25363
|
+
chart2: "oklch(0.696 0.17 162.48)",
|
|
25364
|
+
chart3: "oklch(0.769 0.188 70.08)",
|
|
25365
|
+
chart4: "oklch(0.627 0.265 303.9)",
|
|
25366
|
+
chart5: "oklch(0.645 0.246 16.439)",
|
|
25367
|
+
sidebar: "oklch(0.21 0.006 285.885)",
|
|
25368
|
+
sidebarForeground: "oklch(0.985 0 0)",
|
|
25369
|
+
sidebarPrimary: "oklch(0.488 0.243 264.376)",
|
|
25370
|
+
sidebarPrimaryForeground: "oklch(0.985 0 0)",
|
|
25371
|
+
sidebarAccent: "oklch(0.274 0.006 286.033)",
|
|
25372
|
+
sidebarAccentForeground: "oklch(0.985 0 0)",
|
|
25373
|
+
sidebarBorder: "oklch(1 0 0 / 10%)",
|
|
25374
|
+
sidebarRing: "oklch(0.552 0.016 285.938)"
|
|
25375
|
+
}
|
|
25376
|
+
};
|
|
25377
|
+
var stoneTheme = {
|
|
25378
|
+
light: {
|
|
25379
|
+
radius: "0.625rem",
|
|
25380
|
+
background: "oklch(1 0 0)",
|
|
25381
|
+
foreground: "oklch(0.147 0.004 49.25)",
|
|
25382
|
+
card: "oklch(1 0 0)",
|
|
25383
|
+
cardForeground: "oklch(0.147 0.004 49.25)",
|
|
25384
|
+
popover: "oklch(1 0 0)",
|
|
25385
|
+
popoverForeground: "oklch(0.147 0.004 49.25)",
|
|
25386
|
+
primary: "oklch(0.216 0.006 56.043)",
|
|
25387
|
+
primaryForeground: "oklch(0.985 0.001 106.423)",
|
|
25388
|
+
secondary: "oklch(0.97 0.001 106.424)",
|
|
25389
|
+
secondaryForeground: "oklch(0.216 0.006 56.043)",
|
|
25390
|
+
muted: "oklch(0.97 0.001 106.424)",
|
|
25391
|
+
mutedForeground: "oklch(0.553 0.013 58.071)",
|
|
25392
|
+
accent: "oklch(0.97 0.001 106.424)",
|
|
25393
|
+
accentForeground: "oklch(0.216 0.006 56.043)",
|
|
25394
|
+
destructive: "oklch(0.577 0.245 27.325)",
|
|
25395
|
+
destructiveForeground: "oklch(0.577 0.245 27.325)",
|
|
25396
|
+
border: "oklch(0.923 0.003 48.717)",
|
|
25397
|
+
input: "oklch(0.923 0.003 48.717)",
|
|
25398
|
+
ring: "oklch(0.709 0.01 56.259)",
|
|
25399
|
+
chart1: "oklch(0.646 0.222 41.116)",
|
|
25400
|
+
chart2: "oklch(0.6 0.118 184.704)",
|
|
25401
|
+
chart3: "oklch(0.398 0.07 227.392)",
|
|
25402
|
+
chart4: "oklch(0.828 0.189 84.429)",
|
|
25403
|
+
chart5: "oklch(0.769 0.188 70.08)",
|
|
25404
|
+
sidebar: "oklch(0.985 0.001 106.423)",
|
|
25405
|
+
sidebarForeground: "oklch(0.147 0.004 49.25)",
|
|
25406
|
+
sidebarPrimary: "oklch(0.216 0.006 56.043)",
|
|
25407
|
+
sidebarPrimaryForeground: "oklch(0.985 0.001 106.423)",
|
|
25408
|
+
sidebarAccent: "oklch(0.97 0.001 106.424)",
|
|
25409
|
+
sidebarAccentForeground: "oklch(0.216 0.006 56.043)",
|
|
25410
|
+
sidebarBorder: "oklch(0.923 0.003 48.717)",
|
|
25411
|
+
sidebarRing: "oklch(0.709 0.01 56.259)"
|
|
25412
|
+
},
|
|
25413
|
+
dark: {
|
|
25414
|
+
background: "oklch(0.147 0.004 49.25)",
|
|
25415
|
+
foreground: "oklch(0.985 0.001 106.423)",
|
|
25416
|
+
card: "oklch(0.216 0.006 56.043)",
|
|
25417
|
+
cardForeground: "oklch(0.985 0.001 106.423)",
|
|
25418
|
+
popover: "oklch(0.216 0.006 56.043)",
|
|
25419
|
+
popoverForeground: "oklch(0.985 0.001 106.423)",
|
|
25420
|
+
primary: "oklch(0.923 0.003 48.717)",
|
|
25421
|
+
primaryForeground: "oklch(0.216 0.006 56.043)",
|
|
25422
|
+
secondary: "oklch(0.268 0.007 34.298)",
|
|
25423
|
+
secondaryForeground: "oklch(0.985 0.001 106.423)",
|
|
25424
|
+
muted: "oklch(0.268 0.007 34.298)",
|
|
25425
|
+
mutedForeground: "oklch(0.709 0.01 56.259)",
|
|
25426
|
+
accent: "oklch(0.268 0.007 34.298)",
|
|
25427
|
+
accentForeground: "oklch(0.985 0.001 106.423)",
|
|
25428
|
+
destructive: "oklch(0.704 0.191 22.216)",
|
|
25429
|
+
destructiveForeground: "oklch(0.704 0.191 22.216)",
|
|
25430
|
+
border: "oklch(1 0 0 / 10%)",
|
|
25431
|
+
input: "oklch(1 0 0 / 15%)",
|
|
25432
|
+
ring: "oklch(0.553 0.013 58.071)",
|
|
25433
|
+
chart1: "oklch(0.488 0.243 264.376)",
|
|
25434
|
+
chart2: "oklch(0.696 0.17 162.48)",
|
|
25435
|
+
chart3: "oklch(0.769 0.188 70.08)",
|
|
25436
|
+
chart4: "oklch(0.627 0.265 303.9)",
|
|
25437
|
+
chart5: "oklch(0.645 0.246 16.439)",
|
|
25438
|
+
sidebar: "oklch(0.216 0.006 56.043)",
|
|
25439
|
+
sidebarForeground: "oklch(0.985 0.001 106.423)",
|
|
25440
|
+
sidebarPrimary: "oklch(0.488 0.243 264.376)",
|
|
25441
|
+
sidebarPrimaryForeground: "oklch(0.985 0.001 106.423)",
|
|
25442
|
+
sidebarAccent: "oklch(0.268 0.007 34.298)",
|
|
25443
|
+
sidebarAccentForeground: "oklch(0.985 0.001 106.423)",
|
|
25444
|
+
sidebarBorder: "oklch(1 0 0 / 10%)",
|
|
25445
|
+
sidebarRing: "oklch(0.553 0.013 58.071)"
|
|
25446
|
+
}
|
|
25447
|
+
};
|
|
25448
|
+
var slateTheme = {
|
|
25449
|
+
light: {
|
|
25450
|
+
radius: "0.625rem",
|
|
25451
|
+
background: "oklch(1 0 0)",
|
|
25452
|
+
foreground: "oklch(0.129 0.042 264.695)",
|
|
25453
|
+
card: "oklch(1 0 0)",
|
|
25454
|
+
cardForeground: "oklch(0.129 0.042 264.695)",
|
|
25455
|
+
popover: "oklch(1 0 0)",
|
|
25456
|
+
popoverForeground: "oklch(0.129 0.042 264.695)",
|
|
25457
|
+
primary: "oklch(0.208 0.042 265.755)",
|
|
25458
|
+
primaryForeground: "oklch(0.984 0.003 247.858)",
|
|
25459
|
+
secondary: "oklch(0.968 0.007 247.896)",
|
|
25460
|
+
secondaryForeground: "oklch(0.208 0.042 265.755)",
|
|
25461
|
+
muted: "oklch(0.968 0.007 247.896)",
|
|
25462
|
+
mutedForeground: "oklch(0.554 0.046 257.417)",
|
|
25463
|
+
accent: "oklch(0.968 0.007 247.896)",
|
|
25464
|
+
accentForeground: "oklch(0.208 0.042 265.755)",
|
|
25465
|
+
destructive: "oklch(0.577 0.245 27.325)",
|
|
25466
|
+
destructiveForeground: "oklch(0.577 0.245 27.325)",
|
|
25467
|
+
border: "oklch(0.929 0.013 255.508)",
|
|
25468
|
+
input: "oklch(0.929 0.013 255.508)",
|
|
25469
|
+
ring: "oklch(0.704 0.04 256.788)",
|
|
25470
|
+
chart1: "oklch(0.646 0.222 41.116)",
|
|
25471
|
+
chart2: "oklch(0.6 0.118 184.704)",
|
|
25472
|
+
chart3: "oklch(0.398 0.07 227.392)",
|
|
25473
|
+
chart4: "oklch(0.828 0.189 84.429)",
|
|
25474
|
+
chart5: "oklch(0.769 0.188 70.08)",
|
|
25475
|
+
sidebar: "oklch(0.984 0.003 247.858)",
|
|
25476
|
+
sidebarForeground: "oklch(0.129 0.042 264.695)",
|
|
25477
|
+
sidebarPrimary: "oklch(0.208 0.042 265.755)",
|
|
25478
|
+
sidebarPrimaryForeground: "oklch(0.984 0.003 247.858)",
|
|
25479
|
+
sidebarAccent: "oklch(0.968 0.007 247.896)",
|
|
25480
|
+
sidebarAccentForeground: "oklch(0.208 0.042 265.755)",
|
|
25481
|
+
sidebarBorder: "oklch(0.929 0.013 255.508)",
|
|
25482
|
+
sidebarRing: "oklch(0.704 0.04 256.788)"
|
|
25483
|
+
},
|
|
25484
|
+
dark: {
|
|
25485
|
+
background: "oklch(0.129 0.042 264.695)",
|
|
25486
|
+
foreground: "oklch(0.984 0.003 247.858)",
|
|
25487
|
+
card: "oklch(0.208 0.042 265.755)",
|
|
25488
|
+
cardForeground: "oklch(0.984 0.003 247.858)",
|
|
25489
|
+
popover: "oklch(0.208 0.042 265.755)",
|
|
25490
|
+
popoverForeground: "oklch(0.984 0.003 247.858)",
|
|
25491
|
+
primary: "oklch(0.929 0.013 255.508)",
|
|
25492
|
+
primaryForeground: "oklch(0.208 0.042 265.755)",
|
|
25493
|
+
secondary: "oklch(0.279 0.041 260.031)",
|
|
25494
|
+
secondaryForeground: "oklch(0.984 0.003 247.858)",
|
|
25495
|
+
muted: "oklch(0.279 0.041 260.031)",
|
|
25496
|
+
mutedForeground: "oklch(0.704 0.04 256.788)",
|
|
25497
|
+
accent: "oklch(0.279 0.041 260.031)",
|
|
25498
|
+
accentForeground: "oklch(0.984 0.003 247.858)",
|
|
25499
|
+
destructive: "oklch(0.704 0.191 22.216)",
|
|
25500
|
+
destructiveForeground: "oklch(0.704 0.191 22.216)",
|
|
25501
|
+
border: "oklch(1 0 0 / 10%)",
|
|
25502
|
+
input: "oklch(1 0 0 / 15%)",
|
|
25503
|
+
ring: "oklch(0.551 0.027 264.364)",
|
|
25504
|
+
chart1: "oklch(0.488 0.243 264.376)",
|
|
25505
|
+
chart2: "oklch(0.696 0.17 162.48)",
|
|
25506
|
+
chart3: "oklch(0.769 0.188 70.08)",
|
|
25507
|
+
chart4: "oklch(0.627 0.265 303.9)",
|
|
25508
|
+
chart5: "oklch(0.645 0.246 16.439)",
|
|
25509
|
+
sidebar: "oklch(0.208 0.042 265.755)",
|
|
25510
|
+
sidebarForeground: "oklch(0.984 0.003 247.858)",
|
|
25511
|
+
sidebarPrimary: "oklch(0.488 0.243 264.376)",
|
|
25512
|
+
sidebarPrimaryForeground: "oklch(0.984 0.003 247.858)",
|
|
25513
|
+
sidebarAccent: "oklch(0.279 0.041 260.031)",
|
|
25514
|
+
sidebarAccentForeground: "oklch(0.984 0.003 247.858)",
|
|
25515
|
+
sidebarBorder: "oklch(1 0 0 / 10%)",
|
|
25516
|
+
sidebarRing: "oklch(0.551 0.027 264.364)"
|
|
25517
|
+
}
|
|
25518
|
+
};
|
|
25519
|
+
var themes = {
|
|
25520
|
+
neutral: neutralTheme,
|
|
25521
|
+
gray: grayTheme,
|
|
25522
|
+
zinc: zincTheme,
|
|
25523
|
+
stone: stoneTheme,
|
|
25524
|
+
slate: slateTheme
|
|
25525
|
+
};
|
|
25526
|
+
function generateThemeCSS(theme, customRadius) {
|
|
25527
|
+
const radius = customRadius || theme.light.radius;
|
|
25528
|
+
return `@layer base {
|
|
25529
|
+
:root {
|
|
25530
|
+
--radius: ${radius};
|
|
25531
|
+
--background: ${theme.light.background};
|
|
25532
|
+
--foreground: ${theme.light.foreground};
|
|
25533
|
+
--card: ${theme.light.card};
|
|
25534
|
+
--card-foreground: ${theme.light.cardForeground};
|
|
25535
|
+
--popover: ${theme.light.popover};
|
|
25536
|
+
--popover-foreground: ${theme.light.popoverForeground};
|
|
25537
|
+
--primary: ${theme.light.primary};
|
|
25538
|
+
--primary-foreground: ${theme.light.primaryForeground};
|
|
25539
|
+
--secondary: ${theme.light.secondary};
|
|
25540
|
+
--secondary-foreground: ${theme.light.secondaryForeground};
|
|
25541
|
+
--muted: ${theme.light.muted};
|
|
25542
|
+
--muted-foreground: ${theme.light.mutedForeground};
|
|
25543
|
+
--accent: ${theme.light.accent};
|
|
25544
|
+
--accent-foreground: ${theme.light.accentForeground};
|
|
25545
|
+
--destructive: ${theme.light.destructive};
|
|
25546
|
+
--destructive-foreground: ${theme.light.destructiveForeground};
|
|
25547
|
+
--border: ${theme.light.border};
|
|
25548
|
+
--input: ${theme.light.input};
|
|
25549
|
+
--ring: ${theme.light.ring};
|
|
25550
|
+
--chart-1: ${theme.light.chart1};
|
|
25551
|
+
--chart-2: ${theme.light.chart2};
|
|
25552
|
+
--chart-3: ${theme.light.chart3};
|
|
25553
|
+
--chart-4: ${theme.light.chart4};
|
|
25554
|
+
--chart-5: ${theme.light.chart5};
|
|
25555
|
+
--sidebar: ${theme.light.sidebar};
|
|
25556
|
+
--sidebar-foreground: ${theme.light.sidebarForeground};
|
|
25557
|
+
--sidebar-primary: ${theme.light.sidebarPrimary};
|
|
25558
|
+
--sidebar-primary-foreground: ${theme.light.sidebarPrimaryForeground};
|
|
25559
|
+
--sidebar-accent: ${theme.light.sidebarAccent};
|
|
25560
|
+
--sidebar-accent-foreground: ${theme.light.sidebarAccentForeground};
|
|
25561
|
+
--sidebar-border: ${theme.light.sidebarBorder};
|
|
25562
|
+
--sidebar-ring: ${theme.light.sidebarRing};
|
|
25563
|
+
}
|
|
25564
|
+
|
|
25565
|
+
.dark {
|
|
25566
|
+
--background: ${theme.dark.background};
|
|
25567
|
+
--foreground: ${theme.dark.foreground};
|
|
25568
|
+
--card: ${theme.dark.card};
|
|
25569
|
+
--card-foreground: ${theme.dark.cardForeground};
|
|
25570
|
+
--popover: ${theme.dark.popover};
|
|
25571
|
+
--popover-foreground: ${theme.dark.popoverForeground};
|
|
25572
|
+
--primary: ${theme.dark.primary};
|
|
25573
|
+
--primary-foreground: ${theme.dark.primaryForeground};
|
|
25574
|
+
--secondary: ${theme.dark.secondary};
|
|
25575
|
+
--secondary-foreground: ${theme.dark.secondaryForeground};
|
|
25576
|
+
--muted: ${theme.dark.muted};
|
|
25577
|
+
--muted-foreground: ${theme.dark.mutedForeground};
|
|
25578
|
+
--accent: ${theme.dark.accent};
|
|
25579
|
+
--accent-foreground: ${theme.dark.accentForeground};
|
|
25580
|
+
--destructive: ${theme.dark.destructive};
|
|
25581
|
+
--destructive-foreground: ${theme.dark.destructiveForeground};
|
|
25582
|
+
--border: ${theme.dark.border};
|
|
25583
|
+
--input: ${theme.dark.input};
|
|
25584
|
+
--ring: ${theme.dark.ring};
|
|
25585
|
+
--chart-1: ${theme.dark.chart1};
|
|
25586
|
+
--chart-2: ${theme.dark.chart2};
|
|
25587
|
+
--chart-3: ${theme.dark.chart3};
|
|
25588
|
+
--chart-4: ${theme.dark.chart4};
|
|
25589
|
+
--chart-5: ${theme.dark.chart5};
|
|
25590
|
+
--sidebar: ${theme.dark.sidebar};
|
|
25591
|
+
--sidebar-foreground: ${theme.dark.sidebarForeground};
|
|
25592
|
+
--sidebar-primary: ${theme.dark.sidebarPrimary};
|
|
25593
|
+
--sidebar-primary-foreground: ${theme.dark.sidebarPrimaryForeground};
|
|
25594
|
+
--sidebar-accent: ${theme.dark.sidebarAccent};
|
|
25595
|
+
--sidebar-accent-foreground: ${theme.dark.sidebarAccentForeground};
|
|
25596
|
+
--sidebar-border: ${theme.dark.sidebarBorder};
|
|
25597
|
+
--sidebar-ring: ${theme.dark.sidebarRing};
|
|
25598
|
+
}
|
|
25599
|
+
}
|
|
25600
|
+
|
|
25601
|
+
@layer base {
|
|
25602
|
+
* {
|
|
25603
|
+
@apply border-border outline-ring/50;
|
|
25604
|
+
}
|
|
25605
|
+
body {
|
|
25606
|
+
@apply bg-background text-foreground;
|
|
25607
|
+
}
|
|
25608
|
+
}
|
|
25609
|
+
`;
|
|
25610
|
+
}
|
|
25611
|
+
|
|
25612
|
+
// ../templates/src/generators/shadcn-components.ts
|
|
25613
|
+
init_execa();
|
|
25614
|
+
init_dist();
|
|
25615
|
+
init_src();
|
|
25616
|
+
init_src();
|
|
25617
|
+
var DEFAULT_SHADCN_COMPONENTS = [
|
|
25618
|
+
"button",
|
|
25619
|
+
"card"
|
|
25620
|
+
];
|
|
25621
|
+
async function installShadcnComponents(projectPath, components, options = {}) {
|
|
25622
|
+
const cwd2 = options.cwd || projectPath;
|
|
25623
|
+
const stdio = options.silent ? "pipe" : "inherit";
|
|
25624
|
+
try {
|
|
25625
|
+
await execa("bunx", ["shadcn@latest", "add", ...components], {
|
|
25626
|
+
cwd: cwd2,
|
|
25627
|
+
stdio
|
|
25628
|
+
});
|
|
25629
|
+
} catch (error) {
|
|
25630
|
+
try {
|
|
25631
|
+
await execa("npx", ["shadcn@latest", "add", ...components], {
|
|
25632
|
+
cwd: cwd2,
|
|
25633
|
+
stdio
|
|
25634
|
+
});
|
|
25635
|
+
} catch (fallbackError) {
|
|
25636
|
+
logger.warn(`Could not install shadcn components automatically. You can install them manually with: bunx shadcn@latest add ${components.join(" ")}`);
|
|
25637
|
+
}
|
|
25638
|
+
}
|
|
25639
|
+
}
|
|
25640
|
+
async function installDefaultShadcnComponents(projectPath, options = {}) {
|
|
25641
|
+
if (options.skipDefaults) {
|
|
25642
|
+
return;
|
|
25643
|
+
}
|
|
25644
|
+
logger.step("Installing default shadcn/ui components...");
|
|
25645
|
+
try {
|
|
25646
|
+
await installShadcnComponents(projectPath, [...DEFAULT_SHADCN_COMPONENTS], {
|
|
25647
|
+
silent: options.silent,
|
|
25648
|
+
cwd: projectPath
|
|
25649
|
+
});
|
|
25650
|
+
logger.success("Default components installed");
|
|
25651
|
+
} catch (error) {
|
|
25652
|
+
logger.warn("Could not install default components automatically. Install them manually with: bunx shadcn@latest add button card");
|
|
25653
|
+
}
|
|
25654
|
+
}
|
|
25655
|
+
async function createShadcnExample(projectPath, isMonorepo = false) {
|
|
25656
|
+
const examplePath = isMonorepo ? join(projectPath, "apps/web/src/components/example.tsx") : join(projectPath, "src/components/example.tsx");
|
|
25657
|
+
const exampleContent = `"use client"
|
|
25658
|
+
|
|
25659
|
+
import { Button } from "@/components/ui/button"
|
|
25660
|
+
import {
|
|
25661
|
+
Card,
|
|
25662
|
+
CardContent,
|
|
25663
|
+
CardDescription,
|
|
25664
|
+
CardFooter,
|
|
25665
|
+
CardHeader,
|
|
25666
|
+
CardTitle,
|
|
25667
|
+
} from "@/components/ui/card"
|
|
25668
|
+
|
|
25669
|
+
/**
|
|
25670
|
+
* Example component showcasing shadcn/ui components
|
|
25671
|
+
* This file demonstrates how to use Button and Card components
|
|
25672
|
+
*
|
|
25673
|
+
* You can delete this file once you're familiar with the patterns.
|
|
25674
|
+
*/
|
|
25675
|
+
export function ExampleComponent() {
|
|
25676
|
+
return (
|
|
25677
|
+
<div className="container mx-auto p-8 space-y-6">
|
|
25678
|
+
<Card>
|
|
25679
|
+
<CardHeader>
|
|
25680
|
+
<CardTitle>Welcome to shadcn/ui</CardTitle>
|
|
25681
|
+
<CardDescription>
|
|
25682
|
+
This is an example component showing how to use shadcn/ui components.
|
|
25683
|
+
</CardDescription>
|
|
25684
|
+
</CardHeader>
|
|
25685
|
+
<CardContent>
|
|
25686
|
+
<p className="text-sm text-muted-foreground">
|
|
25687
|
+
You can start building your UI by importing components from @/components/ui
|
|
25688
|
+
</p>
|
|
25689
|
+
</CardContent>
|
|
25690
|
+
<CardFooter className="flex gap-2">
|
|
25691
|
+
<Button>Get Started</Button>
|
|
25692
|
+
<Button variant="outline">Learn More</Button>
|
|
25693
|
+
</CardFooter>
|
|
25694
|
+
</Card>
|
|
25695
|
+
</div>
|
|
25696
|
+
)
|
|
25697
|
+
}
|
|
25698
|
+
`;
|
|
25699
|
+
try {
|
|
25700
|
+
await ensureDirectory(join(examplePath, ".."));
|
|
25701
|
+
await writeFile(examplePath, exampleContent);
|
|
25702
|
+
} catch (error) {}
|
|
25703
|
+
}
|
|
25704
|
+
|
|
25705
|
+
// ../templates/src/generators/shadcn-docs.ts
|
|
25706
|
+
init_dist();
|
|
25707
|
+
init_src();
|
|
25708
|
+
async function createShadcnDocs(projectPath, isMonorepo = false, context) {
|
|
25709
|
+
const docsPath = isMonorepo ? join(projectPath, "packages/ui/SHADCN.md") : join(projectPath, "SHADCN.md");
|
|
25710
|
+
const docsContent = `# shadcn/ui Guide
|
|
25711
|
+
|
|
25712
|
+
This project uses [shadcn/ui](https://ui.shadcn.com) - a collection of re-usable components built with Radix UI and Tailwind CSS.
|
|
25713
|
+
|
|
25714
|
+
## \uD83D\uDE80 Quick Start
|
|
25715
|
+
|
|
25716
|
+
### Adding Components
|
|
25717
|
+
|
|
25718
|
+
Use the bunkit CLI to add components:
|
|
25719
|
+
|
|
25720
|
+
\`\`\`bash
|
|
25721
|
+
# Add a single component
|
|
25722
|
+
bunkit add component --components button
|
|
25723
|
+
|
|
25724
|
+
# Add multiple components
|
|
25725
|
+
bunkit add component --components button,card,input
|
|
25726
|
+
|
|
25727
|
+
# Browse all available components
|
|
25728
|
+
bunkit add component --all
|
|
25729
|
+
\`\`\`
|
|
25730
|
+
|
|
25731
|
+
Or use the official shadcn CLI directly:
|
|
25732
|
+
|
|
25733
|
+
\`\`\`bash
|
|
25734
|
+
bunx shadcn@latest add button
|
|
25735
|
+
bunx shadcn@latest add card
|
|
25736
|
+
bunx shadcn@latest add input
|
|
25737
|
+
\`\`\`
|
|
25738
|
+
|
|
25739
|
+
### Using Components
|
|
25740
|
+
|
|
25741
|
+
Import components from the \`@/components/ui\` path:
|
|
25742
|
+
|
|
25743
|
+
\`\`\`tsx
|
|
25744
|
+
import { Button } from "@/components/ui/button"
|
|
25745
|
+
import {
|
|
25746
|
+
Card,
|
|
25747
|
+
CardContent,
|
|
25748
|
+
CardDescription,
|
|
25749
|
+
CardFooter,
|
|
25750
|
+
CardHeader,
|
|
25751
|
+
CardTitle,
|
|
25752
|
+
} from "@/components/ui/card"
|
|
25753
|
+
|
|
25754
|
+
export function MyComponent() {
|
|
25755
|
+
return (
|
|
25756
|
+
<Card>
|
|
25757
|
+
<CardHeader>
|
|
25758
|
+
<CardTitle>Hello</CardTitle>
|
|
25759
|
+
<CardDescription>World</CardDescription>
|
|
25760
|
+
</CardHeader>
|
|
25761
|
+
<CardContent>
|
|
25762
|
+
<Button>Click me</Button>
|
|
25763
|
+
</CardContent>
|
|
25764
|
+
</Card>
|
|
25765
|
+
)
|
|
25766
|
+
}
|
|
25767
|
+
\`\`\`
|
|
25768
|
+
|
|
25769
|
+
## \uD83D\uDCDA Available Components
|
|
25770
|
+
|
|
25771
|
+
shadcn/ui provides 60+ components. Browse them all at [ui.shadcn.com](https://ui.shadcn.com/components).
|
|
25772
|
+
|
|
25773
|
+
### Most Popular Components
|
|
25774
|
+
|
|
25775
|
+
- **Button** - \`bunkit add component --components button\`
|
|
25776
|
+
- **Card** - \`bunkit add component --components card\`
|
|
25777
|
+
- **Input** - \`bunkit add component --components input\`
|
|
25778
|
+
- **Dialog** - \`bunkit add component --components dialog\`
|
|
25779
|
+
- **Dropdown Menu** - \`bunkit add component --components dropdown-menu\`
|
|
25780
|
+
- **Form** - \`bunkit add component --components form\`
|
|
25781
|
+
- **Table** - \`bunkit add component --components table\`
|
|
25782
|
+
- **Toast** - \`bunkit add component --components toast\`
|
|
25783
|
+
|
|
25784
|
+
## \uD83C\uDFA8 Customization
|
|
25785
|
+
|
|
25786
|
+
### Themes
|
|
25787
|
+
|
|
25788
|
+
Your project is configured with:
|
|
25789
|
+
- **Style**: ${context?.shadcnStyle || "new-york"}
|
|
25790
|
+
- **Base Color**: ${context?.shadcnBaseColor || "zinc"}
|
|
25791
|
+
- **Border Radius**: ${context?.shadcnRadius || "0.625rem"}
|
|
25792
|
+
|
|
25793
|
+
### Modifying Themes
|
|
25794
|
+
|
|
25795
|
+
Edit the CSS variables in \`${isMonorepo ? "packages/ui/src/styles/globals.css" : "src/app/globals.css"}\`:
|
|
25796
|
+
|
|
25797
|
+
\`\`\`css
|
|
25798
|
+
@layer base {
|
|
25799
|
+
:root {
|
|
25800
|
+
--radius: 0.625rem;
|
|
25801
|
+
--background: oklch(...);
|
|
25802
|
+
--foreground: oklch(...);
|
|
25803
|
+
/* ... */
|
|
25804
|
+
}
|
|
25805
|
+
}
|
|
25806
|
+
\`\`\`
|
|
25807
|
+
|
|
25808
|
+
### Component Customization
|
|
25809
|
+
|
|
25810
|
+
Components are copied directly into your project at \`${isMonorepo ? "packages/ui/src/components/ui" : "src/components/ui"}\`. You can modify them directly - they're YOUR code!
|
|
25811
|
+
|
|
25812
|
+
## \uD83D\uDCD6 Documentation
|
|
25813
|
+
|
|
25814
|
+
- [Official shadcn/ui Docs](https://ui.shadcn.com)
|
|
25815
|
+
- [Component Examples](https://ui.shadcn.com/components)
|
|
25816
|
+
- [Theming Guide](https://ui.shadcn.com/theming)
|
|
25817
|
+
|
|
25818
|
+
## \uD83D\uDCA1 Tips
|
|
25819
|
+
|
|
25820
|
+
1. **Components are yours** - They're copied into your project, so feel free to modify them
|
|
25821
|
+
2. **Type-safe** - All components are fully typed with TypeScript
|
|
25822
|
+
3. **Accessible** - Built on Radix UI primitives for accessibility
|
|
25823
|
+
4. **Customizable** - Use Tailwind classes to style components however you want
|
|
25824
|
+
|
|
25825
|
+
## \uD83D\uDD27 Configuration
|
|
25826
|
+
|
|
25827
|
+
Your \`components.json\` file (located at \`${isMonorepo ? "packages/ui/components.json" : "components.json"}\`) contains all shadcn/ui configuration.
|
|
25828
|
+
|
|
25829
|
+
To change settings, edit this file or run:
|
|
25830
|
+
|
|
25831
|
+
\`\`\`bash
|
|
25832
|
+
bunx shadcn@latest init
|
|
25833
|
+
\`\`\`
|
|
25834
|
+
|
|
25835
|
+
---
|
|
25836
|
+
|
|
25837
|
+
**Happy building! \uD83D\uDE80**
|
|
25838
|
+
`;
|
|
25839
|
+
try {
|
|
25840
|
+
await ensureDirectory(join(docsPath, ".."));
|
|
25841
|
+
await writeFile(docsPath, docsContent);
|
|
25842
|
+
} catch (error) {}
|
|
25843
|
+
}
|
|
25844
|
+
|
|
25845
|
+
// ../templates/src/generators/shadcn.ts
|
|
25846
|
+
async function setupShadcnWeb(projectPath, context) {
|
|
25847
|
+
await ensureDirectory(join(projectPath, "src/components/ui"));
|
|
25848
|
+
await ensureDirectory(join(projectPath, "src/lib"));
|
|
25849
|
+
const style = context.shadcnStyle || "new-york";
|
|
25850
|
+
const baseColor = context.shadcnBaseColor || "zinc";
|
|
25851
|
+
const radius = context.shadcnRadius || "0.625rem";
|
|
25852
|
+
const componentsJson = {
|
|
25853
|
+
$schema: "https://ui.shadcn.com/schema.json",
|
|
25854
|
+
style,
|
|
25855
|
+
rsc: true,
|
|
25856
|
+
tsx: true,
|
|
25857
|
+
tailwind: {
|
|
25858
|
+
config: "",
|
|
25859
|
+
css: "src/app/globals.css",
|
|
25860
|
+
baseColor,
|
|
25861
|
+
cssVariables: true
|
|
25862
|
+
},
|
|
25863
|
+
iconLibrary: "lucide",
|
|
25864
|
+
aliases: {
|
|
25865
|
+
components: "@/components",
|
|
25866
|
+
utils: "@/lib/utils",
|
|
25867
|
+
ui: "@/components/ui",
|
|
25868
|
+
lib: "@/lib",
|
|
25869
|
+
hooks: "@/hooks"
|
|
25870
|
+
}
|
|
25871
|
+
};
|
|
25872
|
+
await writeFile(join(projectPath, "components.json"), JSON.stringify(componentsJson, null, 2));
|
|
25873
|
+
const utilsContent = `import { clsx, type ClassValue } from 'clsx';
|
|
25874
|
+
import { twMerge } from 'tailwind-merge';
|
|
25875
|
+
|
|
25876
|
+
export function cn(...inputs: ClassValue[]) {
|
|
25877
|
+
return twMerge(clsx(inputs));
|
|
25878
|
+
}
|
|
25879
|
+
`;
|
|
25880
|
+
await writeFile(join(projectPath, "src/lib/utils.ts"), utilsContent);
|
|
25881
|
+
const packageJsonPath = join(projectPath, "package.json");
|
|
25882
|
+
let packageJson = {};
|
|
25883
|
+
try {
|
|
25884
|
+
packageJson = JSON.parse(await Bun.file(packageJsonPath).text());
|
|
25885
|
+
} catch {}
|
|
25886
|
+
if (!packageJson.dependencies) {
|
|
25887
|
+
packageJson.dependencies = {};
|
|
25888
|
+
}
|
|
25889
|
+
packageJson.dependencies["@radix-ui/react-slot"] = "catalog:";
|
|
25890
|
+
packageJson.dependencies["class-variance-authority"] = "catalog:";
|
|
25891
|
+
packageJson.dependencies["clsx"] = "catalog:";
|
|
25892
|
+
packageJson.dependencies["tailwind-merge"] = "catalog:";
|
|
25893
|
+
packageJson.dependencies["lucide-react"] = "catalog:";
|
|
25894
|
+
if (!packageJson.catalog) {
|
|
25895
|
+
packageJson.catalog = {};
|
|
25896
|
+
}
|
|
25897
|
+
packageJson.catalog["@radix-ui/react-slot"] = "^1.2.3";
|
|
25898
|
+
packageJson.catalog["class-variance-authority"] = "^0.7.1";
|
|
25899
|
+
packageJson.catalog["clsx"] = "^2.1.1";
|
|
25900
|
+
packageJson.catalog["tailwind-merge"] = "^3.3.1";
|
|
25901
|
+
packageJson.catalog["lucide-react"] = "^0.468.0";
|
|
25902
|
+
await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
25903
|
+
const globalsCssPath = join(projectPath, "src/app/globals.css");
|
|
25904
|
+
let globalsCss = "";
|
|
25905
|
+
try {
|
|
25906
|
+
globalsCss = await Bun.file(globalsCssPath).text();
|
|
25907
|
+
} catch {}
|
|
25908
|
+
if (!globalsCss.includes("--background")) {
|
|
25909
|
+
const theme = themes[baseColor] || themes.zinc;
|
|
25910
|
+
const shadcnCss = generateThemeCSS(theme, radius);
|
|
25911
|
+
if (globalsCss) {
|
|
25912
|
+
globalsCss = globalsCss + `
|
|
25913
|
+
` + shadcnCss;
|
|
25914
|
+
} else {
|
|
25915
|
+
globalsCss = `@import "tailwindcss";
|
|
25916
|
+
|
|
25917
|
+
${shadcnCss}`;
|
|
25918
|
+
}
|
|
25919
|
+
await writeFile(globalsCssPath, globalsCss);
|
|
25920
|
+
}
|
|
25921
|
+
const tailwindConfigPath = join(projectPath, "tailwind.config.ts");
|
|
25922
|
+
let tailwindConfig = "";
|
|
25923
|
+
try {
|
|
25924
|
+
tailwindConfig = await Bun.file(tailwindConfigPath).text();
|
|
25925
|
+
} catch {}
|
|
25926
|
+
if (tailwindConfig && !tailwindConfig.includes("hsl(var(--background))")) {
|
|
25927
|
+
const shadcnTheme = ` theme: {
|
|
25928
|
+
extend: {
|
|
25929
|
+
colors: {
|
|
25930
|
+
border: "hsl(var(--border))",
|
|
25931
|
+
input: "hsl(var(--input))",
|
|
25932
|
+
ring: "hsl(var(--ring))",
|
|
25933
|
+
background: "hsl(var(--background))",
|
|
25934
|
+
foreground: "hsl(var(--foreground))",
|
|
25935
|
+
primary: {
|
|
25936
|
+
DEFAULT: "hsl(var(--primary))",
|
|
25937
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
25938
|
+
},
|
|
25939
|
+
secondary: {
|
|
25940
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
25941
|
+
foreground: "hsl(var(--secondary-foreground))",
|
|
25942
|
+
},
|
|
25943
|
+
destructive: {
|
|
25944
|
+
DEFAULT: "hsl(var(--destructive))",
|
|
25945
|
+
foreground: "hsl(var(--destructive-foreground))",
|
|
25946
|
+
},
|
|
25947
|
+
muted: {
|
|
25948
|
+
DEFAULT: "hsl(var(--muted))",
|
|
25949
|
+
foreground: "hsl(var(--muted-foreground))",
|
|
25950
|
+
},
|
|
25951
|
+
accent: {
|
|
25952
|
+
DEFAULT: "hsl(var(--accent))",
|
|
25953
|
+
foreground: "hsl(var(--accent-foreground))",
|
|
25954
|
+
},
|
|
25955
|
+
popover: {
|
|
25956
|
+
DEFAULT: "hsl(var(--popover))",
|
|
25957
|
+
foreground: "hsl(var(--popover-foreground))",
|
|
25958
|
+
},
|
|
25959
|
+
card: {
|
|
25960
|
+
DEFAULT: "hsl(var(--card))",
|
|
25961
|
+
foreground: "hsl(var(--card-foreground))",
|
|
25962
|
+
},
|
|
25963
|
+
},
|
|
25964
|
+
borderRadius: {
|
|
25965
|
+
lg: "var(--radius)",
|
|
25966
|
+
md: "calc(var(--radius) - 2px)",
|
|
25967
|
+
sm: "calc(var(--radius) - 4px)",
|
|
25968
|
+
},
|
|
25969
|
+
},
|
|
25970
|
+
},`;
|
|
25971
|
+
if (tailwindConfig.includes("theme:")) {
|
|
25972
|
+
const updatedConfig = tailwindConfig.replace(/theme:\s*\{[^}]*\}/s, shadcnTheme.trim());
|
|
25973
|
+
await writeFile(tailwindConfigPath, updatedConfig);
|
|
25974
|
+
} else {
|
|
25975
|
+
const updatedConfig = tailwindConfig.replace(/(\s*)(plugins:.*?)(\n\s*\};)/s, `$1$2$1${shadcnTheme}$3`);
|
|
25976
|
+
await writeFile(tailwindConfigPath, updatedConfig);
|
|
25977
|
+
}
|
|
25978
|
+
} else if (!tailwindConfig) {
|
|
25979
|
+
const newTailwindConfig = `import type { Config } from 'tailwindcss';
|
|
25980
|
+
|
|
25981
|
+
const config: Config = {
|
|
25982
|
+
content: ['./src/**/*.{js,ts,jsx,tsx,mdx}'],
|
|
25983
|
+
theme: {
|
|
25984
|
+
extend: {
|
|
25985
|
+
colors: {
|
|
25986
|
+
border: "hsl(var(--border))",
|
|
25987
|
+
input: "hsl(var(--input))",
|
|
25988
|
+
ring: "hsl(var(--ring))",
|
|
25989
|
+
background: "hsl(var(--background))",
|
|
25990
|
+
foreground: "hsl(var(--foreground))",
|
|
25991
|
+
primary: {
|
|
25992
|
+
DEFAULT: "hsl(var(--primary))",
|
|
25993
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
25994
|
+
},
|
|
25995
|
+
secondary: {
|
|
25996
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
25997
|
+
foreground: "hsl(var(--secondary-foreground))",
|
|
25998
|
+
},
|
|
25999
|
+
destructive: {
|
|
26000
|
+
DEFAULT: "hsl(var(--destructive))",
|
|
26001
|
+
foreground: "hsl(var(--destructive-foreground))",
|
|
26002
|
+
},
|
|
26003
|
+
muted: {
|
|
26004
|
+
DEFAULT: "hsl(var(--muted))",
|
|
26005
|
+
foreground: "hsl(var(--muted-foreground))",
|
|
26006
|
+
},
|
|
26007
|
+
accent: {
|
|
26008
|
+
DEFAULT: "hsl(var(--accent))",
|
|
26009
|
+
foreground: "hsl(var(--accent-foreground))",
|
|
26010
|
+
},
|
|
26011
|
+
popover: {
|
|
26012
|
+
DEFAULT: "hsl(var(--popover))",
|
|
26013
|
+
foreground: "hsl(var(--popover-foreground))",
|
|
26014
|
+
},
|
|
26015
|
+
card: {
|
|
26016
|
+
DEFAULT: "hsl(var(--card))",
|
|
26017
|
+
foreground: "hsl(var(--card-foreground))",
|
|
26018
|
+
},
|
|
26019
|
+
},
|
|
26020
|
+
borderRadius: {
|
|
26021
|
+
lg: "var(--radius)",
|
|
26022
|
+
md: "calc(var(--radius) - 2px)",
|
|
26023
|
+
sm: "calc(var(--radius) - 4px)",
|
|
26024
|
+
},
|
|
26025
|
+
},
|
|
26026
|
+
},
|
|
26027
|
+
plugins: [],
|
|
26028
|
+
};
|
|
26029
|
+
|
|
26030
|
+
export default config;
|
|
26031
|
+
`;
|
|
26032
|
+
await writeFile(tailwindConfigPath, newTailwindConfig);
|
|
26033
|
+
}
|
|
26034
|
+
if (context.install !== false) {}
|
|
26035
|
+
await createShadcnExample(projectPath, false);
|
|
26036
|
+
await createShadcnDocs(projectPath, false, context);
|
|
26037
|
+
}
|
|
26038
|
+
async function setupShadcnMonorepo(projectPath, context) {
|
|
26039
|
+
const packageName = context.packageName || context.projectName.toLowerCase().replace(/\s+/g, "-");
|
|
26040
|
+
const uiPackageName = `@${packageName}/ui`;
|
|
26041
|
+
const style = context.shadcnStyle || "new-york";
|
|
26042
|
+
const baseColor = context.shadcnBaseColor || "zinc";
|
|
26043
|
+
const radius = context.shadcnRadius || "0.625rem";
|
|
26044
|
+
await ensureDirectory(join(projectPath, "packages/ui/src/components"));
|
|
26045
|
+
await ensureDirectory(join(projectPath, "packages/ui/src/lib"));
|
|
26046
|
+
await ensureDirectory(join(projectPath, "packages/ui/src/hooks"));
|
|
26047
|
+
await ensureDirectory(join(projectPath, "packages/ui/src/styles"));
|
|
26048
|
+
const uiPackageJson = {
|
|
26049
|
+
name: uiPackageName,
|
|
26050
|
+
version: "0.0.0",
|
|
26051
|
+
private: true,
|
|
26052
|
+
main: "./src/index.ts",
|
|
26053
|
+
types: "./src/index.ts",
|
|
26054
|
+
exports: {
|
|
26055
|
+
"./components": "./src/components/index.ts",
|
|
26056
|
+
"./lib/utils": "./src/lib/utils.ts",
|
|
26057
|
+
"./hooks": "./src/hooks/index.ts",
|
|
26058
|
+
"./styles": "./src/styles/globals.css"
|
|
26059
|
+
},
|
|
26060
|
+
dependencies: {
|
|
26061
|
+
"@radix-ui/react-slot": "catalog:",
|
|
26062
|
+
"class-variance-authority": "catalog:",
|
|
26063
|
+
clsx: "catalog:",
|
|
26064
|
+
"tailwind-merge": "catalog:",
|
|
26065
|
+
"lucide-react": "catalog:"
|
|
26066
|
+
},
|
|
26067
|
+
devDependencies: {
|
|
26068
|
+
"@types/react": "catalog:",
|
|
26069
|
+
"@types/react-dom": "catalog:",
|
|
26070
|
+
typescript: "catalog:"
|
|
26071
|
+
}
|
|
26072
|
+
};
|
|
26073
|
+
await writeFile(join(projectPath, "packages/ui/package.json"), JSON.stringify(uiPackageJson, null, 2));
|
|
26074
|
+
const uiComponentsJson = {
|
|
26075
|
+
$schema: "https://ui.shadcn.com/schema.json",
|
|
26076
|
+
style,
|
|
26077
|
+
rsc: true,
|
|
26078
|
+
tsx: true,
|
|
26079
|
+
tailwind: {
|
|
26080
|
+
config: "",
|
|
26081
|
+
css: "src/styles/globals.css",
|
|
26082
|
+
baseColor,
|
|
26083
|
+
cssVariables: true
|
|
26084
|
+
},
|
|
26085
|
+
iconLibrary: "lucide",
|
|
26086
|
+
aliases: {
|
|
26087
|
+
components: "@workspace/ui/components",
|
|
26088
|
+
utils: "@workspace/ui/lib/utils",
|
|
26089
|
+
hooks: "@workspace/ui/hooks",
|
|
26090
|
+
lib: "@workspace/ui/lib",
|
|
26091
|
+
ui: "@workspace/ui/components"
|
|
26092
|
+
}
|
|
26093
|
+
};
|
|
26094
|
+
await writeFile(join(projectPath, "packages/ui/components.json"), JSON.stringify(uiComponentsJson, null, 2));
|
|
26095
|
+
const uiUtilsContent = `import { clsx, type ClassValue } from 'clsx';
|
|
26096
|
+
import { twMerge } from 'tailwind-merge';
|
|
26097
|
+
|
|
26098
|
+
export function cn(...inputs: ClassValue[]) {
|
|
26099
|
+
return twMerge(clsx(inputs));
|
|
26100
|
+
}
|
|
26101
|
+
`;
|
|
26102
|
+
await writeFile(join(projectPath, "packages/ui/src/lib/utils.ts"), uiUtilsContent);
|
|
26103
|
+
const uiComponentsIndex = `// Export shadcn/ui components here
|
|
26104
|
+
// Components will be added via: bunx shadcn@latest add [component]
|
|
26105
|
+
`;
|
|
26106
|
+
await writeFile(join(projectPath, "packages/ui/src/components/index.ts"), uiComponentsIndex);
|
|
26107
|
+
const uiHooksIndex = `// Export custom hooks here
|
|
26108
|
+
`;
|
|
26109
|
+
await writeFile(join(projectPath, "packages/ui/src/hooks/index.ts"), uiHooksIndex);
|
|
26110
|
+
const theme = themes[baseColor] || themes.zinc;
|
|
26111
|
+
const uiGlobalsCss = generateThemeCSS(theme, radius);
|
|
26112
|
+
await writeFile(join(projectPath, "packages/ui/src/styles/globals.css"), uiGlobalsCss);
|
|
26113
|
+
const uiTsconfig = {
|
|
26114
|
+
compilerOptions: {
|
|
26115
|
+
target: "ES2017",
|
|
26116
|
+
lib: ["dom", "dom.iterable", "esnext"],
|
|
26117
|
+
allowJs: true,
|
|
26118
|
+
skipLibCheck: true,
|
|
26119
|
+
strict: true,
|
|
26120
|
+
noEmit: true,
|
|
26121
|
+
esModuleInterop: true,
|
|
26122
|
+
module: "esnext",
|
|
26123
|
+
moduleResolution: "bundler",
|
|
26124
|
+
resolveJsonModule: true,
|
|
26125
|
+
isolatedModules: true,
|
|
26126
|
+
jsx: "react-jsx",
|
|
26127
|
+
types: ["react", "react-dom"]
|
|
26128
|
+
},
|
|
26129
|
+
include: ["src/**/*"],
|
|
26130
|
+
exclude: ["node_modules"]
|
|
26131
|
+
};
|
|
26132
|
+
await writeFile(join(projectPath, "packages/ui/tsconfig.json"), JSON.stringify(uiTsconfig, null, 2));
|
|
26133
|
+
await ensureDirectory(join(projectPath, "apps/web/src/components"));
|
|
26134
|
+
await ensureDirectory(join(projectPath, "apps/web/src/lib"));
|
|
26135
|
+
const webComponentsJson = {
|
|
26136
|
+
$schema: "https://ui.shadcn.com/schema.json",
|
|
26137
|
+
style,
|
|
26138
|
+
rsc: true,
|
|
26139
|
+
tsx: true,
|
|
26140
|
+
tailwind: {
|
|
26141
|
+
config: "",
|
|
26142
|
+
css: "../../packages/ui/src/styles/globals.css",
|
|
26143
|
+
baseColor,
|
|
26144
|
+
cssVariables: true
|
|
26145
|
+
},
|
|
26146
|
+
iconLibrary: "lucide",
|
|
26147
|
+
aliases: {
|
|
26148
|
+
components: "@/components",
|
|
26149
|
+
hooks: "@/hooks",
|
|
26150
|
+
lib: "@/lib",
|
|
26151
|
+
utils: "@workspace/ui/lib/utils",
|
|
26152
|
+
ui: "@workspace/ui/components"
|
|
26153
|
+
}
|
|
26154
|
+
};
|
|
26155
|
+
await writeFile(join(projectPath, "apps/web/components.json"), JSON.stringify(webComponentsJson, null, 2));
|
|
26156
|
+
const webGlobalsCssPath = join(projectPath, "apps/web/src/app/globals.css");
|
|
26157
|
+
const webGlobalsCss = `@import "../../../packages/ui/src/styles/globals.css";
|
|
26158
|
+
`;
|
|
26159
|
+
await writeFile(webGlobalsCssPath, webGlobalsCss);
|
|
26160
|
+
const webPackageJsonPath = join(projectPath, "apps/web/package.json");
|
|
26161
|
+
let webPackageJson = {};
|
|
26162
|
+
try {
|
|
26163
|
+
webPackageJson = JSON.parse(await Bun.file(webPackageJsonPath).text());
|
|
26164
|
+
} catch {}
|
|
26165
|
+
if (webPackageJson.dependencies) {
|
|
26166
|
+
webPackageJson.dependencies[uiPackageName] = "workspace:*";
|
|
26167
|
+
await writeFile(webPackageJsonPath, JSON.stringify(webPackageJson, null, 2));
|
|
26168
|
+
}
|
|
26169
|
+
await ensureDirectory(join(projectPath, "apps/platform/src/components"));
|
|
26170
|
+
await ensureDirectory(join(projectPath, "apps/platform/src/lib"));
|
|
26171
|
+
const platformComponentsJson = {
|
|
26172
|
+
$schema: "https://ui.shadcn.com/schema.json",
|
|
26173
|
+
style,
|
|
26174
|
+
rsc: true,
|
|
26175
|
+
tsx: true,
|
|
26176
|
+
tailwind: {
|
|
26177
|
+
config: "",
|
|
26178
|
+
css: "../../packages/ui/src/styles/globals.css",
|
|
26179
|
+
baseColor,
|
|
26180
|
+
cssVariables: true
|
|
26181
|
+
},
|
|
26182
|
+
iconLibrary: "lucide",
|
|
26183
|
+
aliases: {
|
|
26184
|
+
components: "@/components",
|
|
26185
|
+
hooks: "@/hooks",
|
|
26186
|
+
lib: "@/lib",
|
|
26187
|
+
utils: "@workspace/ui/lib/utils",
|
|
26188
|
+
ui: "@workspace/ui/components"
|
|
26189
|
+
}
|
|
26190
|
+
};
|
|
26191
|
+
await writeFile(join(projectPath, "apps/platform/components.json"), JSON.stringify(platformComponentsJson, null, 2));
|
|
26192
|
+
const platformGlobalsCssPath = join(projectPath, "apps/platform/src/app/globals.css");
|
|
26193
|
+
const platformGlobalsCss = `@import "../../../packages/ui/src/styles/globals.css";
|
|
26194
|
+
`;
|
|
26195
|
+
await writeFile(platformGlobalsCssPath, platformGlobalsCss);
|
|
26196
|
+
const platformPackageJsonPath = join(projectPath, "apps/platform/package.json");
|
|
26197
|
+
let platformPackageJson = {};
|
|
26198
|
+
try {
|
|
26199
|
+
platformPackageJson = JSON.parse(await Bun.file(platformPackageJsonPath).text());
|
|
26200
|
+
} catch {}
|
|
26201
|
+
if (platformPackageJson.dependencies) {
|
|
26202
|
+
platformPackageJson.dependencies[uiPackageName] = "workspace:*";
|
|
26203
|
+
await writeFile(platformPackageJsonPath, JSON.stringify(platformPackageJson, null, 2));
|
|
26204
|
+
}
|
|
26205
|
+
const updateAppTailwindConfig = async (appPath) => {
|
|
26206
|
+
const tailwindConfigPath = join(projectPath, appPath, "tailwind.config.ts");
|
|
26207
|
+
let tailwindConfig = "";
|
|
26208
|
+
try {
|
|
26209
|
+
tailwindConfig = await Bun.file(tailwindConfigPath).text();
|
|
26210
|
+
} catch {}
|
|
26211
|
+
const shadcnTheme = ` theme: {
|
|
26212
|
+
extend: {
|
|
26213
|
+
colors: {
|
|
26214
|
+
border: "hsl(var(--border))",
|
|
26215
|
+
input: "hsl(var(--input))",
|
|
26216
|
+
ring: "hsl(var(--ring))",
|
|
26217
|
+
background: "hsl(var(--background))",
|
|
26218
|
+
foreground: "hsl(var(--foreground))",
|
|
26219
|
+
primary: {
|
|
26220
|
+
DEFAULT: "hsl(var(--primary))",
|
|
26221
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
26222
|
+
},
|
|
26223
|
+
secondary: {
|
|
26224
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
26225
|
+
foreground: "hsl(var(--secondary-foreground))",
|
|
26226
|
+
},
|
|
26227
|
+
destructive: {
|
|
26228
|
+
DEFAULT: "hsl(var(--destructive))",
|
|
26229
|
+
foreground: "hsl(var(--destructive-foreground))",
|
|
26230
|
+
},
|
|
26231
|
+
muted: {
|
|
26232
|
+
DEFAULT: "hsl(var(--muted))",
|
|
26233
|
+
foreground: "hsl(var(--muted-foreground))",
|
|
26234
|
+
},
|
|
26235
|
+
accent: {
|
|
26236
|
+
DEFAULT: "hsl(var(--accent))",
|
|
26237
|
+
foreground: "hsl(var(--accent-foreground))",
|
|
26238
|
+
},
|
|
26239
|
+
popover: {
|
|
26240
|
+
DEFAULT: "hsl(var(--popover))",
|
|
26241
|
+
foreground: "hsl(var(--popover-foreground))",
|
|
26242
|
+
},
|
|
26243
|
+
card: {
|
|
26244
|
+
DEFAULT: "hsl(var(--card))",
|
|
26245
|
+
foreground: "hsl(var(--card-foreground))",
|
|
26246
|
+
},
|
|
26247
|
+
},
|
|
26248
|
+
borderRadius: {
|
|
26249
|
+
lg: "var(--radius)",
|
|
26250
|
+
md: "calc(var(--radius) - 2px)",
|
|
26251
|
+
sm: "calc(var(--radius) - 4px)",
|
|
26252
|
+
},
|
|
26253
|
+
},
|
|
26254
|
+
},`;
|
|
26255
|
+
if (tailwindConfig && !tailwindConfig.includes("hsl(var(--background))")) {
|
|
26256
|
+
if (tailwindConfig.includes("theme:")) {
|
|
26257
|
+
const updatedConfig = tailwindConfig.replace(/theme:\s*\{[^}]*\}/s, shadcnTheme.trim());
|
|
26258
|
+
await writeFile(tailwindConfigPath, updatedConfig);
|
|
26259
|
+
} else {
|
|
26260
|
+
const updatedConfig = tailwindConfig.replace(/(\s*)(plugins:.*?)(\n\s*\};)/s, `$1$2$1${shadcnTheme}$3`);
|
|
26261
|
+
await writeFile(tailwindConfigPath, updatedConfig);
|
|
26262
|
+
}
|
|
26263
|
+
} else if (!tailwindConfig) {
|
|
26264
|
+
const newTailwindConfig = `import type { Config } from 'tailwindcss';
|
|
26265
|
+
|
|
26266
|
+
const config: Config = {
|
|
26267
|
+
content: ['./src/**/*.{js,ts,jsx,tsx,mdx}'],
|
|
26268
|
+
theme: {
|
|
26269
|
+
extend: {
|
|
26270
|
+
colors: {
|
|
26271
|
+
border: "hsl(var(--border))",
|
|
26272
|
+
input: "hsl(var(--input))",
|
|
26273
|
+
ring: "hsl(var(--ring))",
|
|
26274
|
+
background: "hsl(var(--background))",
|
|
26275
|
+
foreground: "hsl(var(--foreground))",
|
|
26276
|
+
primary: {
|
|
26277
|
+
DEFAULT: "hsl(var(--primary))",
|
|
26278
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
26279
|
+
},
|
|
26280
|
+
secondary: {
|
|
26281
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
26282
|
+
foreground: "hsl(var(--secondary-foreground))",
|
|
26283
|
+
},
|
|
26284
|
+
destructive: {
|
|
26285
|
+
DEFAULT: "hsl(var(--destructive))",
|
|
26286
|
+
foreground: "hsl(var(--destructive-foreground))",
|
|
26287
|
+
},
|
|
26288
|
+
muted: {
|
|
26289
|
+
DEFAULT: "hsl(var(--muted))",
|
|
26290
|
+
foreground: "hsl(var(--muted-foreground))",
|
|
26291
|
+
},
|
|
26292
|
+
accent: {
|
|
26293
|
+
DEFAULT: "hsl(var(--accent))",
|
|
26294
|
+
foreground: "hsl(var(--accent-foreground))",
|
|
26295
|
+
},
|
|
26296
|
+
popover: {
|
|
26297
|
+
DEFAULT: "hsl(var(--popover))",
|
|
26298
|
+
foreground: "hsl(var(--popover-foreground))",
|
|
26299
|
+
},
|
|
26300
|
+
card: {
|
|
26301
|
+
DEFAULT: "hsl(var(--card))",
|
|
26302
|
+
foreground: "hsl(var(--card-foreground))",
|
|
26303
|
+
},
|
|
26304
|
+
},
|
|
26305
|
+
borderRadius: {
|
|
26306
|
+
lg: "var(--radius)",
|
|
26307
|
+
md: "calc(var(--radius) - 2px)",
|
|
26308
|
+
sm: "calc(var(--radius) - 4px)",
|
|
26309
|
+
},
|
|
26310
|
+
},
|
|
26311
|
+
},
|
|
26312
|
+
plugins: [],
|
|
26313
|
+
};
|
|
26314
|
+
|
|
26315
|
+
export default config;
|
|
26316
|
+
`;
|
|
26317
|
+
await writeFile(tailwindConfigPath, newTailwindConfig);
|
|
26318
|
+
}
|
|
26319
|
+
};
|
|
26320
|
+
await updateAppTailwindConfig("apps/web");
|
|
26321
|
+
await updateAppTailwindConfig("apps/platform");
|
|
26322
|
+
const rootPackageJsonPath = join(projectPath, "package.json");
|
|
26323
|
+
let rootPackageJson = {};
|
|
26324
|
+
try {
|
|
26325
|
+
rootPackageJson = JSON.parse(await Bun.file(rootPackageJsonPath).text());
|
|
26326
|
+
} catch {}
|
|
26327
|
+
if (rootPackageJson.catalog) {
|
|
26328
|
+
rootPackageJson.catalog["lucide-react"] = "^0.468.0";
|
|
26329
|
+
await writeFile(rootPackageJsonPath, JSON.stringify(rootPackageJson, null, 2));
|
|
26330
|
+
}
|
|
26331
|
+
await createShadcnExample(join(projectPath, "apps/web"), true);
|
|
26332
|
+
await createShadcnExample(join(projectPath, "apps/platform"), true);
|
|
26333
|
+
await createShadcnDocs(join(projectPath, "packages/ui"), true, context);
|
|
26334
|
+
}
|
|
26335
|
+
|
|
25077
26336
|
// ../templates/src/builders/web.ts
|
|
25078
26337
|
async function buildWebPreset(projectPath, context) {
|
|
25079
26338
|
await ensureDirectory(join(projectPath, "src/app"));
|
|
@@ -25205,6 +26464,9 @@ export default config;
|
|
|
25205
26464
|
if (context.cicd) {
|
|
25206
26465
|
await setupGitHubActions(projectPath, context);
|
|
25207
26466
|
}
|
|
26467
|
+
if (context.uiLibrary === "shadcn" && context.cssFramework === "tailwind") {
|
|
26468
|
+
await setupShadcnWeb(projectPath, context);
|
|
26469
|
+
}
|
|
25208
26470
|
}
|
|
25209
26471
|
// ../templates/src/builders/api.ts
|
|
25210
26472
|
init_dist();
|
|
@@ -25619,6 +26881,7 @@ async function buildFullPreset(projectPath, context) {
|
|
|
25619
26881
|
clsx: "^2.1.1",
|
|
25620
26882
|
"tailwind-merge": "^3.3.1",
|
|
25621
26883
|
"iconoir-react": "^7.11.0",
|
|
26884
|
+
"lucide-react": "^0.468.0",
|
|
25622
26885
|
"@biomejs/biome": "^2.3.0",
|
|
25623
26886
|
ultracite: "^6.0.1",
|
|
25624
26887
|
vitest: "^2.0.0",
|
|
@@ -26228,6 +27491,9 @@ ${context.database && context.database !== "none" && context.database !== "supab
|
|
|
26228
27491
|
if (context.cicd) {
|
|
26229
27492
|
await setupGitHubActions(projectPath, context);
|
|
26230
27493
|
}
|
|
27494
|
+
if (context.uiLibrary === "shadcn" && context.cssFramework === "tailwind") {
|
|
27495
|
+
await setupShadcnMonorepo(projectPath, context);
|
|
27496
|
+
}
|
|
26231
27497
|
}
|
|
26232
27498
|
// ../templates/src/builders/workspace.ts
|
|
26233
27499
|
init_dist();
|
|
@@ -26711,6 +27977,98 @@ async function enhancedInitCommand(options = {}) {
|
|
|
26711
27977
|
uiLibrary = "shadcn";
|
|
26712
27978
|
}
|
|
26713
27979
|
}
|
|
27980
|
+
let shadcnStyle = getOptionValue("BUNKIT_SHADCN_STYLE", options.shadcnStyle);
|
|
27981
|
+
if (!shadcnStyle && uiLibrary === "shadcn") {
|
|
27982
|
+
if (!isNonInteractive) {
|
|
27983
|
+
shadcnStyle = await ve({
|
|
27984
|
+
message: "\uD83C\uDFA8 shadcn/ui style?",
|
|
27985
|
+
options: [
|
|
27986
|
+
{
|
|
27987
|
+
value: "new-york",
|
|
27988
|
+
label: "New York (Recommended)",
|
|
27989
|
+
hint: "Modern, clean design with rounded corners and subtle shadows"
|
|
27990
|
+
},
|
|
27991
|
+
{
|
|
27992
|
+
value: "default",
|
|
27993
|
+
label: "Default",
|
|
27994
|
+
hint: "Classic design with sharper edges and more contrast"
|
|
27995
|
+
}
|
|
27996
|
+
]
|
|
27997
|
+
});
|
|
27998
|
+
if (pD(shadcnStyle)) {
|
|
27999
|
+
xe("Operation cancelled.");
|
|
28000
|
+
process.exit(0);
|
|
28001
|
+
}
|
|
28002
|
+
} else {
|
|
28003
|
+
shadcnStyle = "new-york";
|
|
28004
|
+
}
|
|
28005
|
+
}
|
|
28006
|
+
let shadcnBaseColor = getOptionValue("BUNKIT_SHADCN_BASE_COLOR", options.shadcnBaseColor);
|
|
28007
|
+
if (!shadcnBaseColor && uiLibrary === "shadcn") {
|
|
28008
|
+
if (!isNonInteractive) {
|
|
28009
|
+
shadcnBaseColor = await ve({
|
|
28010
|
+
message: "\uD83C\uDFA8 shadcn/ui base color?",
|
|
28011
|
+
options: [
|
|
28012
|
+
{
|
|
28013
|
+
value: "zinc",
|
|
28014
|
+
label: "Zinc (Recommended)",
|
|
28015
|
+
hint: "Neutral gray - versatile and modern"
|
|
28016
|
+
},
|
|
28017
|
+
{
|
|
28018
|
+
value: "neutral",
|
|
28019
|
+
label: "Neutral",
|
|
28020
|
+
hint: "Pure neutral - no color cast"
|
|
28021
|
+
},
|
|
28022
|
+
{
|
|
28023
|
+
value: "gray",
|
|
28024
|
+
label: "Gray",
|
|
28025
|
+
hint: "Warm gray - slightly warmer than zinc"
|
|
28026
|
+
},
|
|
28027
|
+
{
|
|
28028
|
+
value: "slate",
|
|
28029
|
+
label: "Slate",
|
|
28030
|
+
hint: "Cool gray - slightly bluer tone"
|
|
28031
|
+
},
|
|
28032
|
+
{
|
|
28033
|
+
value: "stone",
|
|
28034
|
+
label: "Stone",
|
|
28035
|
+
hint: "Warm beige-gray - earthy and natural"
|
|
28036
|
+
}
|
|
28037
|
+
]
|
|
28038
|
+
});
|
|
28039
|
+
if (pD(shadcnBaseColor)) {
|
|
28040
|
+
xe("Operation cancelled.");
|
|
28041
|
+
process.exit(0);
|
|
28042
|
+
}
|
|
28043
|
+
} else {
|
|
28044
|
+
shadcnBaseColor = "zinc";
|
|
28045
|
+
}
|
|
28046
|
+
}
|
|
28047
|
+
let shadcnRadius = getOptionValue("BUNKIT_SHADCN_RADIUS", options.shadcnRadius);
|
|
28048
|
+
if (!shadcnRadius && uiLibrary === "shadcn") {
|
|
28049
|
+
if (!isNonInteractive) {
|
|
28050
|
+
const radiusInput = await he({
|
|
28051
|
+
message: "\uD83D\uDCD0 Border radius?",
|
|
28052
|
+
placeholder: "0.625rem",
|
|
28053
|
+
initialValue: "0.625rem",
|
|
28054
|
+
validate: (value) => {
|
|
28055
|
+
if (!value.trim()) {
|
|
28056
|
+
return "Radius cannot be empty";
|
|
28057
|
+
}
|
|
28058
|
+
if (!/^\d+(\.\d+)?(rem|px|em|%)$/.test(value.trim())) {
|
|
28059
|
+
return "Please enter a valid CSS value (e.g., 0.5rem, 8px)";
|
|
28060
|
+
}
|
|
28061
|
+
}
|
|
28062
|
+
});
|
|
28063
|
+
if (pD(radiusInput)) {
|
|
28064
|
+
xe("Operation cancelled.");
|
|
28065
|
+
process.exit(0);
|
|
28066
|
+
}
|
|
28067
|
+
shadcnRadius = radiusInput;
|
|
28068
|
+
} else {
|
|
28069
|
+
shadcnRadius = "0.625rem";
|
|
28070
|
+
}
|
|
28071
|
+
}
|
|
26714
28072
|
let testing = getOptionValue("BUNKIT_TESTING", options.testing, "bun-test");
|
|
26715
28073
|
if (!testing) {
|
|
26716
28074
|
if (!isNonInteractive) {
|
|
@@ -26803,8 +28161,7 @@ async function enhancedInitCommand(options = {}) {
|
|
|
26803
28161
|
}
|
|
26804
28162
|
}
|
|
26805
28163
|
if (!isNonInteractive) {
|
|
26806
|
-
|
|
26807
|
-
` + boxen([
|
|
28164
|
+
const summaryLines = [
|
|
26808
28165
|
`${source_default.bold("Project:")} ${source_default.cyan(projectName)}`,
|
|
26809
28166
|
`${source_default.bold("Preset:")} ${source_default.cyan(preset)}`,
|
|
26810
28167
|
database ? `${source_default.bold("Database:")} ${source_default.cyan(database)}` : "",
|
|
@@ -26812,10 +28169,15 @@ async function enhancedInitCommand(options = {}) {
|
|
|
26812
28169
|
`${source_default.bold("TypeScript:")} ${source_default.cyan(tsStrictness)}`,
|
|
26813
28170
|
cssFramework ? `${source_default.bold("CSS:")} ${source_default.cyan(cssFramework)}` : "",
|
|
26814
28171
|
uiLibrary ? `${source_default.bold("UI Library:")} ${source_default.cyan(uiLibrary)}` : "",
|
|
28172
|
+
uiLibrary === "shadcn" && shadcnStyle ? `${source_default.bold("shadcn Style:")} ${source_default.cyan(shadcnStyle)}` : "",
|
|
28173
|
+
uiLibrary === "shadcn" && shadcnBaseColor ? `${source_default.bold("shadcn Base Color:")} ${source_default.cyan(shadcnBaseColor)}` : "",
|
|
28174
|
+
uiLibrary === "shadcn" && shadcnRadius ? `${source_default.bold("shadcn Radius:")} ${source_default.cyan(shadcnRadius)}` : "",
|
|
26815
28175
|
`${source_default.bold("Testing:")} ${source_default.cyan(testing)}`,
|
|
26816
28176
|
docker ? `${source_default.bold("Docker:")} ${source_default.green("\u2713")}` : "",
|
|
26817
28177
|
cicd ? `${source_default.bold("CI/CD:")} ${source_default.green("\u2713")}` : ""
|
|
26818
|
-
].filter(Boolean)
|
|
28178
|
+
].filter(Boolean);
|
|
28179
|
+
console.log(`
|
|
28180
|
+
` + boxen(summaryLines.join(`
|
|
26819
28181
|
`), {
|
|
26820
28182
|
padding: 1,
|
|
26821
28183
|
title: "\uD83D\uDCCB Configuration",
|
|
@@ -26850,7 +28212,10 @@ async function enhancedInitCommand(options = {}) {
|
|
|
26850
28212
|
docker,
|
|
26851
28213
|
cicd,
|
|
26852
28214
|
envExample: true,
|
|
26853
|
-
pathAliases: true
|
|
28215
|
+
pathAliases: true,
|
|
28216
|
+
shadcnStyle,
|
|
28217
|
+
shadcnBaseColor,
|
|
28218
|
+
shadcnRadius
|
|
26854
28219
|
};
|
|
26855
28220
|
await createProject(config);
|
|
26856
28221
|
const projectPath = join(process.cwd(), config.path);
|
|
@@ -26908,6 +28273,24 @@ async function enhancedInitCommand(options = {}) {
|
|
|
26908
28273
|
} else if (shouldInstall && preset === "full") {
|
|
26909
28274
|
await installDependencies(projectPath);
|
|
26910
28275
|
}
|
|
28276
|
+
if (shouldInstall && uiLibrary === "shadcn" && (preset === "web" || preset === "full")) {
|
|
28277
|
+
s.message("\uD83E\uDDE9 Installing default shadcn/ui components...");
|
|
28278
|
+
try {
|
|
28279
|
+
if (preset === "full") {
|
|
28280
|
+
await installDefaultShadcnComponents(join(projectPath, "packages/ui"), {
|
|
28281
|
+
silent: true
|
|
28282
|
+
});
|
|
28283
|
+
} else {
|
|
28284
|
+
await installDefaultShadcnComponents(projectPath, {
|
|
28285
|
+
silent: true
|
|
28286
|
+
});
|
|
28287
|
+
}
|
|
28288
|
+
s.message("\u2705 Default components (button, card) installed");
|
|
28289
|
+
} catch (error) {
|
|
28290
|
+
s.message("\u26A0\uFE0F Could not install default components automatically");
|
|
28291
|
+
s.message(" Install them manually: bunx shadcn@latest add button card");
|
|
28292
|
+
}
|
|
28293
|
+
}
|
|
26911
28294
|
const getDevCommand = () => {
|
|
26912
28295
|
if (preset === "full" || preset === "web")
|
|
26913
28296
|
return "bun dev";
|
|
@@ -27425,6 +28808,123 @@ ${import_picocolors6.default.bold("Package info:")}
|
|
|
27425
28808
|
}
|
|
27426
28809
|
}
|
|
27427
28810
|
|
|
28811
|
+
// src/commands/add/component.ts
|
|
28812
|
+
init_dist();
|
|
28813
|
+
import { existsSync } from "fs";
|
|
28814
|
+
async function addComponentCommand(options = {}) {
|
|
28815
|
+
const cwd2 = options.cwd || process.cwd();
|
|
28816
|
+
const spinner = Y2();
|
|
28817
|
+
const componentsJsonPath = join(cwd2, "components.json");
|
|
28818
|
+
const isMonorepo = existsSync(join(cwd2, "packages/ui/components.json"));
|
|
28819
|
+
if (!existsSync(componentsJsonPath) && !isMonorepo) {
|
|
28820
|
+
M2.error("shadcn/ui is not configured in this project.");
|
|
28821
|
+
M2.info("Run `bunkit init` with --ui-library shadcn to set up shadcn/ui first.");
|
|
28822
|
+
process.exit(1);
|
|
28823
|
+
}
|
|
28824
|
+
const targetPath = isMonorepo ? join(cwd2, "packages/ui") : cwd2;
|
|
28825
|
+
let components = [];
|
|
28826
|
+
if (options.all) {
|
|
28827
|
+
const popularComponents = [
|
|
28828
|
+
"button",
|
|
28829
|
+
"card",
|
|
28830
|
+
"input",
|
|
28831
|
+
"label",
|
|
28832
|
+
"textarea",
|
|
28833
|
+
"select",
|
|
28834
|
+
"checkbox",
|
|
28835
|
+
"radio-group",
|
|
28836
|
+
"switch",
|
|
28837
|
+
"dialog",
|
|
28838
|
+
"dropdown-menu",
|
|
28839
|
+
"alert",
|
|
28840
|
+
"badge",
|
|
28841
|
+
"avatar",
|
|
28842
|
+
"separator",
|
|
28843
|
+
"skeleton",
|
|
28844
|
+
"tabs",
|
|
28845
|
+
"accordion",
|
|
28846
|
+
"alert-dialog",
|
|
28847
|
+
"aspect-ratio",
|
|
28848
|
+
"breadcrumb",
|
|
28849
|
+
"calendar",
|
|
28850
|
+
"carousel",
|
|
28851
|
+
"chart",
|
|
28852
|
+
"collapsible",
|
|
28853
|
+
"command",
|
|
28854
|
+
"context-menu",
|
|
28855
|
+
"drawer",
|
|
28856
|
+
"form",
|
|
28857
|
+
"hover-card",
|
|
28858
|
+
"menubar",
|
|
28859
|
+
"navigation-menu",
|
|
28860
|
+
"popover",
|
|
28861
|
+
"progress",
|
|
28862
|
+
"scroll-area",
|
|
28863
|
+
"sheet",
|
|
28864
|
+
"slider",
|
|
28865
|
+
"sonner",
|
|
28866
|
+
"table",
|
|
28867
|
+
"toast",
|
|
28868
|
+
"toggle",
|
|
28869
|
+
"tooltip"
|
|
28870
|
+
];
|
|
28871
|
+
const selected = await fe({
|
|
28872
|
+
message: "Select components to install:",
|
|
28873
|
+
options: popularComponents.map((comp) => ({
|
|
28874
|
+
value: comp,
|
|
28875
|
+
label: comp
|
|
28876
|
+
})),
|
|
28877
|
+
required: true
|
|
28878
|
+
});
|
|
28879
|
+
if (pD(selected)) {
|
|
28880
|
+
xe("Operation cancelled.");
|
|
28881
|
+
process.exit(0);
|
|
28882
|
+
}
|
|
28883
|
+
components = selected;
|
|
28884
|
+
} else if (options.components && options.components.length > 0) {
|
|
28885
|
+
components = options.components;
|
|
28886
|
+
} else {
|
|
28887
|
+
const componentInput = await he({
|
|
28888
|
+
message: "Component name(s) to install?",
|
|
28889
|
+
placeholder: "button, card, input",
|
|
28890
|
+
validate: (value) => {
|
|
28891
|
+
if (!value.trim()) {
|
|
28892
|
+
return "Please enter at least one component name";
|
|
28893
|
+
}
|
|
28894
|
+
}
|
|
28895
|
+
});
|
|
28896
|
+
if (pD(componentInput)) {
|
|
28897
|
+
xe("Operation cancelled.");
|
|
28898
|
+
process.exit(0);
|
|
28899
|
+
}
|
|
28900
|
+
components = componentInput.split(/[,\s]+/).map((c3) => c3.trim()).filter(Boolean);
|
|
28901
|
+
}
|
|
28902
|
+
if (components.length === 0) {
|
|
28903
|
+
M2.error("No components specified.");
|
|
28904
|
+
process.exit(1);
|
|
28905
|
+
}
|
|
28906
|
+
spinner.start(`Installing ${components.length} component(s)...`);
|
|
28907
|
+
try {
|
|
28908
|
+
await installShadcnComponents(targetPath, components, {
|
|
28909
|
+
silent: false,
|
|
28910
|
+
cwd: targetPath
|
|
28911
|
+
});
|
|
28912
|
+
spinner.stop(`\u2705 Installed: ${components.join(", ")}`);
|
|
28913
|
+
if (isMonorepo) {
|
|
28914
|
+
Me(`Components installed in packages/ui. Import them using:
|
|
28915
|
+
import { Button } from "@workspace/ui/components/ui/button"`, "Usage");
|
|
28916
|
+
} else {
|
|
28917
|
+
Me(`Import components using:
|
|
28918
|
+
import { Button } from "@/components/ui/button"`, "Usage");
|
|
28919
|
+
}
|
|
28920
|
+
} catch (error) {
|
|
28921
|
+
spinner.stop("\u274C Failed to install components");
|
|
28922
|
+
M2.error(error.message);
|
|
28923
|
+
M2.info("Try installing manually: bunx shadcn@latest add " + components.join(" "));
|
|
28924
|
+
process.exit(1);
|
|
28925
|
+
}
|
|
28926
|
+
}
|
|
28927
|
+
|
|
27428
28928
|
// src/commands/add.ts
|
|
27429
28929
|
async function addCommand(feature, options) {
|
|
27430
28930
|
try {
|
|
@@ -27443,9 +28943,16 @@ async function addCommand(feature, options) {
|
|
|
27443
28943
|
cwd: process.cwd()
|
|
27444
28944
|
});
|
|
27445
28945
|
break;
|
|
28946
|
+
case "component":
|
|
28947
|
+
await addComponentCommand({
|
|
28948
|
+
components: options.components,
|
|
28949
|
+
all: options.all,
|
|
28950
|
+
cwd: process.cwd()
|
|
28951
|
+
});
|
|
28952
|
+
break;
|
|
27446
28953
|
default:
|
|
27447
28954
|
M2.error(`Unknown feature: ${feature}`);
|
|
27448
|
-
M2.info(`Available features: workspace, package`);
|
|
28955
|
+
M2.info(`Available features: workspace, package, component`);
|
|
27449
28956
|
process.exit(1);
|
|
27450
28957
|
}
|
|
27451
28958
|
} catch (error) {
|
|
@@ -27458,7 +28965,7 @@ var packageJson = await Bun.file(new URL("../package.json", import.meta.url)).js
|
|
|
27458
28965
|
var VERSION = packageJson.version;
|
|
27459
28966
|
var program2 = new Command;
|
|
27460
28967
|
program2.name("bunkit").description("Bake production-ready apps in seconds").version(VERSION);
|
|
27461
|
-
program2.command("init").description("Create a new project with full customization").option("--name <name>", "Project name").option("--preset <preset>", "Preset type (minimal, web, api, full)").option("--database <database>", "Database (postgres-drizzle, supabase, sqlite-drizzle, none)").option("--code-quality <quality>", "Code quality (ultracite, biome)").option("--ts-strictness <strictness>", "TypeScript strictness (strict, moderate, loose)").option("--ui-library <library>", "UI library (shadcn, none)").option("--css-framework <framework>", "CSS framework (tailwind, vanilla, css-modules)").option("--testing <framework>", "Testing framework (bun-test, vitest, none)").option("--docker", "Add Docker configuration").option("--cicd", "Add GitHub Actions CI/CD").option("--no-git", "Skip git initialization").option("--no-install", "Skip dependency installation").option("--non-interactive", "Run without prompts (requires all options)").action(async (options) => {
|
|
28968
|
+
program2.command("init").description("Create a new project with full customization").option("--name <name>", "Project name").option("--preset <preset>", "Preset type (minimal, web, api, full)").option("--database <database>", "Database (postgres-drizzle, supabase, sqlite-drizzle, none)").option("--code-quality <quality>", "Code quality (ultracite, biome)").option("--ts-strictness <strictness>", "TypeScript strictness (strict, moderate, loose)").option("--ui-library <library>", "UI library (shadcn, none)").option("--css-framework <framework>", "CSS framework (tailwind, vanilla, css-modules)").option("--shadcn-style <style>", "shadcn/ui style (new-york, default)").option("--shadcn-base-color <color>", "shadcn/ui base color (neutral, gray, zinc, stone, slate)").option("--shadcn-radius <radius>", "shadcn/ui border radius (e.g., 0.5rem, 8px)").option("--testing <framework>", "Testing framework (bun-test, vitest, none)").option("--docker", "Add Docker configuration").option("--cicd", "Add GitHub Actions CI/CD").option("--no-git", "Skip git initialization").option("--no-install", "Skip dependency installation").option("--non-interactive", "Run without prompts (requires all options)").action(async (options) => {
|
|
27462
28969
|
showBanner(VERSION);
|
|
27463
28970
|
try {
|
|
27464
28971
|
await enhancedInitCommand(options);
|
|
@@ -27480,10 +28987,14 @@ program2.command("create").argument("<preset>", "Preset type (minimal, web, api,
|
|
|
27480
28987
|
process.exit(1);
|
|
27481
28988
|
}
|
|
27482
28989
|
});
|
|
27483
|
-
program2.command("add").argument("<feature>", "Feature to add (workspace, package)").option("--name <name>", "Name for the feature").option("--preset <preset>", "Preset for workspace (nextjs, hono, library)").option("--type <type>", "Type for package (library, utils, types, config)").description("Add workspace or
|
|
28990
|
+
program2.command("add").argument("<feature>", "Feature to add (workspace, package, component)").option("--name <name>", "Name for the feature").option("--preset <preset>", "Preset for workspace (nextjs, hono, library)").option("--type <type>", "Type for package (library, utils, types, config)").option("--components <components>", "Component names (comma-separated) for component feature").option("--all", "Show all available components (for component feature)").description("Add workspace, package, or shadcn/ui component to project").action(async (feature, options) => {
|
|
27484
28991
|
showBanner(VERSION);
|
|
27485
28992
|
try {
|
|
27486
|
-
|
|
28993
|
+
const parsedOptions = {
|
|
28994
|
+
...options,
|
|
28995
|
+
components: options.components && typeof options.components === "string" ? options.components.split(",").map((c3) => c3.trim()) : options.components
|
|
28996
|
+
};
|
|
28997
|
+
await addCommand(feature, parsedOptions);
|
|
27487
28998
|
Se(import_picocolors7.default.green("\u2728 Feature added successfully! \uD83C\uDF5E"));
|
|
27488
28999
|
} catch (error) {
|
|
27489
29000
|
M2.error(error.message);
|