@viliha/vui-ui 1.4.3 → 1.5.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/AGENT.md +3 -1
- package/README.md +21 -9
- package/bin/vui.mjs +56 -7
- package/package.json +1 -1
package/AGENT.md
CHANGED
|
@@ -84,7 +84,9 @@ Files land in the consumer's repo (they own them). Questions:
|
|
|
84
84
|
the theme wiring you configure)
|
|
85
85
|
|
|
86
86
|
For a fresh app, create it **without `--src-dir`** (the scaffold uses a root
|
|
87
|
-
`app/` + `@/*` → `./*` and writes `next.config.ts`).
|
|
87
|
+
`app/` + `@/*` → `./*` and writes `next.config.ts`). `init` **auto-installs the
|
|
88
|
+
dependencies** with the package manager it detects from the lockfile (npm / pnpm
|
|
89
|
+
/ yarn / bun); `--yes` skips the prompt, `--no-install` skips installing.
|
|
88
90
|
|
|
89
91
|
- **fresh + prebuilt** → full runnable app (config + shell + demo).
|
|
90
92
|
- **fresh + theme-only** → just `globals.css` + `next.config` wiring; build your own.
|
package/README.md
CHANGED
|
@@ -75,25 +75,37 @@ Flags (for CI / agents, skip the prompts):
|
|
|
75
75
|
--dry-run preview without writing
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
`init` **auto-installs the dependencies** with your package manager (detected
|
|
79
|
+
from the lockfile — npm, pnpm, yarn, or bun). It prompts first; pass `--yes` to
|
|
80
|
+
skip, or `--no-install` to do it yourself.
|
|
80
81
|
|
|
81
82
|
### Fresh + pre-built (recommended for new apps)
|
|
82
83
|
|
|
83
84
|
Start from a `create-next-app` base **without `--src-dir`** (the scaffold uses a
|
|
84
|
-
root `app/` + `@/*` → `./*`)
|
|
85
|
+
root `app/` + `@/*` → `./*`), then run `init` — it scaffolds, installs deps, and
|
|
86
|
+
you're ready for `dev`. Use whichever package manager you like:
|
|
85
87
|
|
|
86
88
|
```bash
|
|
89
|
+
# npm
|
|
87
90
|
npx create-next-app@latest my-app --ts --tailwind --app --no-src-dir --use-npm
|
|
88
|
-
cd my-app
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
cd my-app && npx @viliha/vui-ui init && npm run dev
|
|
92
|
+
|
|
93
|
+
# pnpm
|
|
94
|
+
pnpm create next-app my-app --ts --tailwind --app --no-src-dir
|
|
95
|
+
cd my-app && pnpm dlx @viliha/vui-ui init && pnpm dev
|
|
96
|
+
|
|
97
|
+
# yarn
|
|
98
|
+
yarn create next-app my-app --ts --tailwind --app --no-src-dir
|
|
99
|
+
cd my-app && yarn dlx @viliha/vui-ui init && yarn dev
|
|
100
|
+
|
|
101
|
+
# bun
|
|
102
|
+
bun create next-app my-app --ts --tailwind --app --no-src-dir
|
|
103
|
+
cd my-app && bunx @viliha/vui-ui init && bun dev
|
|
92
104
|
```
|
|
93
105
|
|
|
94
106
|
`init` writes `next.config.ts`, `tsconfig.json`, `app/globals.css`, the shell,
|
|
95
|
-
and the demo pages (overwriting the create-next-app boilerplate)
|
|
96
|
-
runs out of the box
|
|
107
|
+
and the demo pages (overwriting the create-next-app boilerplate) and installs the
|
|
108
|
+
deps, so the demo runs out of the box at `/dashboard`.
|
|
97
109
|
|
|
98
110
|
### ⚠️ Existing project — read this first
|
|
99
111
|
|
package/bin/vui.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import { dirname, join, relative, sep } from "node:path";
|
|
|
16
16
|
import { fileURLToPath } from "node:url";
|
|
17
17
|
import { createInterface } from "node:readline/promises";
|
|
18
18
|
import { stdin, stdout } from "node:process";
|
|
19
|
+
import { execSync } from "node:child_process";
|
|
19
20
|
|
|
20
21
|
const TEMPLATE = fileURLToPath(new URL("../template/", import.meta.url));
|
|
21
22
|
const args = process.argv.slice(2);
|
|
@@ -121,6 +122,21 @@ function category(rel) {
|
|
|
121
122
|
return "shell";
|
|
122
123
|
}
|
|
123
124
|
|
|
125
|
+
// Detect the package manager from lockfiles (falls back to npm).
|
|
126
|
+
function detectPM(root) {
|
|
127
|
+
if (existsSync(join(root, "pnpm-lock.yaml"))) return "pnpm";
|
|
128
|
+
if (existsSync(join(root, "yarn.lock"))) return "yarn";
|
|
129
|
+
if (existsSync(join(root, "bun.lockb")) || existsSync(join(root, "bun.lock")))
|
|
130
|
+
return "bun";
|
|
131
|
+
return "npm";
|
|
132
|
+
}
|
|
133
|
+
const ADD_CMD = {
|
|
134
|
+
npm: "npm install",
|
|
135
|
+
pnpm: "pnpm add",
|
|
136
|
+
yarn: "yarn add",
|
|
137
|
+
bun: "bun add",
|
|
138
|
+
};
|
|
139
|
+
|
|
124
140
|
function allFiles(dir, out = []) {
|
|
125
141
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
126
142
|
const abs = join(dir, entry.name);
|
|
@@ -223,12 +239,46 @@ async function main() {
|
|
|
223
239
|
`\nDone — ${created} file(s) ${dry ? "would be added" : "added"}, ${skipped} skipped.`,
|
|
224
240
|
);
|
|
225
241
|
|
|
242
|
+
// Install dependencies. Turborepo installs are workspace-specific, so we only
|
|
243
|
+
// auto-install for a standalone Next.js app; turbo gets manual instructions.
|
|
244
|
+
const pm = detectPM(targetRoot);
|
|
245
|
+
const installList = `@viliha/vui-ui ${DEPS}`;
|
|
246
|
+
let installed = false;
|
|
247
|
+
if (!turbo) {
|
|
248
|
+
let doInstall = has("--no-install")
|
|
249
|
+
? false
|
|
250
|
+
: has("--yes") || has("-y")
|
|
251
|
+
? true
|
|
252
|
+
: null;
|
|
253
|
+
if (doInstall === null) {
|
|
254
|
+
const a = await ask(`Install dependencies now with ${pm}? [Y/n] `, "y");
|
|
255
|
+
doInstall = !a.startsWith("n");
|
|
256
|
+
}
|
|
257
|
+
if (doInstall && !dry) {
|
|
258
|
+
console.log(`\nInstalling dependencies with ${pm}…\n`);
|
|
259
|
+
try {
|
|
260
|
+
execSync(`${ADD_CMD[pm]} ${installList}`, {
|
|
261
|
+
cwd: targetRoot,
|
|
262
|
+
stdio: "inherit",
|
|
263
|
+
});
|
|
264
|
+
installed = true;
|
|
265
|
+
} catch {
|
|
266
|
+
console.error(
|
|
267
|
+
`\nInstall failed — run it manually:\n ${ADD_CMD[pm]} ${installList}\n`,
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
226
273
|
// Per-leaf next steps.
|
|
274
|
+
const installStep = installed
|
|
275
|
+
? ""
|
|
276
|
+
: ` 1. ${ADD_CMD[pm]} ${installList}\n`;
|
|
277
|
+
const devStepNum = installed ? "1" : "2";
|
|
227
278
|
if (fresh && prebuilt) {
|
|
228
279
|
console.log(`
|
|
229
280
|
Next steps:
|
|
230
|
-
|
|
231
|
-
2. npm run dev -> http://localhost:3000 (redirects to /dashboard)
|
|
281
|
+
${installStep} ${devStepNum}. ${pm === "npm" ? "npm run dev" : `${pm} dev`} -> http://localhost:3000 (redirects to /dashboard)
|
|
232
282
|
|
|
233
283
|
Everything is in YOUR repo — edit app/_components/nav-config.ts, set your logo
|
|
234
284
|
(NEXT_PUBLIC_LOGO_URL in .env), and delete demo pages you don't need.
|
|
@@ -238,8 +288,7 @@ Everything is in YOUR repo — edit app/_components/nav-config.ts, set your logo
|
|
|
238
288
|
Theme wired (globals.css + next.config). No shell or demo pages — build your own.
|
|
239
289
|
|
|
240
290
|
Next steps:
|
|
241
|
-
|
|
242
|
-
2. Import components from @viliha/vui-ui/* in your pages, then: npm run dev
|
|
291
|
+
${installStep} ${devStepNum}. Import components from @viliha/vui-ui/* in your pages, then run dev.
|
|
243
292
|
`);
|
|
244
293
|
} else {
|
|
245
294
|
// existing + prebuilt
|
|
@@ -258,10 +307,10 @@ The shell + demo were added under app/(app)/ and app/_components/ — review the
|
|
|
258
307
|
|
|
259
308
|
if (turbo) {
|
|
260
309
|
console.log(`Turborepo notes (target: ${appDir}):
|
|
261
|
-
• Add
|
|
310
|
+
• Add the deps to that app: ${ADD_CMD[pm]} ${installList}
|
|
311
|
+
(from the app dir, or with your PM's workspace filter).
|
|
262
312
|
• Ensure your workspace globs include this app (pnpm-workspace.yaml / workspaces).
|
|
263
|
-
• Run
|
|
264
|
-
pnpm --filter <app-name> dev
|
|
313
|
+
• Run dev with a filter, e.g. ${pm} --filter <app-name> dev
|
|
265
314
|
`);
|
|
266
315
|
}
|
|
267
316
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viliha/vui-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Vui UI — a clean, token-driven React admin/CRM component library built on Tailwind CSS v4, shadcn-style patterns, and Radix Icons. Ships as TypeScript source (Just-in-Time), compiled by the consuming app.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Suman Bonakurthi",
|