@pauldvlp/vp-react-ts-shadcn 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +12 -12
- package/dist/index.js +84 -15
- 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;
|
|
@@ -318,18 +329,69 @@ var template_default = defineTemplate({
|
|
|
318
329
|
},
|
|
319
330
|
options: [
|
|
320
331
|
// Default the name to the target directory the user chose, so they don't retype it.
|
|
321
|
-
{
|
|
332
|
+
{
|
|
333
|
+
key: "name",
|
|
334
|
+
type: "string",
|
|
335
|
+
message: "Root project / package name",
|
|
336
|
+
default: ({ directory }) => dirName(directory),
|
|
337
|
+
validate: validateName
|
|
338
|
+
},
|
|
322
339
|
// Lazily default the package scope to `@<name>` (prefixing `@` unless the name already has one),
|
|
323
340
|
// 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
|
-
|
|
341
|
+
{
|
|
342
|
+
key: "scope",
|
|
343
|
+
type: "string",
|
|
344
|
+
message: "npm scope for workspace packages, e.g. @acme (defaults to @<name>)",
|
|
345
|
+
default: ({ options }) => options.name ? toScope(options.name) : "@app",
|
|
346
|
+
validate: validateScope
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
key: "base",
|
|
350
|
+
type: "select",
|
|
351
|
+
message: "shadcn component library base (radix-ui or @base-ui)",
|
|
352
|
+
choices: ["radix", "base"],
|
|
353
|
+
default: "radix"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
key: "preset",
|
|
357
|
+
type: "string",
|
|
358
|
+
message: "shadcn preset: a style name (nova, vega, maia, lyra, mira, luma, sera, rhea) or a code from ui.shadcn.com",
|
|
359
|
+
default: DEFAULT_PRESET,
|
|
360
|
+
validate: validatePreset
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
key: "iconLibrary",
|
|
364
|
+
type: "select",
|
|
365
|
+
message: "Icon library",
|
|
366
|
+
choices: ["lucide", "hugeicons", "radix", "tabler"],
|
|
367
|
+
default: "hugeicons"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
key: "cssVariables",
|
|
371
|
+
type: "boolean",
|
|
372
|
+
message: "Use CSS variables for theming",
|
|
373
|
+
default: true
|
|
374
|
+
},
|
|
329
375
|
{ key: "rtl", type: "boolean", message: "Enable RTL support", default: false },
|
|
330
|
-
{
|
|
331
|
-
|
|
332
|
-
|
|
376
|
+
{
|
|
377
|
+
key: "pointer",
|
|
378
|
+
type: "boolean",
|
|
379
|
+
message: "Use pointer cursor on interactive elements",
|
|
380
|
+
default: false
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
key: "components",
|
|
384
|
+
type: "string",
|
|
385
|
+
message: "Comma-separated shadcn components to pre-install, e.g. button,card,dialog",
|
|
386
|
+
default: "button,badge",
|
|
387
|
+
validate: validateComponents
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
key: "install",
|
|
391
|
+
type: "boolean",
|
|
392
|
+
message: "Install deps and apply the shadcn theme after scaffolding",
|
|
393
|
+
default: true
|
|
394
|
+
}
|
|
333
395
|
],
|
|
334
396
|
async produce({ options }) {
|
|
335
397
|
const scope = toScope(options.scope || options.name || "app");
|
|
@@ -337,8 +399,12 @@ var template_default = defineTemplate({
|
|
|
337
399
|
TEMPLATE_DIR,
|
|
338
400
|
(_rel, content) => content.split("@app").join(scope).split("__PROJECT_NAME__").join(options.name)
|
|
339
401
|
);
|
|
340
|
-
setPath(
|
|
341
|
-
|
|
402
|
+
setPath(
|
|
403
|
+
files,
|
|
404
|
+
"packages/ui/components.json",
|
|
405
|
+
`${JSON.stringify(uiComponentsJson({ ...options, scope }), null, 2)}
|
|
406
|
+
`
|
|
407
|
+
);
|
|
342
408
|
setPath(
|
|
343
409
|
files,
|
|
344
410
|
"apps/website/components.json",
|
|
@@ -354,7 +420,10 @@ var template_default = defineTemplate({
|
|
|
354
420
|
const scripts = options.install ? [
|
|
355
421
|
{ commands: [["pnpm", "install", "--silent"]], phase: 0 },
|
|
356
422
|
{ commands: [["pnpm", "--filter", ui, "exec", "shadcn", "init", ...initArgs]], phase: 1 },
|
|
357
|
-
{
|
|
423
|
+
{
|
|
424
|
+
commands: [["pnpm", "--filter", ui, "exec", "shadcn", "add", ...adds, "-y"]],
|
|
425
|
+
phase: 2
|
|
426
|
+
}
|
|
358
427
|
] : [];
|
|
359
428
|
return {
|
|
360
429
|
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.4",
|
|
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"
|