@rokkit/cli 1.0.0-next.133 → 1.0.0-next.134

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 CHANGED
@@ -1,102 +1,137 @@
1
1
  # @rokkit/cli
2
2
 
3
- A command-line utility for bundling and converting SVG icons into JSON formats compatible with Iconify.
3
+ CLI for Rokkit — SVG icon bundling, Iconify JSON package generation, project initialization, and setup validation.
4
4
 
5
- ## Installation
5
+ ## Install
6
6
 
7
7
  ```bash
8
8
  # Install globally
9
9
  bun add -g @rokkit/cli
10
10
 
11
- # Or use directly with bunx
12
- bunx @rokkit/cli [command]
11
+ # Or run without installing
12
+ bunx @rokkit/cli <command>
13
+ npx @rokkit/cli <command>
13
14
  ```
14
15
 
15
- ## Usage
16
+ The binary is available as `rokkit`.
17
+
18
+ ## Commands
19
+
20
+ ### `rokkit bundle`
21
+
22
+ Scan SVG subfolders and output one Iconify-compatible JSON file per folder.
16
23
 
17
24
  ```bash
18
- rokkit-cli [command] [options]
25
+ rokkit bundle -i ./src/icons -o ./lib
19
26
  ```
20
27
 
21
- ### Commands
28
+ Each subfolder under `--input` becomes a separate JSON bundle in `--output`. Useful for splitting icon sets by category (ui, solid, auth, etc.).
22
29
 
23
- #### `bundle`
30
+ ### `rokkit build`
24
31
 
25
- Bundle icons in source folders into JSON files.
32
+ Build a full Iconify JSON package for each icon subfolder.
26
33
 
27
34
  ```bash
28
- rokkit-cli bundle -i ./icons -o ./dist
35
+ rokkit build -i ./src/icons -o ./lib
29
36
  ```
30
37
 
31
- This command:
38
+ Similar to `bundle` but produces the complete Iconify package structure (with `prefix`, `icons`, `width`, `height`). Use this when publishing icons as a standalone package.
32
39
 
33
- 1. Scans the input directory for subdirectories
34
- 2. Each subdirectory is treated as an icon set
35
- 3. Creates a JSON bundle for each icon set in the output directory
40
+ ### `rokkit init`
36
41
 
37
- #### `build`
42
+ Initialize Rokkit in an existing SvelteKit project.
43
+
44
+ ```bash
45
+ rokkit init
46
+ ```
38
47
 
39
- Build complete Iconify JSON packages for icon sets.
48
+ Interactively sets up `uno.config.ts` with `presetRokkit()`, installs required packages, and configures the project for Rokkit.
49
+
50
+ ### `rokkit doctor`
51
+
52
+ Validate that a Rokkit project is correctly configured.
40
53
 
41
54
  ```bash
42
- rokkit-cli build -i ./icons -o ./dist
55
+ # Check setup
56
+ rokkit doctor
57
+
58
+ # Check and auto-fix safe issues
59
+ rokkit doctor --fix
43
60
  ```
44
61
 
45
- Similar to `bundle`, but creates a full Iconify package structure for each icon set.
62
+ Checks for correct UnoCSS config, theme imports, and required package presence. `--fix` applies automatic repairs where safe to do so.
46
63
 
47
- ### Options
64
+ ## Global Options
48
65
 
49
- | Option | Alias | Description | Default |
50
- | ---------- | ----- | ---------------------------------- | ------------------- |
51
- | `--input` | `-i` | Source folder containing icon sets | `./src` |
52
- | `--output` | `-o` | Target folder for output files | `./build` |
53
- | `--config` | `-c` | Path to custom config file | `./src/config.json` |
66
+ | Option | Alias | Description | Default |
67
+ | ---------- | ----- | --------------------------------------- | ------------- |
68
+ | `--input` | `-i` | Source folder containing SVG subfolders | `./src` |
69
+ | `--output` | `-o` | Output folder for generated files | `./lib` |
70
+ | `--config` | `-c` | Path to config file (relative to input) | `config.json` |
54
71
 
55
72
  ## Configuration File
56
73
 
57
- The configuration file should be a JSON file with the following structure:
74
+ Place a `config.json` inside the input folder to control icon processing:
58
75
 
59
76
  ```json
60
77
  {
61
78
  "package": {
62
- "namespace": "@your-namespace",
79
+ "namespace": "@my-org",
63
80
  "version": "1.0.0",
64
- "homepage": "https://github.com/your-username/your-repo"
65
- },
66
- "icon-set-1": {
67
- "color": true
81
+ "homepage": "https://github.com/my-org/my-icons"
68
82
  },
69
- "icon-set-2": {
83
+ "ui": {
70
84
  "color": false
85
+ },
86
+ "brand": {
87
+ "color": true
71
88
  }
72
89
  }
73
90
  ```
74
91
 
75
- - `package`: Global package information
76
- - `namespace`: Namespace for the icon package
77
- - `version`: Version number
78
- - `homepage`: Repository URL
79
- - Each icon set can have specific configuration:
80
- - `color`: Whether to preserve colors (true) or convert to `currentColor` (false)
92
+ | Field | Description |
93
+ | ------------------- | -------------------------------------------------------------------------- |
94
+ | `package.namespace` | Iconify collection prefix namespace |
95
+ | `package.version` | Published version string |
96
+ | `package.homepage` | Repository or homepage URL |
97
+ | `<set>.color` | `true` preserves original colors; `false` converts fills to `currentColor` |
81
98
 
82
99
  ## Examples
83
100
 
