@pauldvlp/vp-pkg-shadcn 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 pauldvlp
3
+ Copyright (c) 2026 Paul Barahona
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -47,17 +47,17 @@ defaults to the **surrounding monorepo's scope** (read from the nearest `pnpm-wo
47
47
 
48
48
  ## Options
49
49
 
50
- | Option | Type / values | Default | Notes |
51
- | --------------- | ---------------------------------------------- | -------------- | --------------------------------------------------------------------------------------- |
52
- | `--scope` | string | monorepo scope | npm scope for the package → `@scope/ui`. Defaults to the surrounding monorepo's scope (e.g. `@acme`), `@app` outside a workspace. `@` is added if you omit it. |
53
- | `--base` | `radix` \| `base` | `radix` | shadcn component library (radix-ui or @base-ui). Honored by `shadcn init --base`. |
54
- | `--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. |
55
- | `--iconLibrary` | `lucide` \| `hugeicons` \| `radix` \| `tabler` | `hugeicons` | Icon library (persists; not part of the preset). |
56
- | `--cssVariables`| boolean | `true` | CSS variables for theming. |
57
- | `--rtl` | boolean | `false` | RTL support. |
58
- | `--pointer` | boolean | `false` | Pointer cursor on interactive elements. |
59
- | `--components` | comma list | `button,badge` | shadcn components to pre-install. `button` + `badge` are always included. |
60
- | `--install` | boolean | `true` | Run install + apply the shadcn theme after scaffolding. `false` = files only. |
50
+ | Option | Type / values | Default | Notes |
51
+ | ---------------- | ---------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
52
+ | `--scope` | string | monorepo scope | npm scope for the package → `@scope/ui`. Defaults to the surrounding monorepo's scope (e.g. `@acme`), `@app` outside a workspace. `@` is added if you omit it. |
53
+ | `--base` | `radix` \| `base` | `radix` | shadcn component library (radix-ui or @base-ui). Honored by `shadcn init --base`. |
54
+ | `--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. |
55
+ | `--iconLibrary` | `lucide` \| `hugeicons` \| `radix` \| `tabler` | `hugeicons` | Icon library (persists; not part of the preset). |
56
+ | `--cssVariables` | boolean | `true` | CSS variables for theming. |
57
+ | `--rtl` | boolean | `false` | RTL support. |
58
+ | `--pointer` | boolean | `false` | Pointer cursor on interactive elements. |
59
+ | `--components` | comma list | `button,badge` | shadcn components to pre-install. `button` + `badge` are always included. |
60
+ | `--install` | boolean | `true` | Run install + apply the shadcn theme after scaffolding. `false` = files only. |
61
61
 
62
62
  ## How it scaffolds
63
63
 
@@ -95,8 +95,8 @@ pnpm --filter <your-app> add -D @tailwindcss/vite tailwindcss
95
95
 
96
96
  ```ts
97
97
  // apps/<your-app>/vite.config.ts
98
- import tailwindcss from '@tailwindcss/vite'
99
- export default defineConfig({ plugins: [/* ...existing */ tailwindcss()] })
98
+ import tailwindcss from '@tailwindcss/vite';
99
+ export default defineConfig({ plugins: [/* ...existing */ tailwindcss()] });
100
100
  ```
101
101
 
102
102
  > `ui`'s `globals.css` already `@source`s `apps/**/*.{ts,tsx}` (and the `ui` package), so Tailwind
@@ -106,8 +106,8 @@ export default defineConfig({ plugins: [/* ...existing */ tailwindcss()] })
106
106
 
107
107
  ```tsx
108
108
  // apps/<your-app>/src/main.tsx
109
- import '@scope/ui/globals.css'
110
- import { Button } from '@scope/ui/components/ui/button'
109
+ import '@scope/ui/globals.css';
110
+ import { Button } from '@scope/ui/components/ui/button';
111
111
  ```
112
112
 
113
113
  ## Re-theme later
