slicejs-cli 2.8.6 → 2.9.1

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,315 +1,347 @@
1
- <div align="center">
2
-
3
- # Slice.js CLI
4
- <img src="./assets/Slice.js-logo.png" alt="Slice.js logo" width="200" />
5
- <br/>
6
-
7
- <div style="display: flex; justify-content: center; align-items: center; gap: 10px; align-content: center;">
8
- <a href="https://www.npmjs.com/package/slicejs-cli"><img src="https://img.shields.io/npm/v/slicejs-cli.svg?label=CLI" alt="npm version" /></a>
9
- <img src="https://img.shields.io/badge/Node-%E2%89%A5%2020.0.0-339933?logo=node.js" alt="node requirement" />
10
- <a href="#license"><img src="https://img.shields.io/badge/License-ISC-blue.svg" alt="license" /></a>
11
- </div>
12
-
13
-
14
- <p>CLI for building web applications with the Slice.js framework</p>
15
-
16
- </div>
17
-
18
- ## Installation
19
-
20
- ### Local (Recommended)
21
-
22
- 1. Install as a development dependency:
23
-
24
- ```bash
25
- npm install slicejs-cli --save-dev
26
- ```
27
-
28
- 2. Add to your `package.json` scripts:
29
-
30
- ```json
31
- {
32
- "scripts": {
33
- "dev": "slice dev",
34
- "build": "slice build",
35
- "slice": "slice"
36
- }
37
- }
38
- ```
39
-
40
- 3. usage:
41
-
42
- ```bash
43
- npm run dev
44
- # or pass arguments
45
- npm run slice -- get Button
46
- ```
47
-
48
- ### Global (Not Recommended)
49
-
50
- Global installations can lead to version mismatches and "works on my machine" issues.
51
-
52
- ```bash
53
- npm install -g slicejs-cli
54
- ```
55
-
56
- ## Usage
57
-
58
- After installation, you can use the `slice` command directly:
59
-
60
- ```bash
61
- slice [command] [options]
62
- ```
63
-
64
- Or with npx (without global install):
65
-
66
- ```bash
67
- npx slicejs-cli [command]
68
- ```
69
-
70
- ## Essential Commands
71
-
72
- ### Initialize a project
73
-
74
- ```bash
75
- slice init
76
- ```
77
-
78
- Initializes a Slice.js project with the full structure (`src/` and `api/`), installs initial Visual components, and configures npm scripts.
79
-
80
- ### Development server
81
-
82
- ```bash
83
- # Default port (3000)
84
- slice dev
85
-
86
- # Custom port
87
- slice dev -p 8080
88
-
89
- # Alias
90
- slice start
91
- slice start -p 8080
92
- ```
93
-
94
- ### Component management (local)
95
-
96
- ```bash
97
- # Create a component (interactive)
98
- slice component create
99
-
100
- # List local components
101
- slice component list
102
-
103
- # Delete a component (interactive)
104
- slice component delete
105
- ```
106
-
107
- Shortcuts:
108
- ```bash
109
- slice comp create
110
- slice comp ls
111
- slice comp remove
112
- ```
113
-
114
- ### Official component registry
115
-
116
- ```bash
117
- # Install Visual components
118
- slice get Button Card Input
119
-
120
- # Install a Service component
121
- slice get FetchManager --service
122
-
123
- # Force overwrite
124
- slice get Button --force
125
-
126
- # Browse available components
127
- slice browse
128
-
129
- # Update all local components
130
- slice sync
131
- slice sync --force
132
- ```
133
-
134
- Shortcuts:
135
- ```bash
136
- slice get Button
137
- slice browse
138
- slice sync
139
- ```
140
-
141
- ### Utilities
142
-
143
- ```bash
144
- # Version info
145
- slice version
146
- slice -v
147
-
148
- # Updates (CLI and Framework)
149
- slice update # Check and prompt to update
150
- slice update --yes # Update everything automatically
151
- slice update --cli # CLI only
152
- slice update --framework # Framework only
153
-
154
- # Help
155
- slice --help
156
- slice [command] --help
157
- ```
158
-
159
- ## npm Scripts
160
-
161
- `slice init` automatically configures the recommended scripts in your `package.json`:
162
-
163
- ```json
164
- {
165
- "scripts": {
166
- "dev": "slice dev",
167
- "start": "slice start",
168
- "get": "slice get",
169
- "browse": "slice browse",
170
- "sync": "slice sync",
171
- "component:create": "slice component create",
172
- "component:list": "slice component list",
173
- "component:delete": "slice component delete"
174
- }
175
- }
176
- ```
177
-
178
- Usage:
179
- ```bash
180
- npm run dev
181
- npm run get
182
- npm run browse
183
- ```
184
-
185
- ## Quick Start
186
-
187
- ```bash
188
- # 1. Create a new project directory
189
- mkdir my-slice-project
190
- cd my-slice-project
191
-
192
- # 2. Initialize npm and install Slice CLI
193
- npm init -y
194
- npm install slicejs-cli --save-dev
195
-
196
- # 3. Initialize Slice.js project
197
- slice init
198
-
199
- # 4. Start development server
200
- slice dev
201
-
202
- # 5. Open browser at http://localhost:3000
203
- ```
204
-
205
- ## Common Workflows
206
-
207
- ### Starting a New Project
208
-
209
- ```bash
210
- slice init
211
- slice dev
212
- ```
213
-
214
- ### Adding Components
215
-
216
- ```bash
217
- # Browse available components
218
- slice browse
219
-
220
- # Install specific components
221
- slice get Button Card Input
222
-
223
- # Create custom component
224
- slice component create
225
- ```
226
-
227
- ### Keeping Components Updated
228
-
229
- ```bash
230
- # Check what needs updating
231
- slice browse
232
-
233
- # Update all components
234
- slice sync
235
- ```
236
-
237
- ## Development Mode
238
-
239
- The development server (`slice dev` / `slice start`) provides:
240
-
241
- - Hot reload
242
- - Serves directly from `/src`
243
- - ✅ No build step
244
- - ✅ Port validation
245
- - Clear error messages
246
-
247
- ## Requirements
248
-
249
- - Node.js >= 20.0.0
250
- - npm or yarn
251
-
252
- ## Configuration
253
-
254
- Project configuration is stored in `src/sliceConfig.json` and is created automatically by `slice init`.
255
-
256
- ## Features
257
-
258
- - 🚀 Development server with hot reload
259
- - 📦 Official component registry
260
- - 🎨 Visual and Service component types
261
- - Interactive component creation
262
- - 🔄 Automatic component synchronization
263
- - 🛠️ Built-in validation and error handling
264
-
265
- ### Smart Updates
266
-
267
- - Detects whether the CLI in use is global or local
268
- - Shows an update plan (GLOBAL/PROJECT) before execution
269
- - Offers to include global CLI update interactively
270
- - Applies `uninstall` + `install @latest` to ensure latest versions
271
-
272
- ### Cross-platform Paths
273
-
274
- - Centralized path helper avoids `../../..`
275
- - Windows/Linux/Mac compatibility using `import.meta.url` and `fileURLToPath`
276
-
277
- ## Troubleshooting
278
-
279
- ### Port already in use
280
-
281
- ```bash
282
- # Use a different port
283
- slice dev -p 8080
284
- ```
285
-
286
- ### Project not initialized
287
-
288
- ```bash
289
- # Make sure to run init first
290
- slice init
291
- ```
292
-
293
- ### Command not found
294
-
295
- ```bash
296
- # Use npx if not installed globally
297
- npx slicejs-cli dev
298
-
299
- # Or install globally
300
- npm install -g slicejs-cli
301
- ```
302
-
303
- ## Links
304
-
305
- - 📘 Documentation: https://slice-js-docs.vercel.app/
306
- - 🐙 GitHub: https://github.com/VKneider/slice-cli
307
- - 📦 npm: https://www.npmjs.com/package/slicejs-cli
308
-
309
- ## License
310
-
311
- ISC
312
-
313
- ## Author
314
-
315
- vkneider
1
+ <div align="center">
2
+
3
+ # Slice.js CLI
4
+ <img src="./assets/Slice.js-logo.png" alt="Slice.js logo" width="200" />
5
+ <br/>
6
+
7
+ <div style="display: flex; justify-content: center; align-items: center; gap: 10px; align-content: center;">
8
+ <a href="https://www.npmjs.com/package/slicejs-cli"><img src="https://img.shields.io/npm/v/slicejs-cli.svg?label=CLI" alt="npm version" /></a>
9
+ <img src="https://img.shields.io/badge/Node-%E2%89%A5%2020.0.0-339933?logo=node.js" alt="node requirement" />
10
+ <a href="#license"><img src="https://img.shields.io/badge/License-ISC-blue.svg" alt="license" /></a>
11
+ </div>
12
+
13
+
14
+ <p>CLI for building web applications with the Slice.js framework</p>
15
+
16
+ </div>
17
+
18
+ ## Installation
19
+
20
+ ### Local (Recommended)
21
+
22
+ 1. Install as a development dependency:
23
+
24
+ ```bash
25
+ npm install slicejs-cli --save-dev
26
+ ```
27
+
28
+ 2. Add to your `package.json` scripts:
29
+
30
+ ```json
31
+ {
32
+ "scripts": {
33
+ "dev": "slice dev",
34
+ "build": "slice build",
35
+ "slice": "slice"
36
+ }
37
+ }
38
+ ```
39
+
40
+ 3. usage:
41
+
42
+ ```bash
43
+ npm run dev
44
+ # or pass arguments
45
+ npm run slice -- get Button
46
+ ```
47
+
48
+ ### Global (Not Recommended)
49
+
50
+ Global installations can lead to version mismatches and "works on my machine" issues.
51
+
52
+ ```bash
53
+ npm install -g slicejs-cli
54
+ ```
55
+
56
+ ## Usage
57
+
58
+ After installation, you can use the `slice` command directly:
59
+
60
+ ```bash
61
+ slice [command] [options]
62
+ ```
63
+
64
+ Or with npx (without global install):
65
+
66
+ ```bash
67
+ npx slicejs-cli [command]
68
+ ```
69
+
70
+ ## Essential Commands
71
+
72
+ ### Initialize a project
73
+
74
+ ```bash
75
+ slice init
76
+ ```
77
+
78
+ Initializes a Slice.js project with the full structure (`src/` and `api/`), installs initial Visual components, and configures npm scripts.
79
+
80
+ ### Development server
81
+
82
+ ```bash
83
+ # Default port (3000)
84
+ slice dev
85
+
86
+ # Custom port
87
+ slice dev -p 8080
88
+ ```
89
+
90
+ ### Production build + server
91
+
92
+ ```bash
93
+ # Build production output (minified + obfuscated by default)
94
+ slice build
95
+
96
+ # Disable minification or obfuscation
97
+ slice build --no-minify
98
+ slice build --no-obfuscate
99
+
100
+ # Start production server (serves /dist)
101
+ slice start
102
+ slice start -p 8080
103
+ ```
104
+
105
+ ### Component management (local)
106
+
107
+ ```bash
108
+ # Create a component (interactive)
109
+ slice component create
110
+
111
+ # List local components
112
+ slice component list
113
+
114
+ # Delete a component (interactive)
115
+ slice component delete
116
+ ```
117
+
118
+ Shortcuts:
119
+ ```bash
120
+ slice comp create
121
+ slice comp ls
122
+ slice comp remove
123
+ ```
124
+
125
+ ### Official component registry
126
+
127
+ ```bash
128
+ # Install Visual components
129
+ slice get Button Card Input
130
+
131
+ # Install a Service component
132
+ slice get FetchManager --service
133
+
134
+ # Force overwrite
135
+ slice get Button --force
136
+
137
+ # Browse available components
138
+ slice browse
139
+
140
+ # Update all local components
141
+ slice sync
142
+ slice sync --force
143
+ ```
144
+
145
+ Shortcuts:
146
+ ```bash
147
+ slice get Button
148
+ slice browse
149
+ slice sync
150
+ ```
151
+
152
+ ### Utilities
153
+
154
+ ```bash
155
+ # Version info
156
+ slice version
157
+ slice -v
158
+
159
+ # Updates (CLI and Framework)
160
+ slice update # Check and prompt to update
161
+ slice update --yes # Update everything automatically
162
+ slice update --cli # CLI only
163
+ slice update --framework # Framework only
164
+
165
+ # Help
166
+ slice --help
167
+ slice [command] --help
168
+ ```
169
+
170
+ ## npm Scripts
171
+
172
+ `slice init` automatically configures the recommended scripts in your `package.json`:
173
+
174
+ ```json
175
+ {
176
+ "scripts": {
177
+ "dev": "slice dev",
178
+ "start": "slice start",
179
+ "get": "slice get",
180
+ "browse": "slice browse",
181
+ "sync": "slice sync",
182
+ "component:create": "slice component create",
183
+ "component:list": "slice component list",
184
+ "component:delete": "slice component delete"
185
+ }
186
+ }
187
+ ```
188
+
189
+ Usage:
190
+ ```bash
191
+ npm run dev
192
+ npm run get
193
+ npm run browse
194
+ ```
195
+
196
+ ## Quick Start
197
+
198
+ ```bash
199
+ # 1. Create a new project directory
200
+ mkdir my-slice-project
201
+ cd my-slice-project
202
+
203
+ # 2. Initialize npm and install Slice CLI
204
+ npm init -y
205
+ npm install slicejs-cli --save-dev
206
+
207
+ # 3. Initialize Slice.js project
208
+ slice init
209
+
210
+ # 4. Start development server
211
+ slice dev
212
+
213
+ # 5. Open browser at http://localhost:3000
214
+ ```
215
+
216
+ ## Common Workflows
217
+
218
+ ### Starting a New Project
219
+
220
+ ```bash
221
+ slice init
222
+ slice dev
223
+ ```
224
+
225
+ ### Production Build + Start
226
+
227
+ ```bash
228
+ slice build
229
+ slice start
230
+ ```
231
+
232
+ ### Adding Components
233
+
234
+ ```bash
235
+ # Browse available components
236
+ slice browse
237
+
238
+ # Install specific components
239
+ slice get Button Card Input
240
+
241
+ # Create custom component
242
+ slice component create
243
+ ```
244
+
245
+ ### Keeping Components Updated
246
+
247
+ ```bash
248
+ # Check what needs updating
249
+ slice browse
250
+
251
+ # Update all components
252
+ slice sync
253
+ ```
254
+
255
+ ## Development Mode
256
+
257
+ The development server (`slice dev`) provides:
258
+
259
+ - Hot reload
260
+ - Serves directly from `/src`
261
+ - No build step
262
+ - Port validation
263
+ - Clear error messages
264
+
265
+ ## Production Mode
266
+
267
+ The production workflow uses `slice build` + `slice start`:
268
+
269
+ - Builds to `/dist`
270
+ - Generates bundles into `/dist/bundles`
271
+ - ✅ Generates a dedicated framework bundle for Structural components (`slice-bundle.framework.js`)
272
+ - ✅ Minifies + obfuscates by default
273
+ - ✅ Serves production assets only
274
+
275
+ ## Requirements
276
+
277
+ - Node.js >= 20.0.0
278
+ - npm or yarn
279
+
280
+ ## Configuration
281
+
282
+ Project configuration is stored in `src/sliceConfig.json` and is created automatically by `slice init`.
283
+
284
+ In production, `publicFolders` defines **public asset folders** served by the server (defaults to
285
+ `/Themes`, `/Styles`, `/assets`). This keeps source-only folders private while exposing the assets
286
+ your app needs.
287
+
288
+ ## Features
289
+
290
+ - 🚀 Development server with hot reload
291
+ - 📦 Official component registry
292
+ - 🎨 Visual and Service component types
293
+ - Interactive component creation
294
+ - 🔄 Automatic component synchronization
295
+ - 🛠️ Built-in validation and error handling
296
+
297
+ ### Smart Updates
298
+
299
+ - Detects whether the CLI in use is global or local
300
+ - Shows an update plan (GLOBAL/PROJECT) before execution
301
+ - Offers to include global CLI update interactively
302
+ - Applies `uninstall` + `install @latest` to ensure latest versions
303
+
304
+ ### Cross-platform Paths
305
+
306
+ - Centralized path helper avoids `../../..`
307
+ - Windows/Linux/Mac compatibility using `import.meta.url` and `fileURLToPath`
308
+
309
+ ## Troubleshooting
310
+
311
+ ### Port already in use
312
+
313
+ ```bash
314
+ # Use a different port
315
+ slice dev -p 8080
316
+ ```
317
+
318
+ ### Project not initialized
319
+
320
+ ```bash
321
+ # Make sure to run init first
322
+ slice init
323
+ ```
324
+
325
+ ### Command not found
326
+
327
+ ```bash
328
+ # Use npx if not installed globally
329
+ npx slicejs-cli dev
330
+
331
+ # Or install globally
332
+ npm install -g slicejs-cli
333
+ ```
334
+
335
+ ## Links
336
+
337
+ - 📘 Documentation: https://slice-js-docs.vercel.app/
338
+ - 🐙 GitHub: https://github.com/VKneider/slice-cli
339
+ - 📦 npm: https://www.npmjs.com/package/slicejs-cli
340
+
341
+ ## License
342
+
343
+ ISC
344
+
345
+ ## Author
346
+
347
+ vkneider