@pauldvlp/vp-react-ts-shadcn 0.6.3 → 0.6.5
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/LICENSE +1 -1
- package/README.md +12 -12
- package/dist/index.js +89 -16
- package/package.json +4 -3
- package/template/_package.json +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -30,18 +30,18 @@ vp create @pauldvlp:vp-react-ts-shadcn -- \
|
|
|
30
30
|
|
|
31
31
|
## Options
|
|
32
32
|
|
|
33
|
-
| Option
|
|
34
|
-
|
|
|
35
|
-
| `--name`
|
|
36
|
-
| `--scope`
|
|
37
|
-
| `--base`
|
|
38
|
-
| `--preset`
|
|
39
|
-
| `--iconLibrary`
|
|
40
|
-
| `--cssVariables
|
|
41
|
-
| `--rtl`
|
|
42
|
-
| `--pointer`
|
|
43
|
-
| `--components`
|
|
44
|
-
| `--install`
|
|
33
|
+
| Option | Type / values | Default | Notes |
|
|
34
|
+
| ---------------- | ---------------------------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
35
|
+
| `--name` | string | `my-app` | Root project / package name. |
|
|
36
|
+
| `--scope` | string | `@<name>` | npm scope for workspace packages → `@scope/website`, `@scope/ui`. Defaults to the project name prefixed with `@` (e.g. `--name acme` → `@acme`); falls back to `@app`. |
|
|
37
|
+
| `--base` | `radix` \| `base` | `radix` | shadcn component library (radix-ui or @base-ui). Honored by `shadcn init --base`. |
|
|
38
|
+
| `--preset` | style name or code | `b30557okNu` | A style (`nova`, `vega`, `maia`, `lyra`, `mira`, `luma`, `sera`, `rhea`) **or** a code from ui.shadcn.com. **Owns** color, fonts, radius, baseColor, menu styling. |
|
|
39
|
+
| `--iconLibrary` | `lucide` \| `hugeicons` \| `radix` \| `tabler` | `hugeicons` | Icon library (persists; not part of the preset). |
|
|
40
|
+
| `--cssVariables` | boolean | `true` | CSS variables for theming. |
|
|
41
|
+
| `--rtl` | boolean | `false` | RTL support. |
|
|
42
|
+
| `--pointer` | boolean | `false` | Pointer cursor on interactive elements. |
|
|
43
|
+
| `--components` | comma list | `button,badge` | shadcn components to pre-install. `button` + `badge` are always included. |
|
|
44
|
+
| `--install` | boolean | `true` | Run install + apply the shadcn theme after scaffolding. `false` = files only. |
|
|
45
45
|
|
|
46
46
|
### What the preset controls vs. what you control
|
|
47
47
|
|
package/dist/index.js
CHANGED
|
@@ -188,7 +188,10 @@ function resolveDefault(d, options, directory) {
|
|
|
188
188
|
}
|
|
189
189
|
async function promptForOption(d, def) {
|
|
190
190
|
if (d.type === "boolean") {
|
|
191
|
-
return prompts.confirm({
|
|
191
|
+
return prompts.confirm({
|
|
192
|
+
message: d.message,
|
|
193
|
+
initialValue: def === void 0 ? false : Boolean(def)
|
|
194
|
+
});
|
|
192
195
|
}
|
|
193
196
|
if (d.type === "select") {
|
|
194
197
|
return prompts.select({
|
|
@@ -233,7 +236,11 @@ function initGit(dir) {
|
|
|
233
236
|
} catch {
|
|
234
237
|
identity = ["-c", "user.name=create", "-c", "user.email=create@users.noreply.github.com"];
|
|
235
238
|
}
|
|
236
|
-
execFileSync(
|
|
239
|
+
execFileSync(
|
|
240
|
+
"git",
|
|
241
|
+
[...identity, "commit", "-m", "feat: initialize project", "--no-gpg-sign"],
|
|
242
|
+
{ cwd: dir, stdio: "ignore" }
|
|
243
|
+
);
|
|
237
244
|
} catch {
|
|
238
245
|
}
|
|
239
246
|
}
|
|
@@ -249,7 +256,11 @@ async function runTemplateCLI(template) {
|
|
|
249
256
|
let directory = dirArg;
|
|
250
257
|
if (!directory) {
|
|
251
258
|
if (interactive) {
|
|
252
|
-
const answer = await prompts.text({
|
|
259
|
+
const answer = await prompts.text({
|
|
260
|
+
message: "Where should we create your project?",
|
|
261
|
+
placeholder: "my-app",
|
|
262
|
+
defaultValue: "my-app"
|
|
263
|
+
});
|
|
253
264
|
if (prompts.isCancel(answer)) {
|
|
254
265
|
prompts.cancel("Cancelled.");
|
|
255
266
|
return 2;
|
|
@@ -291,7 +302,11 @@ async function runTemplateCLI(template) {
|
|
|
291
302
|
for (const step of [...creation.scripts].sort((a, b) => a.phase - b.phase)) {
|
|
292
303
|
for (const [program, ...commandArgs] of step.commands) {
|
|
293
304
|
if (!program) continue;
|
|
294
|
-
execFileSync(program, commandArgs, {
|
|
305
|
+
execFileSync(program, commandArgs, {
|
|
306
|
+
cwd: directory,
|
|
307
|
+
stdio: "inherit",
|
|
308
|
+
shell: process.platform === "win32"
|
|
309
|
+
});
|
|
295
310
|
}
|
|
296
311
|
}
|
|
297
312
|
}
|
|
@@ -318,18 +333,69 @@ var template_default = defineTemplate({
|
|
|
318
333
|
},
|
|
319
334
|
options: [
|
|
320
335
|
// Default the name to the target directory the user chose, so they don't retype it.
|
|
321
|
-
{
|
|
336
|
+
{
|
|
337
|
+
key: "name",
|
|
338
|
+
type: "string",
|
|
339
|
+
message: "Root project / package name",
|
|
340
|
+
default: ({ directory }) => dirName(directory),
|
|
341
|
+
validate: validateName
|
|
342
|
+
},
|
|
322
343
|
// Lazily default the package scope to `@<name>` (prefixing `@` unless the name already has one),
|
|
323
344
|
// so it tracks the project name instead of a fixed value. Falls back to `@app` when no name is set.
|
|
324
|
-
{
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
345
|
+
{
|
|
346
|
+
key: "scope",
|
|
347
|
+
type: "string",
|
|
348
|
+
message: "npm scope for workspace packages, e.g. @acme (defaults to @<name>)",
|
|
349
|
+
default: ({ options }) => options.name ? toScope(options.name) : "@app",
|
|
350
|
+
validate: validateScope
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
key: "base",
|
|
354
|
+
type: "select",
|
|
355
|
+
message: "shadcn component library base (radix-ui or @base-ui)",
|
|
356
|
+
choices: ["radix", "base"],
|
|
357
|
+
default: "radix"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
key: "preset",
|
|
361
|
+
type: "string",
|
|
362
|
+
message: "shadcn preset: a style name (nova, vega, maia, lyra, mira, luma, sera, rhea) or a code from ui.shadcn.com",
|
|
363
|
+
default: DEFAULT_PRESET,
|
|
364
|
+
validate: validatePreset
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
key: "iconLibrary",
|
|
368
|
+
type: "select",
|
|
369
|
+
message: "Icon library",
|
|
370
|
+
choices: ["lucide", "hugeicons", "radix", "tabler"],
|
|
371
|
+
default: "hugeicons"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
key: "cssVariables",
|
|
375
|
+
type: "boolean",
|
|
376
|
+
message: "Use CSS variables for theming",
|
|
377
|
+
default: true
|
|
378
|
+
},
|
|
329
379
|
{ key: "rtl", type: "boolean", message: "Enable RTL support", default: false },
|
|
330
|
-
{
|
|
331
|
-
|
|
332
|
-
|
|
380
|
+
{
|
|
381
|
+
key: "pointer",
|
|
382
|
+
type: "boolean",
|
|
383
|
+
message: "Use pointer cursor on interactive elements",
|
|
384
|
+
default: false
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
key: "components",
|
|
388
|
+
type: "string",
|
|
389
|
+
message: "Comma-separated shadcn components to pre-install, e.g. button,card,dialog",
|
|
390
|
+
default: "button,badge",
|
|
391
|
+
validate: validateComponents
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
key: "install",
|
|
395
|
+
type: "boolean",
|
|
396
|
+
message: "Install deps and apply the shadcn theme after scaffolding",
|
|
397
|
+
default: true
|
|
398
|
+
}
|
|
333
399
|
],
|
|
334
400
|
async produce({ options }) {
|
|
335
401
|
const scope = toScope(options.scope || options.name || "app");
|
|
@@ -337,8 +403,12 @@ var template_default = defineTemplate({
|
|
|
337
403
|
TEMPLATE_DIR,
|
|
338
404
|
(_rel, content) => content.split("@app").join(scope).split("__PROJECT_NAME__").join(options.name)
|
|
339
405
|
);
|
|
340
|
-
setPath(
|
|
341
|
-
|
|
406
|
+
setPath(
|
|
407
|
+
files,
|
|
408
|
+
"packages/ui/components.json",
|
|
409
|
+
`${JSON.stringify(uiComponentsJson({ ...options, scope }), null, 2)}
|
|
410
|
+
`
|
|
411
|
+
);
|
|
342
412
|
setPath(
|
|
343
413
|
files,
|
|
344
414
|
"apps/website/components.json",
|
|
@@ -354,7 +424,10 @@ var template_default = defineTemplate({
|
|
|
354
424
|
const scripts = options.install ? [
|
|
355
425
|
{ commands: [["pnpm", "install", "--silent"]], phase: 0 },
|
|
356
426
|
{ commands: [["pnpm", "--filter", ui, "exec", "shadcn", "init", ...initArgs]], phase: 1 },
|
|
357
|
-
{
|
|
427
|
+
{
|
|
428
|
+
commands: [["pnpm", "--filter", ui, "exec", "shadcn", "add", ...adds, "-y"]],
|
|
429
|
+
phase: 2
|
|
430
|
+
}
|
|
358
431
|
] : [];
|
|
359
432
|
return {
|
|
360
433
|
files,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pauldvlp/vp-react-ts-shadcn",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Vite+ monorepo template: one frontend app (website) + a shared shadcn UI package, themeable via shadcn presets.",
|
|
5
|
-
"author": "
|
|
5
|
+
"author": "Paul Barahona <johanpaulbarahona@gmail.com> (https://github.com/pauldvlp/vp-templates)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/pauldvlp/vp-templates",
|
|
8
8
|
"repository": {
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "esbuild bin/index.ts --bundle --outfile=dist/index.js --format=esm --platform=node --target=node22 --packages=external",
|
|
40
|
-
"dev": "node bin/index.ts"
|
|
40
|
+
"dev": "node bin/index.ts",
|
|
41
|
+
"typecheck": "tsc --noEmit"
|
|
41
42
|
},
|
|
42
43
|
"bin": {
|
|
43
44
|
"vp-react-ts-shadcn": "./dist/index.js"
|