package/dist/index.js CHANGED
@@ -90,11 +90,17 @@ function patchJson(tree, relPath, mutate) {
90
90
  `;
91
91
  }
92
92
  function resolveCatalogDeps(pkg, catalog = CATALOG) {
93
- for (const field of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
93
+ for (const field of [
94
+ "dependencies",
95
+ "devDependencies",
96
+ "peerDependencies",
97
+ "optionalDependencies"
98
+ ]) {
94
99
  const deps = pkg[field];
95
100
  if (!deps) continue;
96
101
  for (const [name, range] of Object.entries(deps)) {
97
- if ((range === "catalog:" || range === "catalog:default") && catalog[name]) deps[name] = catalog[name];
102
+ if ((range === "catalog:" || range === "catalog:default") && catalog[name])
103
+ deps[name] = catalog[name];
98
104
  }
99
105
  }
100
106
  }
@@ -204,7 +210,10 @@ function resolveDefault(d, options, directory) {
204
210
  }
205
211
  async function promptForOption(d, def) {
206
212
  if (d.type === "boolean") {
207
- return prompts.confirm({ message: d.message, initialValue: def === void 0 ? false : Boolean(def) });
213
+ return prompts.confirm({
214
+ message: d.message,
215
+ initialValue: def === void 0 ? false : Boolean(def)
216
+ });
208
217
  }
209
218
  if (d.type === "select") {
210
219
  return prompts.select({
@@ -249,7 +258,11 @@ function initGit(dir) {
249
258
  } catch {
250
259
  identity = ["-c", "user.name=create", "-c", "user.email=create@users.noreply.github.com"];
251
260
  }
252
- execFileSync("git", [...identity, "commit", "-m", "feat: initialize project", "--no-gpg-sign"], { cwd: dir, stdio: "ignore" });
261
+ execFileSync(
262
+ "git",
263
+ [...identity, "commit", "-m", "feat: initialize project", "--no-gpg-sign"],
264
+ { cwd: dir, stdio: "ignore" }
265
+ );
253
266
  } catch {
254
267
  }
255
268
  }
@@ -265,7 +278,11 @@ async function runTemplateCLI(template) {
265
278
  let directory = dirArg;
266
279
  if (!directory) {
267
280
  if (interactive) {
268
- const answer = await prompts.text({ message: "Where should we create your project?", placeholder: "my-app", defaultValue: "my-app" });
281
+ const answer = await prompts.text({
282
+ message: "Where should we create your project?",
283
+ placeholder: "my-app",
284
+ defaultValue: "my-app"
285
+ });
269
286
  if (prompts.isCancel(answer)) {
270
287
  prompts.cancel("Cancelled.");
271
288
  return 2;
@@ -307,7 +324,11 @@ async function runTemplateCLI(template) {
307
324
  for (const step of [...creation.scripts].sort((a, b) => a.phase - b.phase)) {
308
325
  for (const [program, ...commandArgs] of step.commands) {
309
326
  if (!program) continue;
310
- execFileSync(program, commandArgs, { cwd: directory, stdio: "inherit" });
327
+ execFileSync(program, commandArgs, {
328
+ cwd: directory,
329
+ stdio: "inherit",
330
+ shell: process.platform === "win32"
331
+ });
311
332
  }
312
333
  }
313
334
  }
@@ -337,15 +358,60 @@ var template_default = defineTemplate({
337
358
  options: [
338
359
  // Default the scope to the surrounding monorepo's scope (e.g. `@acme`) so it tracks the repo
339
360
  // instead of a fixed `@app`. Falls back to `@app` when run outside a pnpm workspace.
340
- { key: "scope", type: "string", message: "npm scope for the workspace package, e.g. @acme", default: () => detectMonorepoScope() ?? "@app", validate: validateScope },
341
- { key: "base", type: "select", message: "shadcn component library base (radix-ui or @base-ui)", choices: ["radix", "base"], default: "radix" },
342
- { key: "preset", type: "string", message: "shadcn preset: a style name (nova, vega, maia, lyra, mira, luma, sera, rhea) or a code from ui.shadcn.com", default: DEFAULT_PRESET, validate: validatePreset },
343
- { key: "iconLibrary", type: "select", message: "Icon library", choices: ["lucide", "hugeicons", "radix", "tabler"], default: "hugeicons" },
344
- { key: "cssVariables", type: "boolean", message: "Use CSS variables for theming", default: true },
361
+ {
362
+ key: "scope",
363
+ type: "string",
364
+ message: "npm scope for the workspace package, e.g. @acme",
365
+ default: () => detectMonorepoScope() ?? "@app",
366
+ validate: validateScope
367
+ },
368
+ {
369
+ key: "base",
370
+ type: "select",
371
+ message: "shadcn component library base (radix-ui or @base-ui)",
372
+ choices: ["radix", "base"],
373
+ default: "radix"
374
+ },
375
+ {
376
+ key: "preset",
377
+ type: "string",
378
+ message: "shadcn preset: a style name (nova, vega, maia, lyra, mira, luma, sera, rhea) or a code from ui.shadcn.com",
379
+ default: DEFAULT_PRESET,
380
+ validate: validatePreset
381
+ },
382
+ {
383
+ key: "iconLibrary",
384
+ type: "select",
385
+ message: "Icon library",
386
+ choices: ["lucide", "hugeicons", "radix", "tabler"],
387
+ default: "hugeicons"
388
+ },
389
+ {
390
+ key: "cssVariables",
391
+ type: "boolean",
392
+ message: "Use CSS variables for theming",
393
+ default: true
394
+ },
345
395
  { key: "rtl", type: "boolean", message: "Enable RTL support", default: false },
346
- { key: "pointer", type: "boolean", message: "Use pointer cursor on interactive elements", default: false },
347
- { key: "components", type: "string", message: "Comma-separated shadcn components to pre-install, e.g. button,card,dialog", default: "button,badge", validate: validateComponents },
348
- { key: "install", type: "boolean", message: "Install deps and apply the shadcn theme after scaffolding", default: true }
396
+ {
397
+ key: "pointer",
398
+ type: "boolean",
399
+ message: "Use pointer cursor on interactive elements",
400
+ default: false
401
+ },
402
+ {
403
+ key: "components",
404
+ type: "string",
405
+ message: "Comma-separated shadcn components to pre-install, e.g. button,card,dialog",
406
+ default: "button,badge",
407
+ validate: validateComponents
408
+ },
409
+ {
410
+ key: "install",
411
+ type: "boolean",
412
+ message: "Install deps and apply the shadcn theme after scaffolding",
413
+ default: true
414
+ }
349
415
  ],
350
416
  async produce({ options }) {
351
417
  const scope = toScope(options.scope || "app");
@@ -354,15 +420,22 @@ var template_default = defineTemplate({
354
420
  resolveCatalogDeps(pkg);
355
421
  addIconDeps(pkg, options.iconLibrary);
356
422
  });
357
- setPath(files, "components.json", `${JSON.stringify(uiComponentsJson({ ...options, scope }), null, 2)}
358
- `);
423
+ setPath(
424
+ files,
425
+ "components.json",
426
+ `${JSON.stringify(uiComponentsJson({ ...options, scope }), null, 2)}
427
+ `
428
+ );
359
429
  const adds = withRequiredComponents(options.components);
360
430
  const ui = `${scope}/ui`;
361
431
  const initArgs = shadcnInitArgs(options);
362
432
  const scripts = options.install ? [
363
433
  { commands: [["pnpm", "install", "--silent"]], phase: 0 },
364
434
  { commands: [["pnpm", "--filter", ui, "exec", "shadcn", "init", ...initArgs]], phase: 1 },
365
- { commands: [["pnpm", "--filter", ui, "exec", "shadcn", "add", ...adds, "-y"]], phase: 2 }
435
+ {
436
+ commands: [["pnpm", "--filter", ui, "exec", "shadcn", "add", ...adds, "-y"]],
437
+ phase: 2
438
+ }
366
439
  ] : [];
367
440
  return {
368
441
  files,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@pauldvlp/vp-pkg-shadcn",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Add a shared, fully customizable shadcn UI package (packages/ui) into an existing Vite+ monorepo, themeable via shadcn presets.",
5
- "author": "pauldvlp (https://github.com/pauldvlp/vp-templates)",
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-pkg-shadcn": "./dist/index.js"