rizzo-css 0.0.40 → 0.0.42
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/README.md +6 -4
- package/bin/rizzo-css.js +142 -124
- package/dist/fonts/DMMono/DMMono-Italic.ttf +0 -0
- package/dist/fonts/DMMono/DMMono-Regular.ttf +0 -0
- package/dist/fonts/DMMono/OFL.txt +93 -0
- package/dist/fonts/DMSans/DMSans-Italic-VariableFont_opsz,wght.ttf +0 -0
- package/dist/fonts/DMSans/DMSans-VariableFont_opsz,wght.ttf +0 -0
- package/dist/fonts/DMSans/OFL.txt +93 -0
- package/dist/fonts/DMSans/README.txt +136 -0
- package/dist/fonts/IBMPlexMono/IBMPlexMono-Italic.ttf +0 -0
- package/dist/fonts/IBMPlexMono/IBMPlexMono-Regular.ttf +0 -0
- package/dist/fonts/IBMPlexMono/OFL.txt +93 -0
- package/dist/fonts/IBMPlexSans/IBMPlexSans-Italic-VariableFont_wdth,wght.ttf +0 -0
- package/dist/fonts/IBMPlexSans/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
- package/dist/fonts/IBMPlexSans/OFL.txt +93 -0
- package/dist/fonts/IBMPlexSans/README.txt +106 -0
- package/dist/fonts/Inter/Inter-Italic-VariableFont_opsz,wght.ttf +0 -0
- package/dist/fonts/Inter/Inter-VariableFont_opsz,wght.ttf +0 -0
- package/dist/fonts/Inter/OFL.txt +93 -0
- package/dist/fonts/JetBrainsMono/AUTHORS.txt +10 -0
- package/dist/fonts/JetBrainsMono/JetBrainsMono-Italic[wght].ttf +0 -0
- package/dist/fonts/JetBrainsMono/JetBrainsMono[wght].ttf +0 -0
- package/dist/fonts/JetBrainsMono/OFL.txt +93 -0
- package/dist/fonts/Outfit/OFL.txt +93 -0
- package/dist/fonts/Outfit/Outfit-VariableFont_wght.ttf +0 -0
- package/dist/fonts/Outfit/README.txt +71 -0
- package/dist/fonts/SourceCodePro/OFL.txt +93 -0
- package/dist/fonts/SourceCodePro/README.txt +79 -0
- package/dist/fonts/SourceCodePro/SourceCodePro-Italic-VariableFont_wght.ttf +0 -0
- package/dist/fonts/SourceCodePro/SourceCodePro-VariableFont_wght.ttf +0 -0
- package/dist/fonts/SourceSans3/OFL.txt +93 -0
- package/dist/fonts/SourceSans3/README.txt +79 -0
- package/dist/fonts/SourceSans3/SourceSans3-Italic-VariableFont_wght.ttf +0 -0
- package/dist/fonts/SourceSans3/SourceSans3-VariableFont_wght.ttf +0 -0
- package/dist/rizzo.min.css +6 -3
- package/package.json +10 -9
- package/scaffold/astro/FontSwitcher.astro +221 -0
- package/scaffold/astro/Modal.astro +14 -8
- package/scaffold/astro/Settings.astro +19 -0
- package/scaffold/astro/SoundEffects.astro +49 -0
- package/scaffold/{astro-minimal → astro-core}/README-RIZZO.md +1 -1
- package/scaffold/astro-core/src/layouts/Layout.astro +33 -0
- package/scaffold/config/fonts.ts +59 -0
- package/scaffold/svelte/DocsSidebar.svelte +47 -0
- package/scaffold/svelte/FontSwitcher.svelte +180 -0
- package/scaffold/svelte/Modal.svelte +2 -0
- package/scaffold/svelte/Settings.svelte +173 -1
- package/scaffold/svelte/SoundEffects.svelte +43 -0
- package/scaffold/{svelte-minimal → svelte-core}/README-RIZZO.md +1 -1
- package/scaffold/vanilla/README-RIZZO.md +3 -3
- package/scaffold/vanilla/components/accordion.html +75 -0
- package/scaffold/vanilla/components/alert.html +75 -0
- package/scaffold/vanilla/components/avatar.html +75 -0
- package/scaffold/vanilla/components/badge.html +75 -0
- package/scaffold/vanilla/components/breadcrumb.html +75 -0
- package/scaffold/vanilla/components/button.html +75 -0
- package/scaffold/vanilla/components/cards.html +75 -0
- package/scaffold/vanilla/components/copy-to-clipboard.html +75 -0
- package/scaffold/vanilla/components/divider.html +75 -0
- package/scaffold/vanilla/components/dropdown.html +75 -0
- package/scaffold/vanilla/components/forms.html +75 -0
- package/scaffold/vanilla/components/icons.html +75 -0
- package/scaffold/vanilla/components/index.html +75 -0
- package/scaffold/vanilla/components/modal.html +75 -0
- package/scaffold/vanilla/components/navbar.html +75 -0
- package/scaffold/vanilla/components/pagination.html +75 -0
- package/scaffold/vanilla/components/progress-bar.html +75 -0
- package/scaffold/vanilla/components/search.html +75 -0
- package/scaffold/vanilla/components/settings.html +75 -0
- package/scaffold/vanilla/components/spinner.html +75 -0
- package/scaffold/vanilla/components/table.html +75 -0
- package/scaffold/vanilla/components/tabs.html +75 -0
- package/scaffold/vanilla/components/theme-switcher.html +75 -0
- package/scaffold/vanilla/components/toast.html +75 -0
- package/scaffold/vanilla/components/tooltip.html +75 -0
- package/scaffold/vanilla/index.html +75 -0
- package/scaffold/vanilla/js/main.js +20 -0
- package/scaffold/astro-minimal/src/layouts/Layout.astro +0 -29
- /package/scaffold/{astro-minimal → astro-core}/.env.example +0 -0
- /package/scaffold/{astro-minimal → astro-core}/astro.config.mjs +0 -0
- /package/scaffold/{astro-minimal → astro-core}/gitignore +0 -0
- /package/scaffold/{astro-minimal → astro-core}/package.json +0 -0
- /package/scaffold/{astro-minimal → astro-core}/public/.gitkeep +0 -0
- /package/scaffold/{astro-minimal → astro-core}/public/favicon.svg +0 -0
- /package/scaffold/{astro-minimal → astro-core}/src/pages/index.astro +0 -0
- /package/scaffold/{astro-minimal → astro-core}/tsconfig.json +0 -0
- /package/scaffold/{svelte-minimal → svelte-core}/.env.example +0 -0
- /package/scaffold/{svelte-minimal → svelte-core}/gitignore +0 -0
- /package/scaffold/{svelte-minimal → svelte-core}/package.json +0 -0
- /package/scaffold/{svelte-minimal → svelte-core}/src/app.d.ts +0 -0
- /package/scaffold/{svelte-minimal → svelte-core}/src/app.html +0 -0
- /package/scaffold/{svelte-minimal → svelte-core}/src/routes/+layout.svelte +0 -0
- /package/scaffold/{svelte-minimal → svelte-core}/src/routes/+page.svelte +0 -0
- /package/scaffold/{svelte-minimal → svelte-core}/static/.gitkeep +0 -0
- /package/scaffold/{svelte-minimal → svelte-core}/svelte.config.js +0 -0
- /package/scaffold/{svelte-minimal → svelte-core}/tsconfig.json +0 -0
package/README.md
CHANGED
|
@@ -12,13 +12,15 @@ pnpm add rizzo-css
|
|
|
12
12
|
yarn add rizzo-css
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
**Quick start (no install):** `npx rizzo-css init` — choose **framework** (Vanilla, Astro, or Svelte), then **add to existing** or **create new**. **Existing** (or `npx rizzo-css add`) → drop in CSS + hand-pick components; you must add the `<link>` yourself (CLI prints the exact tag). **New** → choose **
|
|
15
|
+
**Quick start (no install):** `npx rizzo-css init` — choose **framework** (Vanilla, Astro, or Svelte), then **add to existing** or **create new**. **Existing** (or `npx rizzo-css add`) → drop in CSS + hand-pick components; you must add the `<link>` yourself (CLI prints the exact tag). **New** → choose **Core** (all 31 components) or **Manual** (pick which to include; all pre-selected), then package manager. Core includes all 31 components and required dependencies so every component works. Run `npx rizzo-css help components` for the dependency list. Non-interactive: `npx rizzo-css init --yes --framework vanilla|astro|svelte`. Optional **rizzo-css.json** and `add --install-package`. All get the **same CSS and component styles**. To use the **official Svelte or Astro create command** plus Rizzo, create the app first, then run `npx rizzo-css add`:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
npm create svelte@latest my-app && cd my-app && npx rizzo-css add
|
|
19
19
|
npm create astro@latest my-app && cd my-app && npx rizzo-css add
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
**Running the CLI:** npm → `npx`; pnpm → `pnpm dlx`; yarn → `npx` (Yarn 1 has no `dlx`; works with Yarn 2+ too); bun → `bunx`. The [docs site](https://rizzo-css.vercel.app/docs/getting-started) tabs show the correct command for each manager.
|
|
23
|
+
|
|
22
24
|
`add` writes **RIZZO-SNIPPET.txt** (link + theme) by default; use `--no-snippet` to skip. `npx rizzo-css doctor` checks config and CSS path. `npx rizzo-css theme` lists themes.
|
|
23
25
|
|
|
24
26
|
| | **Create new** (`init` → new) | **Add to existing** (`add` or `init` → existing) |
|
|
@@ -46,7 +48,7 @@ You install **the same package** for every framework: `npm install rizzo-css`. N
|
|
|
46
48
|
|
|
47
49
|
With `npx rizzo-css add --path <dir>`, the CLI still suggests the correct href for your framework (e.g. Astro/Svelte get a leading `/` path).
|
|
48
50
|
|
|
49
|
-
Scaffolds in the package: `scaffold/vanilla/` (
|
|
51
|
+
Scaffolds in the package: `scaffold/vanilla/` (Core or Manual), `scaffold/astro-core/`, `scaffold/svelte-core/`, plus `scaffold/astro/` and `scaffold/svelte/` (component templates for hand-pick), and `scaffold/config/` (font pairs for the Settings component). When you add **Settings** via the CLI (Astro or Svelte), the CLI also copies `scaffold/config/fonts.ts` into your project so the font-pair dropdown works (Astro: `src/components/config/fonts.ts`; Svelte: `src/lib/config/fonts.ts`). Use `npx rizzo-css init` and choose **Create new project**; **Core** includes all 31 components, **Manual** lets you pick (all interactive pre-selected). The stylesheet link is in the layout. **Add to existing** (or `add` command) drops in CSS + hand-pick components; **you must add the stylesheet `<link>` yourself** — the CLI prints the exact tag. Every scaffold includes LICENSE-RIZZO, README-RIZZO.md, and .gitignore (does not overwrite your project files); Astro/Svelte include package.json and .env.example.
|
|
50
52
|
|
|
51
53
|
## Use
|
|
52
54
|
|
|
@@ -61,7 +63,7 @@ import 'rizzo-css';
|
|
|
61
63
|
**Without a bundler (plain HTML):** Use a CDN. Both unpkg and jsDelivr resolve the package root to the built CSS (via the `unpkg` / `jsdelivr` fields in this package). For reliability or to pin a version, use the explicit path:
|
|
62
64
|
|
|
63
65
|
```html
|
|
64
|
-
<!-- unpkg (pin version: replace @latest with @0.0.
|
|
66
|
+
<!-- unpkg (pin version: replace @latest with @0.0.42 or any version) -->
|
|
65
67
|
<link rel="stylesheet" href="https://unpkg.com/rizzo-css@latest/dist/rizzo.min.css" />
|
|
66
68
|
|
|
67
69
|
<!-- or jsDelivr -->
|
|
@@ -70,7 +72,7 @@ import 'rizzo-css';
|
|
|
70
72
|
|
|
71
73
|
Short URLs also work: `https://unpkg.com/rizzo-css@latest` and `https://cdn.jsdelivr.net/npm/rizzo-css@latest` (CDNs serve the default file from package.json). To verify after publish: open the URL in a browser or run `curl -I https://unpkg.com/rizzo-css@latest/dist/rizzo.min.css` and expect `200 OK`.
|
|
72
74
|
|
|
73
|
-
Use the same class names and HTML structure as in the [component docs](https://rizzo-css.vercel.app/docs/components). **Vanilla JS**, Astro, and Svelte all use the same CSS and BEM markup; Astro/Svelte add framework component files when you hand-pick. Each scaffold has README-RIZZO.md; every install includes LICENSE-RIZZO. The **Navbar** component in the scaffold includes the default Cat logo in the brand link (optional `logo` prop for a custom image). The **Vanilla**
|
|
75
|
+
Use the same class names and HTML structure as in the [component docs](https://rizzo-css.vercel.app/docs/components). **Vanilla JS**, Astro, and Svelte all use the same CSS and BEM markup; Astro/Svelte add framework component files when you hand-pick. Each scaffold has README-RIZZO.md; every install includes LICENSE-RIZZO. The **Navbar** component in the scaffold includes the default Cat logo in the brand link (optional `logo` prop for a custom image). The **Vanilla** Core includes a Settings panel and toast; **Astro** and **Svelte** Core scaffolds include theme persistence and toast (`showToast`, `removeToast`, `removeAllToasts`).
|
|
74
76
|
|
|
75
77
|
## Themes
|
|
76
78
|
|
package/bin/rizzo-css.js
CHANGED
|
@@ -31,37 +31,22 @@ const FRAMEWORKS = ['vanilla', 'astro', 'svelte'];
|
|
|
31
31
|
/** Supported package managers: detection, install/add commands, and --package-manager override. */
|
|
32
32
|
const VALID_PACKAGE_MANAGERS = ['npm', 'pnpm', 'yarn', 'bun'];
|
|
33
33
|
|
|
34
|
-
/**
|
|
34
|
+
/** Core = everything we ship. Manual = same base, pick which components to include. */
|
|
35
35
|
const TEMPLATES = {
|
|
36
36
|
vanilla: [
|
|
37
|
-
{ value: '
|
|
38
|
-
{ value: 'minimal', label: 'Minimal — index.html + CSS + js/main.js + all interactive components (recommended starter)' },
|
|
37
|
+
{ value: 'core', label: 'Core — index.html + theme switcher, js/main.js, icons, component showcase, ' + SCAFFOLD_README_FILENAME },
|
|
39
38
|
{ value: 'manual', label: 'Manual — index.html + CSS; pick which components to add (base = all interactive)' },
|
|
40
39
|
],
|
|
41
40
|
astro: [
|
|
42
|
-
{ value: '
|
|
43
|
-
{ value: 'minimal', label: 'Minimal — Astro app + all interactive components (full base; everything works together)' },
|
|
41
|
+
{ value: 'core', label: 'Core — Astro app + all components (with dependencies so everything works)' },
|
|
44
42
|
{ value: 'manual', label: 'Manual — same base; pick which components to include (all interactive pre-selected)' },
|
|
45
43
|
],
|
|
46
44
|
svelte: [
|
|
47
|
-
{ value: '
|
|
48
|
-
{ value: 'minimal', label: 'Minimal — SvelteKit app + all interactive components (full base; everything works together)' },
|
|
45
|
+
{ value: 'core', label: 'Core — SvelteKit app + all components (with dependencies so everything works)' },
|
|
49
46
|
{ value: 'manual', label: 'Manual — same base; pick which components to include (all interactive pre-selected)' },
|
|
50
47
|
],
|
|
51
48
|
};
|
|
52
49
|
|
|
53
|
-
const VANILLA_MINIMAL_README = `# Vanilla + Rizzo CSS (minimal)
|
|
54
|
-
|
|
55
|
-
Minimal starter: HTML + CSS + js/main.js + all interactive component pages. Scaffolded with \`npx rizzo-css init --framework vanilla --template minimal\`.
|
|
56
|
-
|
|
57
|
-
- Open \`index.html\` in a browser or serve the folder. Edit \`index.html\` and add your content. CSS: \`css/rizzo.min.css\`. Script: \`js/main.js\` (already linked).
|
|
58
|
-
- \`components/\` contains HTML pages for every interactive component (Button, Badge, Card, Modal, Tabs, Navbar, Search, Settings, ThemeSwitcher, Dropdown, Accordion, Toast, CopyToClipboard, forms, table, etc.). Open \`components/index.html\` to browse them.
|
|
59
|
-
- Set a theme: \`<html data-theme="github-dark-classic">\` (see \`npx rizzo-css theme\` for all themes).
|
|
60
|
-
- Template **Full** adds the same components in a full showcase layout with theme switcher on every page.
|
|
61
|
-
|
|
62
|
-
Docs: [rizzo-css.vercel.app](https://rizzo-css.vercel.app)
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
50
|
const VANILLA_MANUAL_README = `# Vanilla + Rizzo CSS (manual)
|
|
66
51
|
|
|
67
52
|
Manual setup: HTML + CSS, plus the component pages you chose (base = all interactive components). Scaffolded with \`npx rizzo-css init --framework vanilla --template manual\`.
|
|
@@ -71,7 +56,7 @@ Manual setup: HTML + CSS, plus the component pages you chose (base = all interac
|
|
|
71
56
|
- If you picked components, \`components/\` has their HTML pages and \`js/main.js\` is included (open \`components/index.html\` to browse).
|
|
72
57
|
- Set a theme: \`<html data-theme="github-dark-classic">\` (see \`npx rizzo-css theme\` for all themes).
|
|
73
58
|
|
|
74
|
-
**If you chose no components:** To add component JavaScript (modal, dropdown, tabs, toast, search, navbar, copy-to-clipboard, theme switcher, etc.), use the [Vanilla component docs](https://rizzo-css.vercel.app/docs/vanilla/components) or run \`npx rizzo-css init\` with Vanilla → **
|
|
59
|
+
**If you chose no components:** To add component JavaScript (modal, dropdown, tabs, toast, search, navbar, copy-to-clipboard, theme switcher, etc.), use the [Vanilla component docs](https://rizzo-css.vercel.app/docs/vanilla/components) or run \`npx rizzo-css init\` with Vanilla → **Core** in a temp folder and copy \`js/main.js\` and \`components/\` into this project.
|
|
75
60
|
|
|
76
61
|
Docs: [rizzo-css.vercel.app](https://rizzo-css.vercel.app)
|
|
77
62
|
`;
|
|
@@ -111,23 +96,23 @@ const SVELTE_COMPONENTS = [
|
|
|
111
96
|
'Button', 'Badge', 'Card', 'Divider', 'Spinner', 'ProgressBar', 'Avatar', 'Alert',
|
|
112
97
|
'Breadcrumb', 'FormGroup', 'Input', 'Checkbox', 'Textarea', 'Select', 'Radio',
|
|
113
98
|
'CopyToClipboard', 'Tooltip', 'Pagination', 'Tabs', 'Accordion', 'Dropdown',
|
|
114
|
-
'Modal', 'Toast', 'Table', 'ThemeSwitcher',
|
|
99
|
+
'Modal', 'Toast', 'Table', 'ThemeSwitcher', 'FontSwitcher', 'SoundEffects',
|
|
115
100
|
'Navbar', 'Settings', 'Search', 'Icons',
|
|
116
101
|
];
|
|
117
102
|
const ASTRO_COMPONENTS = [
|
|
118
103
|
'Button', 'Badge', 'Card', 'Divider', 'Spinner', 'ProgressBar', 'Avatar', 'Alert',
|
|
119
104
|
'Breadcrumb', 'FormGroup', 'Input', 'Checkbox', 'Textarea', 'Select', 'Radio',
|
|
120
105
|
'CopyToClipboard', 'Tooltip', 'Pagination', 'Tabs', 'Accordion', 'Dropdown',
|
|
121
|
-
'Modal', 'Toast', 'Table', 'ThemeSwitcher',
|
|
106
|
+
'Modal', 'Toast', 'Table', 'ThemeSwitcher', 'FontSwitcher', 'SoundEffects',
|
|
122
107
|
'Navbar', 'Settings', 'Search', 'Icons',
|
|
123
108
|
];
|
|
124
109
|
|
|
125
|
-
// Base set for
|
|
110
|
+
// Base set for Manual: all interactive components we ship (so manual has a full working set). Full includes everything (same list).
|
|
126
111
|
const RECOMMENDED_COMPONENTS = [
|
|
127
112
|
'Button', 'Badge', 'Card', 'Divider', 'Spinner', 'ProgressBar', 'Avatar', 'Alert',
|
|
128
113
|
'Breadcrumb', 'FormGroup', 'Input', 'Checkbox', 'Textarea', 'Select', 'Radio',
|
|
129
114
|
'CopyToClipboard', 'Tooltip', 'Pagination', 'Tabs', 'Accordion', 'Dropdown',
|
|
130
|
-
'Modal', 'Toast', 'Table', 'ThemeSwitcher',
|
|
115
|
+
'Modal', 'Toast', 'Table', 'ThemeSwitcher', 'FontSwitcher', 'SoundEffects',
|
|
131
116
|
'Navbar', 'Search', 'Settings', 'Icons',
|
|
132
117
|
];
|
|
133
118
|
|
|
@@ -137,8 +122,8 @@ const VANILLA_JS_COMPONENTS = ['Modal', 'Dropdown', 'Tabs', 'Toast', 'ThemeSwitc
|
|
|
137
122
|
// Component dependencies per framework: when user selects a component, these are copied automatically so it works.
|
|
138
123
|
// Manual users can run: npx rizzo-css help components
|
|
139
124
|
const COMPONENT_DEPS = {
|
|
140
|
-
astro: { Settings: ['ThemeSwitcher'], Toast: ['Alert'], Navbar: ['Search', 'Settings'] },
|
|
141
|
-
svelte: { Settings: ['ThemeSwitcher'], Toast: ['Alert'], Navbar: ['Search', 'Settings'] },
|
|
125
|
+
astro: { Settings: ['ThemeSwitcher', 'FontSwitcher', 'SoundEffects'], Toast: ['Alert'], Navbar: ['Search', 'Settings'] },
|
|
126
|
+
svelte: { Settings: ['ThemeSwitcher', 'FontSwitcher', 'SoundEffects'], Toast: ['Alert'], Navbar: ['Search', 'Settings'] },
|
|
142
127
|
};
|
|
143
128
|
|
|
144
129
|
function getComponentDeps(framework, componentName) {
|
|
@@ -153,7 +138,7 @@ function getComponentDependencyLabel(framework, componentName) {
|
|
|
153
138
|
return ' (adds ' + deps.join(', ') + ')';
|
|
154
139
|
}
|
|
155
140
|
|
|
156
|
-
/** Expand a list of component names with all required dependencies. Used for full,
|
|
141
|
+
/** Expand a list of component names with all required dependencies. Used for full, manual, and add so everything works. */
|
|
157
142
|
function expandWithDeps(framework, names) {
|
|
158
143
|
const depsMap = COMPONENT_DEPS[framework];
|
|
159
144
|
if (!depsMap) return [...names];
|
|
@@ -304,9 +289,9 @@ function copyVanillaGitignore(projectDir) {
|
|
|
304
289
|
}
|
|
305
290
|
}
|
|
306
291
|
|
|
307
|
-
/** Copy Astro
|
|
292
|
+
/** Copy Astro scaffold gitignore into project as .gitignore (full template). */
|
|
308
293
|
function copyAstroGitignore(projectDir) {
|
|
309
|
-
const gitignorePath = join(
|
|
294
|
+
const gitignorePath = join(getScaffoldAstroCoreDir(), SCAFFOLD_GITIGNORE_FILE);
|
|
310
295
|
if (existsSync(gitignorePath)) {
|
|
311
296
|
copyFileSync(gitignorePath, join(projectDir, '.gitignore'));
|
|
312
297
|
const copiedAsFile = join(projectDir, SCAFFOLD_GITIGNORE_FILE);
|
|
@@ -314,9 +299,9 @@ function copyAstroGitignore(projectDir) {
|
|
|
314
299
|
}
|
|
315
300
|
}
|
|
316
301
|
|
|
317
|
-
/** Copy Svelte
|
|
302
|
+
/** Copy Svelte scaffold gitignore into project as .gitignore (full template). */
|
|
318
303
|
function copySvelteGitignore(projectDir) {
|
|
319
|
-
const gitignorePath = join(
|
|
304
|
+
const gitignorePath = join(getScaffoldSvelteCoreDir(), SCAFFOLD_GITIGNORE_FILE);
|
|
320
305
|
if (existsSync(gitignorePath)) {
|
|
321
306
|
copyFileSync(gitignorePath, join(projectDir, '.gitignore'));
|
|
322
307
|
const copiedAsFile = join(projectDir, SCAFFOLD_GITIGNORE_FILE);
|
|
@@ -424,7 +409,7 @@ function getPackageManagerCommands(pm) {
|
|
|
424
409
|
run: (script) => (pm.agent === 'npm' ? c + ' run ' + script : c + ' run ' + script),
|
|
425
410
|
add: (pkg) => (pm.agent === 'npm' ? c + ' install ' + pkg : c + ' add ' + pkg),
|
|
426
411
|
addDev: (pkg) => (pm.agent === 'npm' ? c + ' install -D ' + pkg : pm.agent === 'bun' ? c + ' add -d ' + pkg : c + ' add -D ' + pkg),
|
|
427
|
-
dlx: (pkgAndArgs) => (pm.agent === 'npm' ? 'npx ' + pkgAndArgs : pm.agent === 'pnpm' ? 'pnpm dlx ' + pkgAndArgs : pm.agent === 'yarn' ? '
|
|
412
|
+
dlx: (pkgAndArgs) => (pm.agent === 'npm' ? 'npx ' + pkgAndArgs : pm.agent === 'pnpm' ? 'pnpm dlx ' + pkgAndArgs : pm.agent === 'yarn' ? 'npx ' + pkgAndArgs : 'bunx ' + pkgAndArgs),
|
|
428
413
|
};
|
|
429
414
|
}
|
|
430
415
|
|
|
@@ -458,7 +443,7 @@ async function promptPackageManager(projectDir) {
|
|
|
458
443
|
return selectMenu(options, '? Package manager (for install and run commands)');
|
|
459
444
|
}
|
|
460
445
|
|
|
461
|
-
/** Prompt user to select
|
|
446
|
+
/** Prompt user to select Core or Manual for the chosen framework. Returns 'core' or 'manual'. */
|
|
462
447
|
async function promptTemplate(framework) {
|
|
463
448
|
const options = TEMPLATES[framework] || TEMPLATES.vanilla;
|
|
464
449
|
return selectMenu(options, '? Full or Manual?');
|
|
@@ -480,6 +465,27 @@ async function confirmRunInstall(pm) {
|
|
|
480
465
|
return answer === '' || /^y(es)?$/i.test(answer);
|
|
481
466
|
}
|
|
482
467
|
|
|
468
|
+
/** Prompt yes/no; default yes. Returns true to initialize git repo, false to skip. */
|
|
469
|
+
async function confirmGitInit() {
|
|
470
|
+
const answer = await question('\nInitialize a git repository? (Y/n) ');
|
|
471
|
+
return answer === '' || /^y(es)?$/i.test(answer);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/** Run git init in projectDir if .git does not already exist. Returns true if init ran (or already a repo), false on failure. */
|
|
475
|
+
function runGitInit(projectDir) {
|
|
476
|
+
const gitDir = join(projectDir, '.git');
|
|
477
|
+
if (existsSync(gitDir)) {
|
|
478
|
+
return true;
|
|
479
|
+
}
|
|
480
|
+
const code = runInDir(projectDir, 'git init');
|
|
481
|
+
if (code === 0) {
|
|
482
|
+
console.log(' ✓ Git repository initialized.');
|
|
483
|
+
return true;
|
|
484
|
+
}
|
|
485
|
+
console.error(' ✗ git init failed (exit ' + code + '). You can run "git init" manually in the project directory.');
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
488
|
+
|
|
483
489
|
/** Ask user to copy js/main.js for vanilla interactive components. */
|
|
484
490
|
async function confirmCopyVanillaJs() {
|
|
485
491
|
const answer = await question('\nCopy js/main.js for modal, dropdown, tabs, toast, search, navbar, copy-to-clipboard, theme switcher? (Y/n) ');
|
|
@@ -793,7 +799,7 @@ rizzo-css CLI — Add Rizzo CSS to your project (Vanilla, Astro, Svelte)
|
|
|
793
799
|
Available commands: init, add, theme, doctor, help
|
|
794
800
|
|
|
795
801
|
Flags summary:
|
|
796
|
-
init --yes --path <dir> --framework <fw> --template <t> --package-manager <pm> --install --no-install
|
|
802
|
+
init --yes --path <dir> --framework <fw> --template <t> --package-manager <pm> --install --no-install --no-git
|
|
797
803
|
add --path <dir> --framework <fw> ... --no-snippet --readme --force --vanilla-js
|
|
798
804
|
theme (no flags)
|
|
799
805
|
doctor Check config, CSS file, and optional layout link
|
|
@@ -802,24 +808,25 @@ Flags summary:
|
|
|
802
808
|
Usage (use your package manager):
|
|
803
809
|
npx rizzo-css <command> [options]
|
|
804
810
|
pnpm dlx rizzo-css <command> [options]
|
|
805
|
-
yarn
|
|
811
|
+
yarn: npx rizzo-css <command> [options] (Yarn 1 has no dlx; Yarn 2+ can use yarn dlx)
|
|
806
812
|
bunx rizzo-css <command> [options]
|
|
807
813
|
|
|
808
814
|
Commands:
|
|
809
|
-
init New project =
|
|
815
|
+
init New project = Core (everything) | Manual (pick which components; all pre-selected). Existing = drop in CSS + hand-pick. First: framework, then existing vs new.
|
|
810
816
|
add Same as init → existing: drop in CSS + hand-pick components (framework detected or from rizzo-css.json)
|
|
811
817
|
theme List all available themes (use in init or set data-theme on <html>)
|
|
812
818
|
help Show this help
|
|
813
819
|
|
|
814
820
|
Options (init):
|
|
815
|
-
--yes Non-interactive: scaffold new in cwd with defaults (framework: astro, template:
|
|
821
|
+
--yes Non-interactive: scaffold new in cwd with defaults (framework: astro, template: core)
|
|
816
822
|
--path <dir> Project directory (relative to cwd or absolute). Scaffold and run install there. With --yes; interactive: "Enter path" option.
|
|
817
823
|
--framework <fw> vanilla | astro | svelte (with --yes; otherwise first prompt)
|
|
818
|
-
--template <t>
|
|
824
|
+
--template <t> core | manual (all frameworks); with --yes defaults to core
|
|
819
825
|
--package-manager <pm> npm | pnpm | yarn | bun (with --yes, or skip PM prompt when interactive)
|
|
820
826
|
--install After scaffolding, run package manager install in project directory (no prompt)
|
|
821
827
|
--no-install Do not run install and do not prompt
|
|
822
|
-
|
|
828
|
+
--no-git With --yes, skip initializing a git repository (default with --yes is to run git init)
|
|
829
|
+
(Git: only init offers or runs git init. Interactive init: "Initialize a git repository? (Y/n)" for all frameworks. With --yes, git init runs unless --no-git. Add (CSS + components) does not prompt for git. Astro/Svelte then get "Run install now? (Y/n)"; Vanilla has no package manager. rizzo-css.json is written only when the project does not already have one.)
|
|
823
830
|
|
|
824
831
|
Options (add):
|
|
825
832
|
--path <dir> Target directory for rizzo.min.css (overrides config and framework default)
|
|
@@ -833,7 +840,7 @@ Options (add):
|
|
|
833
840
|
--vanilla-js (Vanilla) Copy js/main.js for interactive components (modal, dropdown, tabs, toast, search, navbar, copy-to-clipboard, theme switcher)
|
|
834
841
|
|
|
835
842
|
Package managers:
|
|
836
|
-
Supported: npm, pnpm, yarn, bun. Detection: lockfiles (pnpm-lock.yaml, yarn.lock, bun.lockb, package-lock.json) or package.json "packageManager"/"devEngines.packageManager". Use --package-manager to override.
|
|
843
|
+
Supported: npm, pnpm, yarn, bun. Detection: lockfiles (pnpm-lock.yaml, yarn.lock, bun.lockb, package-lock.json) or package.json "packageManager"/"devEngines.packageManager". Use --package-manager to override. Yarn 1 (classic) has no dlx; we show npx for yarn so it works everywhere. Yarn 2+ can use yarn dlx instead.
|
|
837
844
|
|
|
838
845
|
Interactive prompts (when no --yes/flag provided):
|
|
839
846
|
Single-choice (framework, template, etc.): ↑/↓ move, Enter select.
|
|
@@ -848,11 +855,11 @@ Use framework CLI first, then add Rizzo CSS (match your package manager):
|
|
|
848
855
|
For Vanilla: npx rizzo-css init --yes --framework vanilla
|
|
849
856
|
npm create svelte@latest my-app && cd my-app && npx rizzo-css add
|
|
850
857
|
pnpm dlx create-svelte@latest my-app && cd my-app && pnpm dlx rizzo-css add
|
|
851
|
-
yarn create svelte my-app && cd my-app &&
|
|
858
|
+
yarn create svelte my-app && cd my-app && npx rizzo-css add
|
|
852
859
|
bun create svelte my-app && cd my-app && bunx rizzo-css add
|
|
853
860
|
npm create astro@latest my-app && cd my-app && npx rizzo-css add
|
|
854
861
|
pnpm dlx create-astro@latest my-app && cd my-app && pnpm dlx rizzo-css add
|
|
855
|
-
yarn create astro my-app && cd my-app &&
|
|
862
|
+
yarn create astro my-app && cd my-app && npx rizzo-css add
|
|
856
863
|
bun create astro my-app && cd my-app && bunx rizzo-css add
|
|
857
864
|
|
|
858
865
|
Examples:
|
|
@@ -861,7 +868,7 @@ Examples:
|
|
|
861
868
|
npx rizzo-css init --yes --path my-app --framework astro --install
|
|
862
869
|
npx rizzo-css init --yes --framework astro --package-manager pnpm --install
|
|
863
870
|
npx rizzo-css init --yes --framework vanilla
|
|
864
|
-
npx rizzo-css init --yes --framework svelte --template
|
|
871
|
+
npx rizzo-css init --yes --framework svelte --template core
|
|
865
872
|
npx rizzo-css add --package-manager yarn --install-package
|
|
866
873
|
npx rizzo-css add
|
|
867
874
|
npx rizzo-css add Button
|
|
@@ -893,7 +900,7 @@ Available to pick (Astro & Svelte; same list):
|
|
|
893
900
|
|
|
894
901
|
Dependencies (when you pick the component on the left, the right is added automatically):
|
|
895
902
|
Navbar → Search, Settings (navbar includes search bar; Settings so gear button works)
|
|
896
|
-
Settings → ThemeSwitcher (and themes.ts)
|
|
903
|
+
Settings → ThemeSwitcher, FontSwitcher, SoundEffects (and themes.ts)
|
|
897
904
|
Toast → Alert
|
|
898
905
|
|
|
899
906
|
ThemeSwitcher and ThemeIcon: when selected, themes.ts (and Svelte theme.ts) is copied so they work.
|
|
@@ -904,9 +911,8 @@ Where components are copied:
|
|
|
904
911
|
Svelte → src/lib/rizzo/ (import from '$lib/rizzo')
|
|
905
912
|
Vanilla → components/ (HTML) (for interactivity add js/main.js; use --vanilla-js on add)
|
|
906
913
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
Manual = you pick; the picker shows e.g. "Settings (adds ThemeSwitcher)". Required deps are added when you confirm.
|
|
914
|
+
Core = all components above; dependencies are included so everything works.
|
|
915
|
+
Manual = you pick; the picker shows e.g. "Settings (adds ThemeSwitcher, FontSwitcher, SoundEffects)". Required deps are added when you confirm.
|
|
910
916
|
|
|
911
917
|
To see this again: npx rizzo-css help components
|
|
912
918
|
`);
|
|
@@ -1124,6 +1130,10 @@ function getScaffoldUtilsDir() {
|
|
|
1124
1130
|
return join(getPackageRoot(), 'scaffold', 'utils');
|
|
1125
1131
|
}
|
|
1126
1132
|
|
|
1133
|
+
function getScaffoldConfigDir() {
|
|
1134
|
+
return join(getPackageRoot(), 'scaffold', 'config');
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1127
1137
|
function getScaffoldVanillaIndex() {
|
|
1128
1138
|
return join(getPackageRoot(), 'scaffold', 'vanilla', 'index.html');
|
|
1129
1139
|
}
|
|
@@ -1210,12 +1220,12 @@ function copyRizzoIcons(projectDir, framework) {
|
|
|
1210
1220
|
}
|
|
1211
1221
|
}
|
|
1212
1222
|
|
|
1213
|
-
function
|
|
1214
|
-
return join(getPackageRoot(), 'scaffold', 'astro-
|
|
1223
|
+
function getScaffoldAstroCoreDir() {
|
|
1224
|
+
return join(getPackageRoot(), 'scaffold', 'astro-core');
|
|
1215
1225
|
}
|
|
1216
1226
|
|
|
1217
|
-
function
|
|
1218
|
-
return join(getPackageRoot(), 'scaffold', 'svelte-
|
|
1227
|
+
function getScaffoldSvelteCoreDir() {
|
|
1228
|
+
return join(getPackageRoot(), 'scaffold', 'svelte-core');
|
|
1219
1229
|
}
|
|
1220
1230
|
|
|
1221
1231
|
function copyDirRecursive(src, dest) {
|
|
@@ -1291,6 +1301,15 @@ function copySvelteComponents(projectDir, selectedNames) {
|
|
|
1291
1301
|
if (existsSync(themesSrc)) copyFileSync(themesSrc, join(targetDir, 'themes.ts'));
|
|
1292
1302
|
if (existsSync(themeSrc)) copyFileSync(themeSrc, join(targetDir, 'theme.ts'));
|
|
1293
1303
|
}
|
|
1304
|
+
if (toCopy.includes('Settings')) {
|
|
1305
|
+
const configDir = getScaffoldConfigDir();
|
|
1306
|
+
const fontsSrc = join(configDir, 'fonts.ts');
|
|
1307
|
+
if (existsSync(fontsSrc)) {
|
|
1308
|
+
const projectConfigDir = join(projectDir, 'src', 'lib', 'config');
|
|
1309
|
+
mkdirSync(projectConfigDir, { recursive: true });
|
|
1310
|
+
copyFileSync(fontsSrc, join(projectConfigDir, 'fonts.ts'));
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1294
1313
|
if (exports.length > 0 || copyIconsOnly) {
|
|
1295
1314
|
if (exports.length > 0) {
|
|
1296
1315
|
const indexContent = `/** Rizzo CSS Svelte components — selected via npx rizzo-css init */\n${exports.join('\n')}\n`;
|
|
@@ -1347,6 +1366,15 @@ function copyAstroComponents(projectDir, selectedNames) {
|
|
|
1347
1366
|
writeFileSync(join(projectUtilsDir, 'theme.ts'), themeContent);
|
|
1348
1367
|
}
|
|
1349
1368
|
}
|
|
1369
|
+
if (toCopy.includes('Settings')) {
|
|
1370
|
+
const configDir = getScaffoldConfigDir();
|
|
1371
|
+
const fontsSrc = join(configDir, 'fonts.ts');
|
|
1372
|
+
if (existsSync(fontsSrc)) {
|
|
1373
|
+
const projectConfigDir = join(projectDir, 'src', 'components', 'config');
|
|
1374
|
+
mkdirSync(projectConfigDir, { recursive: true });
|
|
1375
|
+
copyFileSync(fontsSrc, join(projectConfigDir, 'fonts.ts'));
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1350
1378
|
if (count > 0 || copyIconsOnly) {
|
|
1351
1379
|
const msg = copyIconsOnly ? 'Icons' : count + ' Astro components + icons';
|
|
1352
1380
|
console.log('\n ✓ ' + msg + ' copied to ' + targetDir);
|
|
@@ -1502,7 +1530,11 @@ async function runAddToExisting(frameworkOverride, options) {
|
|
|
1502
1530
|
: resolvePackageManager(cwd);
|
|
1503
1531
|
const cliExample = pm.dlx('rizzo-css theme');
|
|
1504
1532
|
const configTargetDir = framework === 'astro' ? 'public/css' : framework === 'svelte' ? 'static/css' : targetDirRaw;
|
|
1505
|
-
|
|
1533
|
+
const configPath = join(cwd, RIZZO_CONFIG_FILE);
|
|
1534
|
+
const hadConfig = existsSync(configPath);
|
|
1535
|
+
if (!hadConfig) {
|
|
1536
|
+
writeRizzoConfig(cwd, { targetDir: configTargetDir, framework, packageManager: pm.agent, theme });
|
|
1537
|
+
}
|
|
1506
1538
|
const writeSnippet = options.writeSnippet !== false;
|
|
1507
1539
|
if (writeSnippet) {
|
|
1508
1540
|
const where = framework === 'svelte' ? 'Root layout (e.g. src/app.html)' : framework === 'astro' ? 'Layout (e.g. src/layouts/Layout.astro)' : 'HTML or layout';
|
|
@@ -1524,7 +1556,7 @@ async function runAddToExisting(frameworkOverride, options) {
|
|
|
1524
1556
|
}
|
|
1525
1557
|
console.log('\n✓ Rizzo CSS added to your existing project');
|
|
1526
1558
|
console.log(' - ' + cssTarget);
|
|
1527
|
-
console.log(' - Wrote ' + RIZZO_CONFIG_FILE);
|
|
1559
|
+
if (!hadConfig) console.log(' - Wrote ' + RIZZO_CONFIG_FILE);
|
|
1528
1560
|
if (writeSnippet) console.log(' - Wrote ' + RIZZO_SNIPPET_FILE + ' (copy-paste link + theme)');
|
|
1529
1561
|
if (options.writeReadme) console.log(' - Wrote ' + SCAFFOLD_README_FILENAME);
|
|
1530
1562
|
console.log('\nYou must add the stylesheet link yourself — it is not added automatically.');
|
|
@@ -1576,13 +1608,10 @@ async function cmdInit(argv) {
|
|
|
1576
1608
|
framework = (frameworkArg && FRAMEWORKS.includes(frameworkArg.toLowerCase())) ? frameworkArg.toLowerCase() : (config && config.framework) || 'astro';
|
|
1577
1609
|
initMode = 'new';
|
|
1578
1610
|
const templateArg = getFlagValue(argv, '--template');
|
|
1579
|
-
const defaultTemplate =
|
|
1580
|
-
selectedTemplate = (templateArg && (templateArg === '
|
|
1581
|
-
if (selectedTemplate === '
|
|
1611
|
+
const defaultTemplate = 'core';
|
|
1612
|
+
selectedTemplate = (templateArg && (templateArg === 'core' || templateArg === 'manual')) ? templateArg : defaultTemplate;
|
|
1613
|
+
if (selectedTemplate === 'core' && (framework === 'astro' || framework === 'svelte')) {
|
|
1582
1614
|
selectedComponents = framework === 'svelte' ? [...SVELTE_COMPONENTS] : [...ASTRO_COMPONENTS];
|
|
1583
|
-
} else if (selectedTemplate === 'minimal' && (framework === 'astro' || framework === 'svelte')) {
|
|
1584
|
-
const componentList = framework === 'svelte' ? SVELTE_COMPONENTS : ASTRO_COMPONENTS;
|
|
1585
|
-
selectedComponents = RECOMMENDED_COMPONENTS.filter((c) => componentList.includes(c));
|
|
1586
1615
|
}
|
|
1587
1616
|
const projectDir = customProjectPath ? pathResolve(cwd, customProjectPath) : cwd;
|
|
1588
1617
|
const resolved = resolvePackageManager(projectDir, cwd);
|
|
@@ -1631,20 +1660,17 @@ async function cmdInit(argv) {
|
|
|
1631
1660
|
}
|
|
1632
1661
|
}
|
|
1633
1662
|
|
|
1634
|
-
selectedTemplate = await selectMenu(TEMPLATES[framework] || TEMPLATES.vanilla, '?
|
|
1663
|
+
selectedTemplate = await selectMenu(TEMPLATES[framework] || TEMPLATES.vanilla, '? Core or Manual?');
|
|
1635
1664
|
|
|
1636
|
-
if (selectedTemplate === '
|
|
1665
|
+
if (selectedTemplate === 'core' && (framework === 'astro' || framework === 'svelte')) {
|
|
1637
1666
|
selectedComponents = framework === 'svelte' ? [...SVELTE_COMPONENTS] : [...ASTRO_COMPONENTS];
|
|
1638
|
-
} else if (selectedTemplate === 'minimal' && (framework === 'astro' || framework === 'svelte')) {
|
|
1639
|
-
const componentList = framework === 'svelte' ? SVELTE_COMPONENTS : ASTRO_COMPONENTS;
|
|
1640
|
-
selectedComponents = RECOMMENDED_COMPONENTS.filter((c) => componentList.includes(c));
|
|
1641
1667
|
} else if (selectedTemplate === 'manual') {
|
|
1642
1668
|
const componentList = framework === 'svelte' ? SVELTE_COMPONENTS : ASTRO_COMPONENTS;
|
|
1643
1669
|
const recommended = RECOMMENDED_COMPONENTS.filter((c) => componentList.includes(c));
|
|
1644
1670
|
selectedComponents = await promptComponentChoice(componentList, framework, recommended);
|
|
1645
1671
|
}
|
|
1646
1672
|
|
|
1647
|
-
const wantsThemeSwitcher = (framework === 'vanilla' &&
|
|
1673
|
+
const wantsThemeSwitcher = (framework === 'vanilla' && selectedTemplate === 'core') || selectedComponents.includes('ThemeSwitcher');
|
|
1648
1674
|
if (wantsThemeSwitcher) {
|
|
1649
1675
|
const themeOut = await promptThemes();
|
|
1650
1676
|
theme = themeOut.theme;
|
|
@@ -1689,17 +1715,16 @@ async function cmdInit(argv) {
|
|
|
1689
1715
|
'{{PROJECT_NAME}}': projectNamePkg,
|
|
1690
1716
|
};
|
|
1691
1717
|
|
|
1692
|
-
const
|
|
1693
|
-
const
|
|
1718
|
+
const astroCoreDir = getScaffoldAstroCoreDir();
|
|
1719
|
+
const svelteCoreDir = getScaffoldSvelteCoreDir();
|
|
1694
1720
|
const pathsForScaffold = getFrameworkCssPaths(framework);
|
|
1695
|
-
const useHandpickAstro = selectedTemplate === 'manual' && framework === 'astro' && existsSync(
|
|
1696
|
-
const useHandpickSvelte = selectedTemplate === 'manual' && framework === 'svelte' && existsSync(
|
|
1697
|
-
const useAstroBase =
|
|
1698
|
-
const useSvelteBase =
|
|
1699
|
-
const
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
// Full and minimal get all required dependencies so everything works; manual gets deps when user picks (see prompt labels).
|
|
1721
|
+
const useHandpickAstro = selectedTemplate === 'manual' && framework === 'astro' && existsSync(astroCoreDir);
|
|
1722
|
+
const useHandpickSvelte = selectedTemplate === 'manual' && framework === 'svelte' && existsSync(svelteCoreDir);
|
|
1723
|
+
const useAstroBase = selectedTemplate === 'core' && framework === 'astro' && existsSync(astroCoreDir);
|
|
1724
|
+
const useSvelteBase = selectedTemplate === 'core' && framework === 'svelte' && existsSync(svelteCoreDir);
|
|
1725
|
+
const useVanillaCore = selectedTemplate === 'core' && framework === 'vanilla' && existsSync(getScaffoldVanillaIndex());
|
|
1726
|
+
|
|
1727
|
+
// Full gets all required dependencies so everything works; manual gets deps when user picks (see prompt labels).
|
|
1703
1728
|
let componentsToCopy = selectedComponents;
|
|
1704
1729
|
if ((framework === 'astro' || framework === 'svelte') && selectedComponents.length > 0) {
|
|
1705
1730
|
componentsToCopy = expandWithDeps(framework, selectedComponents);
|
|
@@ -1742,7 +1767,7 @@ async function cmdInit(argv) {
|
|
|
1742
1767
|
|
|
1743
1768
|
if (useHandpickAstro) {
|
|
1744
1769
|
mkdirSync(projectDir, { recursive: true });
|
|
1745
|
-
copyDirRecursiveWithReplacements(
|
|
1770
|
+
copyDirRecursiveWithReplacements(astroCoreDir, projectDir, replacements);
|
|
1746
1771
|
copyRizzoCssAndFontsForAstro(projectDir, cssSource);
|
|
1747
1772
|
cssTarget = join(projectDir, 'public', 'css', 'rizzo.min.css');
|
|
1748
1773
|
if (statSync(cssTarget).size < 5000) {
|
|
@@ -1756,7 +1781,7 @@ async function cmdInit(argv) {
|
|
|
1756
1781
|
}
|
|
1757
1782
|
} else if (useAstroBase) {
|
|
1758
1783
|
mkdirSync(projectDir, { recursive: true });
|
|
1759
|
-
copyDirRecursiveWithReplacements(
|
|
1784
|
+
copyDirRecursiveWithReplacements(astroCoreDir, projectDir, replacements);
|
|
1760
1785
|
copyRizzoCssAndFontsForAstro(projectDir, cssSource);
|
|
1761
1786
|
cssTarget = join(projectDir, 'public', 'css', 'rizzo.min.css');
|
|
1762
1787
|
if (statSync(cssTarget).size < 5000) {
|
|
@@ -1770,7 +1795,7 @@ async function cmdInit(argv) {
|
|
|
1770
1795
|
}
|
|
1771
1796
|
} else if (useHandpickSvelte) {
|
|
1772
1797
|
mkdirSync(projectDir, { recursive: true });
|
|
1773
|
-
copyDirRecursiveWithReplacements(
|
|
1798
|
+
copyDirRecursiveWithReplacements(svelteCoreDir, projectDir, replacements);
|
|
1774
1799
|
copyRizzoCssAndFontsForSvelte(projectDir, cssSource);
|
|
1775
1800
|
cssTarget = join(projectDir, 'static', 'css', 'rizzo.min.css');
|
|
1776
1801
|
if (statSync(cssTarget).size < 5000) {
|
|
@@ -1784,7 +1809,7 @@ async function cmdInit(argv) {
|
|
|
1784
1809
|
}
|
|
1785
1810
|
} else if (useSvelteBase) {
|
|
1786
1811
|
mkdirSync(projectDir, { recursive: true });
|
|
1787
|
-
copyDirRecursiveWithReplacements(
|
|
1812
|
+
copyDirRecursiveWithReplacements(svelteCoreDir, projectDir, replacements);
|
|
1788
1813
|
copyRizzoCssAndFontsForSvelte(projectDir, cssSource);
|
|
1789
1814
|
cssTarget = join(projectDir, 'static', 'css', 'rizzo.min.css');
|
|
1790
1815
|
if (statSync(cssTarget).size < 5000) {
|
|
@@ -1796,7 +1821,7 @@ async function cmdInit(argv) {
|
|
|
1796
1821
|
copyRizzoIcons(projectDir, 'svelte');
|
|
1797
1822
|
copySvelteComponents(projectDir, componentsToCopy);
|
|
1798
1823
|
}
|
|
1799
|
-
} else if (
|
|
1824
|
+
} else if (useVanillaCore) {
|
|
1800
1825
|
const cssDir = join(projectDir, pathsForScaffold.targetDir);
|
|
1801
1826
|
cssTarget = join(cssDir, 'rizzo.min.css');
|
|
1802
1827
|
const linkHref = 'css/rizzo.min.css';
|
|
@@ -1829,33 +1854,8 @@ async function cmdInit(argv) {
|
|
|
1829
1854
|
mainJs = mainJs.replace(/\{\{DEFAULT_DARK\}\}/g, defaultDark).replace(/\{\{DEFAULT_LIGHT\}\}/g, defaultLight);
|
|
1830
1855
|
writeFileSync(join(projectDir, 'js', 'main.js'), mainJs, 'utf8');
|
|
1831
1856
|
}
|
|
1832
|
-
const
|
|
1833
|
-
copyVanillaComponents(projectDir, Object.keys(VANILLA_COMPONENT_SLUGS),
|
|
1834
|
-
copyPackageLicense(projectDir);
|
|
1835
|
-
copyVanillaGitignore(projectDir);
|
|
1836
|
-
} else if (useVanillaMinimal) {
|
|
1837
|
-
const cssDir = join(projectDir, pathsForScaffold.targetDir);
|
|
1838
|
-
cssTarget = join(cssDir, 'rizzo.min.css');
|
|
1839
|
-
mkdirSync(cssDir, { recursive: true });
|
|
1840
|
-
copyFileSync(cssSource, cssTarget);
|
|
1841
|
-
copyRizzoFonts(dirname(cssTarget));
|
|
1842
|
-
if (statSync(cssTarget).size < 5000) {
|
|
1843
|
-
console.warn('\nWarning: rizzo.min.css is very small. From repo root run: pnpm build:css');
|
|
1844
|
-
}
|
|
1845
|
-
mkdirSync(join(projectDir, 'js'), { recursive: true });
|
|
1846
|
-
const vanillaJs = join(getPackageRoot(), 'scaffold', 'vanilla', 'js', 'main.js');
|
|
1847
|
-
if (existsSync(vanillaJs)) {
|
|
1848
|
-
let mainJs = readFileSync(vanillaJs, 'utf8');
|
|
1849
|
-
mainJs = mainJs.replace(/\{\{DEFAULT_DARK\}\}/g, defaultDark).replace(/\{\{DEFAULT_LIGHT\}\}/g, defaultLight);
|
|
1850
|
-
writeFileSync(join(projectDir, 'js', 'main.js'), mainJs, 'utf8');
|
|
1851
|
-
}
|
|
1852
|
-
const vanillaRepl = { ...replacements, '{{LINK_HREF}}': 'css/rizzo.min.css' };
|
|
1853
|
-
copyVanillaComponents(projectDir, RECOMMENDED_COMPONENTS, vanillaRepl);
|
|
1854
|
-
copyRizzoIcons(projectDir, 'vanilla');
|
|
1855
|
-
const minimalIndexWithScript = minimalHtml.replace('</body>', ' <script src="js/main.js"></script>\n</body>');
|
|
1856
|
-
indexPath = join(projectDir, 'index.html');
|
|
1857
|
-
writeFileSync(indexPath, minimalIndexWithScript, 'utf8');
|
|
1858
|
-
writeFileSync(join(projectDir, SCAFFOLD_README_FILENAME), VANILLA_MINIMAL_README, 'utf8');
|
|
1857
|
+
const vanillaCoreRepl = { ...replacements, '{{LINK_HREF}}': linkHref };
|
|
1858
|
+
copyVanillaComponents(projectDir, Object.keys(VANILLA_COMPONENT_SLUGS), vanillaCoreRepl);
|
|
1859
1859
|
copyPackageLicense(projectDir);
|
|
1860
1860
|
copyVanillaGitignore(projectDir);
|
|
1861
1861
|
} else {
|
|
@@ -1909,12 +1909,10 @@ async function cmdInit(argv) {
|
|
|
1909
1909
|
console.log(' - ' + cssTarget);
|
|
1910
1910
|
if (indexPath) console.log(' - ' + indexPath);
|
|
1911
1911
|
if (framework === 'vanilla') {
|
|
1912
|
-
if (
|
|
1913
|
-
console.log(' - Vanilla JS (
|
|
1914
|
-
} else if (useVanillaMinimal) {
|
|
1915
|
-
console.log(' - Vanilla JS (minimal): index.html + CSS + js/main.js + all interactive components.');
|
|
1912
|
+
if (useVanillaCore) {
|
|
1913
|
+
console.log(' - Vanilla JS (core): theme switcher, js/main.js, icons, component showcase, ' + SCAFFOLD_README_FILENAME + '.');
|
|
1916
1914
|
} else {
|
|
1917
|
-
console.log(' - Vanilla JS (manual): index.html + CSS only. Add JS from docs or copy from
|
|
1915
|
+
console.log(' - Vanilla JS (manual): index.html + CSS only. Add JS from docs or copy from Core.');
|
|
1918
1916
|
}
|
|
1919
1917
|
}
|
|
1920
1918
|
const pm = getPackageManagerCommands({ agent: selectedPm, command: selectedPm });
|
|
@@ -1922,13 +1920,28 @@ async function cmdInit(argv) {
|
|
|
1922
1920
|
const runPrefix = projectDir !== cwd ? 'cd ' + pathRelative(cwd, projectDir) + ' && ' : '';
|
|
1923
1921
|
const hasPackageJson = useHandpickAstro || useHandpickSvelte || useAstroBase || useSvelteBase;
|
|
1924
1922
|
|
|
1925
|
-
//
|
|
1923
|
+
// Write rizzo-css.json only when one doesn't exist (don't overwrite existing config).
|
|
1926
1924
|
const pathsForConfig = getFrameworkCssPaths(framework);
|
|
1927
|
-
|
|
1928
|
-
|
|
1925
|
+
const initConfigPath = join(projectDir, RIZZO_CONFIG_FILE);
|
|
1926
|
+
if (!existsSync(initConfigPath)) {
|
|
1927
|
+
writeRizzoConfig(projectDir, { targetDir: pathsForConfig.targetDir, framework, packageManager: selectedPm, theme });
|
|
1928
|
+
console.log(' - Wrote ' + RIZZO_CONFIG_FILE);
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
// Git init: in every scenario — prompt when interactive, run when --yes (unless --no-git)
|
|
1932
|
+
if (!yes) {
|
|
1933
|
+
const shouldGitInit = await confirmGitInit();
|
|
1934
|
+
if (shouldGitInit) {
|
|
1935
|
+
runGitInit(projectDir);
|
|
1936
|
+
}
|
|
1937
|
+
} else if (!hasFlag(argv, '--no-git')) {
|
|
1938
|
+
runGitInit(projectDir);
|
|
1939
|
+
}
|
|
1929
1940
|
|
|
1941
|
+
// Package manager install: only for Astro/Svelte (Vanilla has no package.json)
|
|
1930
1942
|
if (runInstallAfterScaffold && !noInstall && hasPackageJson) {
|
|
1931
|
-
|
|
1943
|
+
const dirLabel = projectDir !== cwd ? ' in ' + pathRelative(cwd, projectDir) : ' (current directory)';
|
|
1944
|
+
console.log('\nRunning install' + dirLabel + ': ' + pm.install);
|
|
1932
1945
|
const code = runInDir(projectDir, pm.install);
|
|
1933
1946
|
if (code !== 0) {
|
|
1934
1947
|
console.error('\nInstall failed (exit ' + code + '). Run manually: ' + runPrefix + pm.install);
|
|
@@ -1936,7 +1949,8 @@ async function cmdInit(argv) {
|
|
|
1936
1949
|
} else if (!yes && !noInstall && hasPackageJson) {
|
|
1937
1950
|
const shouldRun = await confirmRunInstall(pm);
|
|
1938
1951
|
if (shouldRun) {
|
|
1939
|
-
|
|
1952
|
+
const dirLabel = projectDir !== cwd ? ' in ' + pathRelative(cwd, projectDir) : ' here';
|
|
1953
|
+
console.log('\nRunning install' + dirLabel + ': ' + pm.install);
|
|
1940
1954
|
const code = runInDir(projectDir, pm.install);
|
|
1941
1955
|
if (code !== 0) {
|
|
1942
1956
|
console.error('\nInstall failed (exit ' + code + '). Run manually: ' + runPrefix + pm.install);
|
|
@@ -1949,20 +1963,24 @@ async function cmdInit(argv) {
|
|
|
1949
1963
|
console.log(' - ' + fw + ' (manual): base + ' + selectedComponents.length + ' component(s). Run: ' + runPrefix + nextStep);
|
|
1950
1964
|
}
|
|
1951
1965
|
if (useAstroBase) {
|
|
1952
|
-
|
|
1953
|
-
console.log(' - Astro (' + label.toLowerCase() + '): app + ' + selectedComponents.length + ' component(s). Run: ' + runPrefix + nextStep);
|
|
1966
|
+
console.log(' - Astro (core): app + ' + selectedComponents.length + ' component(s). Run: ' + runPrefix + nextStep);
|
|
1954
1967
|
}
|
|
1955
1968
|
if (useSvelteBase) {
|
|
1956
|
-
|
|
1957
|
-
console.log(' - SvelteKit (' + label.toLowerCase() + '): app + ' + selectedComponents.length + ' component(s). Run: ' + runPrefix + nextStep);
|
|
1969
|
+
console.log(' - SvelteKit (core): app + ' + selectedComponents.length + ' component(s). Run: ' + runPrefix + nextStep);
|
|
1958
1970
|
}
|
|
1959
1971
|
if ((framework === 'astro' || framework === 'svelte') && !useAstroBase && !useSvelteBase && !useHandpickAstro && !useHandpickSvelte) {
|
|
1960
1972
|
const fw = framework === 'svelte' ? 'Svelte' : 'Astro';
|
|
1961
1973
|
const createExample = getCreateProjectExample(pm, framework);
|
|
1962
|
-
console.log('\n -
|
|
1974
|
+
console.log('\n - Basic template (CSS + index). To get a full app: ' + createExample + ', then cd into the project and run ' + pm.dlx('rizzo-css add') + '.');
|
|
1975
|
+
}
|
|
1976
|
+
if (hasPackageJson) {
|
|
1977
|
+
console.log('\nNext: ' + runPrefix + nextStep);
|
|
1978
|
+
} else if (framework === 'vanilla') {
|
|
1979
|
+
const vanillaNext = projectDir !== cwd
|
|
1980
|
+
? 'cd ' + pathRelative(cwd, projectDir) + ' then open index.html or serve the folder (e.g. npx serve .)'
|
|
1981
|
+
: 'open index.html or serve the folder (e.g. npx serve .)';
|
|
1982
|
+
console.log('\nNext: ' + vanillaNext);
|
|
1963
1983
|
}
|
|
1964
|
-
if (hasPackageJson) console.log('\nNext: ' + runPrefix + nextStep);
|
|
1965
|
-
else if (framework === 'vanilla') console.log('\nNext: open index.html or serve the folder.');
|
|
1966
1984
|
console.log('\nDocs: https://rizzo-css.vercel.app\n');
|
|
1967
1985
|
}
|
|
1968
1986
|
|
|
Binary file
|