84
- ### Basic usage
85
-
86
101
  ```bash
87
- # Bundle icons
88
- rokkit-cli bundle -i ./src/icons -o ./dist
102
+ # Bundle icons from src/ into lib/
103
+ rokkit bundle -i src -o lib
89
104
 
90
- # Build Iconify packages
91
- rokkit-cli build -i ./src/icons -o ./dist
105
+ # Build full Iconify packages with a custom config
106
+ rokkit build -i src -o lib -c my-config.json
107
+
108
+ # Use with bunx (no global install needed)
109
+ bunx @rokkit/cli bundle -i ./icons -o ./dist
92
110
  ```
93
111
 
94
- ### Using a custom config file
112
+ ## Icon Folder Layout
95
113
 
96
- ```bash
97
- rokkit-cli build -c ./my-config.json -i ./src/icons -o ./dist
114
+ ```
115
+ src/
116
+ ui/
117
+ menu.svg
118
+ close.svg
119
+ solid/
120
+ check.svg
121
+ x.svg
122
+ auth/
123
+ login.svg
124
+ ```
125
+
126
+ Running `rokkit build -i src -o lib` produces:
127
+
128
+ ```
129
+ lib/
130
+ ui.json
131
+ solid.json
132
+ auth.json
98
133
  ```
99
134
 
100
- ## License
135
+ ---
101
136
 
102
- MIT
137
+ Part of [Rokkit](https://github.com/jerrythomas/rokkit) — a Svelte 5 component library and design system.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/cli",
3
- "version": "1.0.0-next.133",
3
+ "version": "1.0.0-next.134",
4
4
  "description": "Command line utilities for icon bundling and conversion.",
5
5
  "author": "Jerry Thomas <me@jerrythomas.name>",
6
6
  "license": "MIT",
@@ -10,6 +10,7 @@
10
10
  "type": "module",
11
11
  "scripts": {
12
12
  "prepublishOnly": "cp ../../LICENSE . && bun clean && bun tsc --project tsconfig.build.json",
13
+ "postpublish": "rm -f LICENSE",
13
14
  "clean": "rm -rf dist",
14
15
  "build": "bun prepublishOnly"
15
16
  },
package/src/doctor.js CHANGED
@@ -36,8 +36,8 @@ export function runChecks(fs) {
36
36
  status: unoUsesPreset ? 'pass' : 'fail',
37
37
  fixable: false,
38
38
  fix: unoExists
39
- ? `Replace uno.config.js contents with:\n${ generateUnoConfig()}`
40
- : `Create uno.config.js with:\n${ generateUnoConfig()}`
39
+ ? `Replace uno.config.js contents with:\n${generateUnoConfig()}`
40
+ : `Create uno.config.js with:\n${generateUnoConfig()}`
41
41
  })
42
42
 
43
43
  // 3. app.css has theme imports
@@ -115,10 +115,10 @@ function autoFix(checks, cwd) {
115
115
  const existing = readFileSync(cssPath, 'utf-8')
116
116
  const missing = imports.filter((line) => !existing.includes(line))
117
117
  if (missing.length > 0) {
118
- writeFileSync(cssPath, `${missing.join('\n') }\n${ existing}`)
118
+ writeFileSync(cssPath, `${missing.join('\n')}\n${existing}`)
119
119
  }
120
120
  } else {
121
- writeFileSync(cssPath, `${imports.join('\n') }\n`)
121
+ writeFileSync(cssPath, `${imports.join('\n')}\n`)
122
122
  }
123
123
  console.info(` Fixed: ${check.label}`)
124
124
  fixed++
package/src/init.js CHANGED
@@ -71,10 +71,7 @@ export default defineConfig({
71
71
  * @returns {string[]}
72
72
  */
73
73
  export function generateAppCssImports(themes) {
74
- const lines = [
75
- "@import '@unocss/reset/tailwind.css';",
76
- "@import '@rokkit/themes/dist/base';"
77
- ]
74
+ const lines = ["@import '@unocss/reset/tailwind.css';", "@import '@rokkit/themes/dist/base';"]
78
75
  for (const theme of themes) {
79
76
  lines.push(`@import '@rokkit/themes/dist/${theme}';`)
80
77
  }
@@ -91,10 +88,7 @@ export function generateAppCssImports(themes) {
91
88
  export function generateInitScript(switcher, storageKey = 'rokkit-theme') {
92
89
  if (switcher === 'system') return null
93
90
 
94
- const setStyle =
95
- switcher === 'full'
96
- ? `b.dataset.style = t.style || 'rokkit'\n `
97
- : ''
91
+ const setStyle = switcher === 'full' ? `b.dataset.style = t.style || 'rokkit'\n ` : ''
98
92
 
99
93
  return ` <script>
100
94
  (function () {
@@ -224,13 +218,13 @@ export async function init() {
224
218
  const existing = readFileSync(appCssPath, 'utf-8')
225
219
  const missing = cssImports.filter((line) => !existing.includes(line))
226
220
  if (missing.length > 0) {
227
- writeFileSync(appCssPath, `${missing.join('\n') }\n${ existing}`)
221
+ writeFileSync(appCssPath, `${missing.join('\n')}\n${existing}`)
228
222
  console.info(` Patched app.css — added ${missing.length} imports`)
229
223
  } else {
230
224
  console.info(' app.css already has theme imports')
231
225
  }
232
226
  } else {
233
- writeFileSync(appCssPath, `${cssImports.join('\n') }\n`)
227
+ writeFileSync(appCssPath, `${cssImports.join('\n')}\n`)
234
228
  console.info(' Created src/app.css')
235
229
  }
236
230