@thebase/ui 1.2.0 → 1.3.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/CHANGELOG.md +32 -260
- package/LICENSE +1 -1
- package/README.md +98 -93
- package/bin/{create-baseui-app.mjs → create-nodexui-app.mjs} +65 -65
- package/dist/{baseui.apidoc.esm.js → nodexui.apidoc.esm.js} +136 -136
- package/dist/{baseui.apidoc.min.js → nodexui.apidoc.min.js} +137 -137
- package/dist/nodexui.esm.js +58 -0
- package/dist/nodexui.i18n.esm.js +2 -0
- package/dist/nodexui.i18n.min.js +2 -0
- package/dist/nodexui.icons.esm.js +1 -0
- package/dist/{baseui.min.css → nodexui.min.css} +1 -1
- package/dist/nodexui.min.js +77 -0
- package/dist/{baseui.pwa.esm.js → nodexui.pwa.esm.js} +5 -5
- package/dist/{baseui.registry.json → nodexui.registry.json} +162 -162
- package/dist/{baseui.templates.xml → nodexui.templates.xml} +573 -573
- package/dist/{baseui.vite.esm.js → nodexui.vite.esm.js} +6 -6
- package/dist/runtime/mermaid/mermaid.esm.min.mjs +2 -2
- package/dist/runtime/milkdown/milkdown-editor.js +1 -1
- package/dist/runtime/milkdown/milkdown-text-editor.js +1 -1
- package/dist/themes/{baseui-dark.css → nodexui-dark.css} +2 -2
- package/dist/themes/{baseui-light.css → nodexui-light.css} +2 -2
- package/dist/types/analytics.d.ts +12 -12
- package/dist/types/apidoc.d.ts +1 -1
- package/dist/types/i18n.d.ts +25 -0
- package/dist/types/index.d.ts +16 -14
- package/dist/types/vite.d.ts +2 -2
- package/docs/analytics.md +12 -12
- package/docs/base-ui-skill.md +4 -4
- package/docs/blocks.md +6 -6
- package/docs/components/accordion.md +4 -4
- package/docs/components/alert-dialog.md +2 -2
- package/docs/components/alert.md +5 -5
- package/docs/components/apidoc.md +14 -14
- package/docs/components/aspect-ratio.md +2 -2
- package/docs/components/attachment.md +5 -5
- package/docs/components/avatar.md +7 -7
- package/docs/components/badge.md +2 -2
- package/docs/components/block-viewer.md +8 -8
- package/docs/components/breadcrumb.md +3 -3
- package/docs/components/bubble.md +2 -2
- package/docs/components/button-group.md +2 -2
- package/docs/components/button.md +2 -2
- package/docs/components/calendar.md +7 -7
- package/docs/components/card.md +2 -2
- package/docs/components/carousel.md +9 -9
- package/docs/components/chart.md +7 -7
- package/docs/components/checkbox.md +2 -2
- package/docs/components/clipboard-button.md +7 -7
- package/docs/components/code-editor.md +1 -1
- package/docs/components/collapsible.md +4 -4
- package/docs/components/combobox.md +7 -7
- package/docs/components/command.md +7 -7
- package/docs/components/context-menu.md +7 -7
- package/docs/components/data-table.md +9 -9
- package/docs/components/date-picker.md +7 -7
- package/docs/components/dialog.md +5 -5
- package/docs/components/direction.md +2 -2
- package/docs/components/drawer.md +4 -4
- package/docs/components/dropdown-menu.md +3 -3
- package/docs/components/empty.md +3 -3
- package/docs/components/field.md +1 -1
- package/docs/components/form.md +3 -3
- package/docs/components/hover-card.md +2 -2
- package/docs/components/icon.md +3 -3
- package/docs/components/input-otp.md +7 -7
- package/docs/components/input.md +6 -6
- package/docs/components/item.md +3 -3
- package/docs/components/kbd.md +2 -2
- package/docs/components/label.md +2 -2
- package/docs/components/markdown.md +13 -13
- package/docs/components/marker.md +2 -2
- package/docs/components/menubar.md +2 -2
- package/docs/components/message-scroller.md +7 -7
- package/docs/components/message.md +7 -7
- package/docs/components/native-select.md +3 -3
- package/docs/components/navigation-menu.md +3 -3
- package/docs/components/pagination.md +3 -3
- package/docs/components/popover.md +10 -10
- package/docs/components/progress.md +2 -2
- package/docs/components/pwa.md +4 -4
- package/docs/components/questionnaire.md +7 -7
- package/docs/components/radio-group.md +2 -2
- package/docs/components/resizable.md +7 -7
- package/docs/components/scroll-area.md +7 -7
- package/docs/components/select.md +2 -2
- package/docs/components/separator.md +2 -2
- package/docs/components/sheet.md +3 -3
- package/docs/components/shell.md +7 -7
- package/docs/components/sidebar.md +3 -3
- package/docs/components/skeleton.md +2 -2
- package/docs/components/slider.md +2 -2
- package/docs/components/spinner.md +4 -4
- package/docs/components/switch.md +2 -2
- package/docs/components/table.md +2 -2
- package/docs/components/tabs.md +6 -6
- package/docs/components/text-editor.md +6 -6
- package/docs/components/textarea.md +3 -3
- package/docs/components/theme-button.md +6 -6
- package/docs/components/toast.md +6 -6
- package/docs/components/toggle-group.md +7 -7
- package/docs/components/toggle.md +7 -7
- package/docs/components/tooltip.md +9 -9
- package/docs/components/typography.md +9 -9
- package/docs/i18n.md +119 -0
- package/docs/icons.md +9 -9
- package/docs/installation.md +31 -32
- package/docs/owl-components.md +36 -38
- package/docs/registry.md +14 -13
- package/docs/runtime-api.md +14 -12
- package/docs/theming.md +15 -15
- package/docs/usage-guide.md +54 -56
- package/package.json +51 -35
- package/dist/baseui.esm.js +0 -58
- package/dist/baseui.icons.esm.js +0 -1
- package/dist/baseui.min.js +0 -77
- /package/dist/{baseui.analytics.esm.js → nodexui.analytics.esm.js} +0 -0
- /package/dist/{baseui.analytics.min.js → nodexui.analytics.min.js} +0 -0
- /package/dist/themes/{baseui-dark.min.css → nodexui-dark.min.css} +0 -0
- /package/dist/themes/{baseui-light.min.css → nodexui-light.min.css} +0 -0
|
@@ -15,7 +15,7 @@ function toPackageName(name) {
|
|
|
15
15
|
.trim()
|
|
16
16
|
.toLowerCase()
|
|
17
17
|
.replace(/[^a-z0-9-]+/g, "-")
|
|
18
|
-
.replace(/^-+|-+$/g, "") || "
|
|
18
|
+
.replace(/^-+|-+$/g, "") || "nodexui-app";
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/** Turns a kebab/snake-case app name into a human-readable title, e.g. "qr-page" -> "Qr Page". */
|
|
@@ -27,8 +27,8 @@ function toTitle(appName) {
|
|
|
27
27
|
.join(" ");
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
/** Builds the fixed set of Vite +
|
|
31
|
-
function buildTemplateFiles(appName,
|
|
30
|
+
/** Builds the fixed set of Vite + Nodex UI scaffold files for a project named `appName`. */
|
|
31
|
+
function buildTemplateFiles(appName, nodexuiVersion) {
|
|
32
32
|
const title = toTitle(appName);
|
|
33
33
|
|
|
34
34
|
return {
|
|
@@ -44,7 +44,7 @@ function buildTemplateFiles(appName, baseuiVersion) {
|
|
|
44
44
|
preview: "vite preview",
|
|
45
45
|
},
|
|
46
46
|
dependencies: {
|
|
47
|
-
"
|
|
47
|
+
"nodexui": `^${nodexuiVersion}`,
|
|
48
48
|
},
|
|
49
49
|
devDependencies: {
|
|
50
50
|
vite: "^8.2.1",
|
|
@@ -55,11 +55,11 @@ function buildTemplateFiles(appName, baseuiVersion) {
|
|
|
55
55
|
) + "\n",
|
|
56
56
|
|
|
57
57
|
"vite.config.js": `import { defineConfig } from "vite";
|
|
58
|
-
import {
|
|
58
|
+
import { nodexuiPwa } from "nodexui/vite";
|
|
59
59
|
|
|
60
60
|
export default defineConfig({
|
|
61
61
|
server: { open: true },
|
|
62
|
-
plugins: [
|
|
62
|
+
plugins: [nodexuiPwa({ name: ${JSON.stringify(title)} })],
|
|
63
63
|
});
|
|
64
64
|
`,
|
|
65
65
|
|
|
@@ -88,11 +88,11 @@ export default defineConfig({
|
|
|
88
88
|
</svg>
|
|
89
89
|
`,
|
|
90
90
|
|
|
91
|
-
"src/style.css": `/* App-specific styles layered on top of
|
|
91
|
+
"src/style.css": `/* App-specific styles layered on top of nodexui/nodexui.css go here. */\n`,
|
|
92
92
|
|
|
93
|
-
"src/main.js": `import "
|
|
94
|
-
import { mount } from "
|
|
95
|
-
import
|
|
93
|
+
"src/main.js": `import "nodexui/nodexui.css";
|
|
94
|
+
import { mount } from "nodexui";
|
|
95
|
+
import nodexuiTemplates from "nodexui/dist/nodexui.templates.xml?raw";
|
|
96
96
|
import appTemplates from "./App.xml?raw";
|
|
97
97
|
import { App } from "./App.js";
|
|
98
98
|
import "./style.css";
|
|
@@ -103,15 +103,15 @@ import "./style.css";
|
|
|
103
103
|
const stripTemplatesWrapper = (xml) =>
|
|
104
104
|
xml.replace(/^\\s*<templates[^>]*>/, "").replace(/<\\/templates>\\s*$/, "");
|
|
105
105
|
|
|
106
|
-
const templates = \`<templates>\${stripTemplatesWrapper(
|
|
106
|
+
const templates = \`<templates>\${stripTemplatesWrapper(nodexuiTemplates)}\${stripTemplatesWrapper(appTemplates)}</templates>\`;
|
|
107
107
|
|
|
108
108
|
await mount(App, document.getElementById("app"), { templates });
|
|
109
109
|
`,
|
|
110
110
|
|
|
111
|
-
"src/App.js": `import { Component, useState } from "
|
|
112
|
-
import { Button, Card, CardBody, CardHeader, CardTitle } from "
|
|
111
|
+
"src/App.js": `import { Component, useState } from "nodexui";
|
|
112
|
+
import { Button, Card, CardBody, CardHeader, CardTitle } from "nodexui";
|
|
113
113
|
|
|
114
|
-
/** Root screen of the app: owns top-level state and composes
|
|
114
|
+
/** Root screen of the app: owns top-level state and composes NodexUI components. */
|
|
115
115
|
export class App extends Component {
|
|
116
116
|
static template = "app.Root";
|
|
117
117
|
static components = { Button, Card, CardBody, CardHeader, CardTitle };
|
|
@@ -139,7 +139,7 @@ export class App extends Component {
|
|
|
139
139
|
|
|
140
140
|
"README.md": `# ${title}
|
|
141
141
|
|
|
142
|
-
Scaffolded with
|
|
142
|
+
Scaffolded with \`nodexui\`'s CLI (Vite + NodexUI, pure Base API).
|
|
143
143
|
|
|
144
144
|
\`\`\`sh
|
|
145
145
|
npm install
|
|
@@ -169,7 +169,7 @@ function pageHtml(title, entryScript) {
|
|
|
169
169
|
|
|
170
170
|
/** Builds one page's entry script: loads its templates/component and mounts via the shared mountPage helper. */
|
|
171
171
|
function pageMain(componentName, templatesImportPath, componentImportPath) {
|
|
172
|
-
return `import "
|
|
172
|
+
return `import "nodexui/nodexui.css";
|
|
173
173
|
import pageTemplates from "${templatesImportPath}?raw";
|
|
174
174
|
import { ${componentName} } from "${componentImportPath}";
|
|
175
175
|
import { mountPage } from "../mount-page.js";
|
|
@@ -179,10 +179,10 @@ await mountPage(${componentName}, pageTemplates);
|
|
|
179
179
|
`;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
/** Builds a 4-page Vite +
|
|
182
|
+
/** Builds a 4-page Vite + Nodex UI starter (landing, login, signup, an authenticated home shell) for a
|
|
183
183
|
* project named `appName` — each page is its own Owl root mounted by its own HTML entry, composed
|
|
184
184
|
* from the same blocks as `examples/blocks/login-03.html`, `signup-03.html` and `sidebar-02.html`. */
|
|
185
|
-
function buildStarterFiles(appName,
|
|
185
|
+
function buildStarterFiles(appName, nodexuiVersion) {
|
|
186
186
|
const title = toTitle(appName);
|
|
187
187
|
|
|
188
188
|
return {
|
|
@@ -198,7 +198,7 @@ function buildStarterFiles(appName, baseuiVersion) {
|
|
|
198
198
|
preview: "vite preview",
|
|
199
199
|
},
|
|
200
200
|
dependencies: {
|
|
201
|
-
"
|
|
201
|
+
"nodexui": `^${nodexuiVersion}`,
|
|
202
202
|
},
|
|
203
203
|
devDependencies: {
|
|
204
204
|
vite: "^8.2.1",
|
|
@@ -209,7 +209,7 @@ function buildStarterFiles(appName, baseuiVersion) {
|
|
|
209
209
|
) + "\n",
|
|
210
210
|
|
|
211
211
|
"vite.config.js": `import { defineConfig } from "vite";
|
|
212
|
-
import {
|
|
212
|
+
import { nodexuiPwa } from "nodexui/vite";
|
|
213
213
|
import { fileURLToPath } from "node:url";
|
|
214
214
|
|
|
215
215
|
/** Resolves a file in this config's own directory, Node-ESM-safe (no __dirname in ESM). */
|
|
@@ -217,7 +217,7 @@ const here = (file) => fileURLToPath(new URL(file, import.meta.url));
|
|
|
217
217
|
|
|
218
218
|
export default defineConfig({
|
|
219
219
|
server: { open: true },
|
|
220
|
-
plugins: [
|
|
220
|
+
plugins: [nodexuiPwa({ name: ${JSON.stringify(title)} })],
|
|
221
221
|
build: {
|
|
222
222
|
rollupOptions: {
|
|
223
223
|
input: {
|
|
@@ -241,27 +241,27 @@ export default defineConfig({
|
|
|
241
241
|
</svg>
|
|
242
242
|
`,
|
|
243
243
|
|
|
244
|
-
"src/style.css": `/* App-specific styles layered on top of
|
|
244
|
+
"src/style.css": `/* App-specific styles layered on top of nodexui/nodexui.css go here. */\n`,
|
|
245
245
|
|
|
246
|
-
"src/mount-page.js": `import { mount } from "
|
|
247
|
-
import
|
|
246
|
+
"src/mount-page.js": `import { mount } from "nodexui";
|
|
247
|
+
import nodexuiTemplates from "nodexui/dist/nodexui.templates.xml?raw";
|
|
248
248
|
|
|
249
249
|
/** Both files are full <templates>...</templates> documents; strip each one's outer wrapper before
|
|
250
250
|
* joining them, otherwise the merged string has two root elements and Owl's XML parser throws. */
|
|
251
251
|
const stripTemplatesWrapper = (xml) =>
|
|
252
252
|
xml.replace(/^\\s*<templates[^>]*>/, "").replace(/<\\/templates>\\s*$/, "");
|
|
253
253
|
|
|
254
|
-
/** Merges
|
|
254
|
+
/** Merges NodexUI's component templates with one page's own templates and mounts its root component. */
|
|
255
255
|
export async function mountPage(Root, pageTemplatesXml) {
|
|
256
|
-
const templates = \`<templates>\${stripTemplatesWrapper(
|
|
256
|
+
const templates = \`<templates>\${stripTemplatesWrapper(nodexuiTemplates)}\${stripTemplatesWrapper(pageTemplatesXml)}</templates>\`;
|
|
257
257
|
await mount(Root, document.getElementById("app"), { templates });
|
|
258
258
|
}
|
|
259
259
|
`,
|
|
260
260
|
|
|
261
261
|
"index.html": pageHtml(title, "/src/landing/main.js"),
|
|
262
262
|
"src/landing/main.js": pageMain("Landing", "./Landing.xml", "./Landing.js"),
|
|
263
|
-
"src/landing/Landing.js": `import { Component } from "
|
|
264
|
-
import { Button, Card, CardBody, CardHeader, CardTitle, Icon } from "
|
|
263
|
+
"src/landing/Landing.js": `import { Component } from "nodexui";
|
|
264
|
+
import { Button, Card, CardBody, CardHeader, CardTitle, Icon } from "nodexui";
|
|
265
265
|
|
|
266
266
|
/** Marketing landing page: header with a login link, hero pitch, feature grid, footer. */
|
|
267
267
|
export class Landing extends Component {
|
|
@@ -285,7 +285,7 @@ export class Landing extends Component {
|
|
|
285
285
|
<section class="container py-5 text-center">
|
|
286
286
|
<h1 class="display-5 fw-bold mb-3">Build faster with ${title}</h1>
|
|
287
287
|
<p class="lead text-muted mx-auto mb-4" style="max-width: 40rem">
|
|
288
|
-
A starter scaffold wired up with
|
|
288
|
+
A starter scaffold wired up with NodexUI — Base components, themed styling, and the pages you need to ship day one.
|
|
289
289
|
</p>
|
|
290
290
|
<div class="d-flex justify-content-center gap-3">
|
|
291
291
|
<Button icon="'rocket'" onClick="() => window.location.assign('/signup.html')">Get started</Button>
|
|
@@ -298,7 +298,7 @@ export class Landing extends Component {
|
|
|
298
298
|
<div class="col-12 col-md-4">
|
|
299
299
|
<Card className="'h-100'">
|
|
300
300
|
<CardHeader className="'d-flex align-items-center gap-2'"><Icon name="'zap'"/><CardTitle>Fast by default</CardTitle></CardHeader>
|
|
301
|
-
<CardBody>Vite dev server and production build, pre-wired to
|
|
301
|
+
<CardBody>Vite dev server and production build, pre-wired to NodexUI's CDN or local dist.</CardBody>
|
|
302
302
|
</Card>
|
|
303
303
|
</div>
|
|
304
304
|
<div class="col-12 col-md-4">
|
|
@@ -310,7 +310,7 @@ export class Landing extends Component {
|
|
|
310
310
|
<div class="col-12 col-md-4">
|
|
311
311
|
<Card className="'h-100'">
|
|
312
312
|
<CardHeader className="'d-flex align-items-center gap-2'"><Icon name="'component'"/><CardTitle>Base components</CardTitle></CardHeader>
|
|
313
|
-
<CardBody>Every page composes real
|
|
313
|
+
<CardBody>Every page composes real NodexUI components — swap or extend without fighting the markup.</CardBody>
|
|
314
314
|
</Card>
|
|
315
315
|
</div>
|
|
316
316
|
</div>
|
|
@@ -329,8 +329,8 @@ export class Landing extends Component {
|
|
|
329
329
|
|
|
330
330
|
"login.html": pageHtml(`Login — ${title}`, "/src/login/main.js"),
|
|
331
331
|
"src/login/main.js": pageMain("Login", "./Login.xml", "./Login.js"),
|
|
332
|
-
"src/login/Login.js": `import { Component } from "
|
|
333
|
-
import { Button, Card, CardBody, Field, FieldGroup, Icon, Input, Label } from "
|
|
332
|
+
"src/login/Login.js": `import { Component } from "nodexui";
|
|
333
|
+
import { Button, Card, CardBody, Field, FieldGroup, Icon, Input, Label } from "nodexui";
|
|
334
334
|
|
|
335
335
|
/** Login page (ported from examples/blocks/login-03.html): email/password card, redirects home on submit. */
|
|
336
336
|
export class Login extends Component {
|
|
@@ -380,8 +380,8 @@ export class Login extends Component {
|
|
|
380
380
|
|
|
381
381
|
"signup.html": pageHtml(`Sign up — ${title}`, "/src/signup/main.js"),
|
|
382
382
|
"src/signup/main.js": pageMain("Signup", "./Signup.xml", "./Signup.js"),
|
|
383
|
-
"src/signup/Signup.js": `import { Component } from "
|
|
384
|
-
import { Button, Card, CardBody, Field, FieldGroup, Icon, Input, Label } from "
|
|
383
|
+
"src/signup/Signup.js": `import { Component } from "nodexui";
|
|
384
|
+
import { Button, Card, CardBody, Field, FieldGroup, Icon, Input, Label } from "nodexui";
|
|
385
385
|
|
|
386
386
|
/** Signup page (ported from examples/blocks/signup-03.html): single email field, sends the user to login after submit. */
|
|
387
387
|
export class Signup extends Component {
|
|
@@ -424,13 +424,13 @@ export class Signup extends Component {
|
|
|
424
424
|
|
|
425
425
|
"home.html": pageHtml(`Home — ${title}`, "/src/home/main.js"),
|
|
426
426
|
"src/home/main.js": pageMain("Home", "./Home.xml", "./Home.js"),
|
|
427
|
-
"src/home/Home.js": `import { Component, useState } from "
|
|
427
|
+
"src/home/Home.js": `import { Component, useState } from "nodexui";
|
|
428
428
|
import {
|
|
429
429
|
Breadcrumb, BreadcrumbItem, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator,
|
|
430
430
|
Button, Icon, Input, Separator,
|
|
431
431
|
Shell, ShellContent, ShellHeader, ShellMain, ShellNav, ShellSidebar, ShellSidebarHeader,
|
|
432
432
|
SidebarGroupCollapsible, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarTrigger,
|
|
433
|
-
} from "
|
|
433
|
+
} from "nodexui";
|
|
434
434
|
|
|
435
435
|
/** Authenticated home shell (ported from examples/blocks/sidebar-02.html): collapsible sidebar nav
|
|
436
436
|
* + sticky header, reached after login/signup; owns the sidebar's collapsed/expanded state. */
|
|
@@ -499,7 +499,7 @@ export class Home extends Component {
|
|
|
499
499
|
|
|
500
500
|
"README.md": `# ${title}
|
|
501
501
|
|
|
502
|
-
Scaffolded with
|
|
502
|
+
Scaffolded with \`nodexui\`'s CLI (\`create-nodexui-app init\`): Vite + NodexUI, pure Base API, 4 pages.
|
|
503
503
|
|
|
504
504
|
- \`/\` — landing page (header, hero, features, footer)
|
|
505
505
|
- \`/login.html\` — login (redirects to \`/home.html\` on submit)
|
|
@@ -560,7 +560,7 @@ function cmdCreate(argv) {
|
|
|
560
560
|
const { flags, positional } = parseFlags(argv);
|
|
561
561
|
const rawName = positional[0];
|
|
562
562
|
if (!rawName) {
|
|
563
|
-
console.error("Usage: create-
|
|
563
|
+
console.error("Usage: create-nodexui-app create <app-name> [--version <x.y.z>] [--no-install] [--force]");
|
|
564
564
|
process.exit(1);
|
|
565
565
|
}
|
|
566
566
|
const appName = toPackageName(rawName);
|
|
@@ -571,11 +571,11 @@ function cmdCreate(argv) {
|
|
|
571
571
|
process.exit(1);
|
|
572
572
|
}
|
|
573
573
|
|
|
574
|
-
const
|
|
575
|
-
const files = buildTemplateFiles(appName,
|
|
574
|
+
const nodexuiVersion = flags.version || ownPackageJson.version;
|
|
575
|
+
const files = buildTemplateFiles(appName, nodexuiVersion);
|
|
576
576
|
const { written } = writeFiles(targetDir, files, { overwrite: flags.force ?? false });
|
|
577
577
|
|
|
578
|
-
console.log(`Scaffolded a Vite +
|
|
578
|
+
console.log(`Scaffolded a Vite + NodexUI app in ${targetDir}`);
|
|
579
579
|
written.forEach((f) => console.log(` create ${f}`));
|
|
580
580
|
|
|
581
581
|
if (flags.install) runInstall(targetDir);
|
|
@@ -588,7 +588,7 @@ function cmdInit(argv) {
|
|
|
588
588
|
const { flags, positional } = parseFlags(argv);
|
|
589
589
|
const rawName = positional[0];
|
|
590
590
|
if (!rawName) {
|
|
591
|
-
console.error("Usage: create-
|
|
591
|
+
console.error("Usage: create-nodexui-app init <app-name> [--version <x.y.z>] [--no-install] [--force]");
|
|
592
592
|
process.exit(1);
|
|
593
593
|
}
|
|
594
594
|
const appName = toPackageName(rawName);
|
|
@@ -599,11 +599,11 @@ function cmdInit(argv) {
|
|
|
599
599
|
process.exit(1);
|
|
600
600
|
}
|
|
601
601
|
|
|
602
|
-
const
|
|
603
|
-
const files = buildStarterFiles(appName,
|
|
602
|
+
const nodexuiVersion = flags.version || ownPackageJson.version;
|
|
603
|
+
const files = buildStarterFiles(appName, nodexuiVersion);
|
|
604
604
|
const { written } = writeFiles(targetDir, files, { overwrite: flags.force ?? false });
|
|
605
605
|
|
|
606
|
-
console.log(`Scaffolded a 4-page Vite +
|
|
606
|
+
console.log(`Scaffolded a 4-page Vite + NodexUI starter in ${targetDir}`);
|
|
607
607
|
written.forEach((f) => console.log(` create ${f}`));
|
|
608
608
|
|
|
609
609
|
if (flags.install) runInstall(targetDir);
|
|
@@ -625,14 +625,14 @@ function cmdConvert(argv) {
|
|
|
625
625
|
|
|
626
626
|
const existingPackageJsonPath = path.join(targetDir, "package.json");
|
|
627
627
|
const appName = toPackageName(path.basename(targetDir));
|
|
628
|
-
const
|
|
629
|
-
const files = buildTemplateFiles(appName,
|
|
628
|
+
const nodexuiVersion = flags.version || ownPackageJson.version;
|
|
629
|
+
const files = buildTemplateFiles(appName, nodexuiVersion);
|
|
630
630
|
|
|
631
631
|
if (existsSync(existingPackageJsonPath)) {
|
|
632
632
|
const existing = JSON.parse(readFileSync(existingPackageJsonPath, "utf8"));
|
|
633
633
|
existing.type ??= "module";
|
|
634
634
|
existing.scripts = { dev: "vite", build: "vite build", preview: "vite preview", ...existing.scripts };
|
|
635
|
-
existing.dependencies = { ...existing.dependencies, "
|
|
635
|
+
existing.dependencies = { ...existing.dependencies, "nodexui": `^${nodexuiVersion}` };
|
|
636
636
|
existing.devDependencies = { ...existing.devDependencies, vite: existing.devDependencies?.vite || "^8.2.1" };
|
|
637
637
|
delete files["package.json"];
|
|
638
638
|
writeFileSync(existingPackageJsonPath, JSON.stringify(existing, null, 2) + "\n");
|
|
@@ -641,14 +641,14 @@ function cmdConvert(argv) {
|
|
|
641
641
|
|
|
642
642
|
const { written, skipped } = writeFiles(targetDir, files, { overwrite: false });
|
|
643
643
|
|
|
644
|
-
console.log(`Converted ${targetDir} into a Vite +
|
|
644
|
+
console.log(`Converted ${targetDir} into a Vite + NodexUI project.`);
|
|
645
645
|
written.forEach((f) => console.log(` create ${f}`));
|
|
646
646
|
skipped.forEach((f) => console.log(` skip ${f} (already exists)`));
|
|
647
647
|
|
|
648
648
|
if (skipped.includes("vite.config.js")) {
|
|
649
649
|
console.log(
|
|
650
|
-
'\nvite.config.js already existed — add `import {
|
|
651
|
-
"`plugins: [
|
|
650
|
+
'\nvite.config.js already existed — add `import { nodexuiPwa } from "nodexui/vite"` and ' +
|
|
651
|
+
"`plugins: [nodexuiPwa({ name: \"My App\" })]` so every build emits the PWA files and auto-reloads on a new version.",
|
|
652
652
|
);
|
|
653
653
|
}
|
|
654
654
|
|
|
@@ -664,12 +664,12 @@ function cmdConvert(argv) {
|
|
|
664
664
|
console.log(`\nNext steps:\n npm run dev`);
|
|
665
665
|
}
|
|
666
666
|
|
|
667
|
-
/** Generates manifest.webmanifest + sw.js for a PWA from a `
|
|
668
|
-
* using
|
|
667
|
+
/** Generates manifest.webmanifest + sw.js for a PWA from a `nodexui.pwa.config.js` the user wrote,
|
|
668
|
+
* using nodexui's buildManifest/buildServiceWorker (see docs/usage-guide.md "PWA toolkit"). */
|
|
669
669
|
async function cmdPwa(argv) {
|
|
670
670
|
const { flags, positional } = parseFlags(argv);
|
|
671
671
|
const targetDir = path.resolve(process.cwd(), positional[0] || ".");
|
|
672
|
-
const configPath = path.resolve(targetDir, flags.config || "
|
|
672
|
+
const configPath = path.resolve(targetDir, flags.config || "nodexui.pwa.config.js");
|
|
673
673
|
|
|
674
674
|
if (!existsSync(configPath)) {
|
|
675
675
|
console.error(
|
|
@@ -681,7 +681,7 @@ async function cmdPwa(argv) {
|
|
|
681
681
|
}
|
|
682
682
|
|
|
683
683
|
const { manifest, serviceWorker } = (await import(pathToFileURL(configPath).href)).default;
|
|
684
|
-
const { buildManifest, buildServiceWorker, buildServiceWorkerRegister, buildVersionJson, DEFAULT_ICON_FILES } = await import("../dist/
|
|
684
|
+
const { buildManifest, buildServiceWorker, buildServiceWorkerRegister, buildVersionJson, DEFAULT_ICON_FILES } = await import("../dist/nodexui.pwa.esm.js");
|
|
685
685
|
|
|
686
686
|
writeFileSync(
|
|
687
687
|
path.join(targetDir, "manifest.webmanifest"),
|
|
@@ -708,7 +708,7 @@ function hashAppFiles(targetDir, appFiles = []) {
|
|
|
708
708
|
return hash.digest("hex").slice(0, 12);
|
|
709
709
|
}
|
|
710
710
|
|
|
711
|
-
/** Gives a PWA the default
|
|
711
|
+
/** Gives a PWA the default Nodex UI logo/favicon set, without replacing any icon the app already has. */
|
|
712
712
|
function copyDefaultIcons(iconsDir, files) {
|
|
713
713
|
mkdirSync(iconsDir, { recursive: true });
|
|
714
714
|
const source = new URL("../dist/pwa-icons/", import.meta.url);
|
|
@@ -719,25 +719,25 @@ function copyDefaultIcons(iconsDir, files) {
|
|
|
719
719
|
}
|
|
720
720
|
|
|
721
721
|
function printHelp() {
|
|
722
|
-
console.log(
|
|
722
|
+
console.log(`nodexui project CLI
|
|
723
723
|
|
|
724
724
|
Usage:
|
|
725
|
-
create-
|
|
726
|
-
Scaffold a new Vite +
|
|
725
|
+
create-nodexui-app create <app-name> [--version <x.y.z>] [--no-install] [--force]
|
|
726
|
+
Scaffold a new Vite + NodexUI project in ./<app-name>.
|
|
727
727
|
|
|
728
|
-
create-
|
|
729
|
-
Turn an existing (non-npm) folder into a Vite +
|
|
728
|
+
create-nodexui-app convert [path] [--version <x.y.z>] [--no-install]
|
|
729
|
+
Turn an existing (non-npm) folder into a Vite + NodexUI project, in place.
|
|
730
730
|
Never overwrites files that already exist; only fills in what's missing.
|
|
731
731
|
|
|
732
|
-
create-
|
|
732
|
+
create-nodexui-app init <app-name> [--version <x.y.z>] [--no-install] [--force]
|
|
733
733
|
Scaffold a ready-to-start 4-page project in ./<app-name>: a landing page
|
|
734
734
|
(header/hero/features/footer), login, signup, and an authenticated home
|
|
735
735
|
shell (sidebar + header) — ported from the login-03/signup-03/sidebar-02
|
|
736
736
|
example blocks.
|
|
737
737
|
|
|
738
|
-
create-
|
|
738
|
+
create-nodexui-app pwa [path] [--config <file>]
|
|
739
739
|
Generate manifest.webmanifest + sw.js in [path] (default ".") from a
|
|
740
|
-
|
|
740
|
+
nodexui.pwa.config.js config file (default name, override with --config).
|
|
741
741
|
Also copies the default logo/favicon set into [path]/icons/ (existing files kept).
|
|
742
742
|
`);
|
|
743
743
|
}
|