slicejs-cli 3.1.0 → 3.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/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +25 -0
- package/.github/pull_request_template.md +22 -0
- package/.github/workflows/docs-render-cicd.yml +65 -0
- package/CODE_OF_CONDUCT.md +126 -0
- package/ECOSYSTEM.md +9 -0
- package/LICENSE +21 -0
- package/README.md +104 -308
- package/client.js +644 -557
- package/commands/Print.js +167 -167
- package/commands/Validations.js +103 -103
- package/commands/build/build.js +40 -40
- package/commands/buildProduction/buildProduction.js +579 -579
- package/commands/bundle/bundle.js +235 -235
- package/commands/createComponent/VisualComponentTemplate.js +55 -55
- package/commands/createComponent/createComponent.js +126 -126
- package/commands/deleteComponent/deleteComponent.js +77 -77
- package/commands/doctor/doctor.js +369 -369
- package/commands/getComponent/getComponent.js +747 -747
- package/commands/init/init.js +261 -261
- package/commands/listComponents/listComponents.js +175 -175
- package/commands/startServer/startServer.js +264 -264
- package/commands/startServer/watchServer.js +79 -79
- package/commands/types/types.js +538 -0
- package/commands/utils/LocalCliDelegation.js +53 -53
- package/commands/utils/PathHelper.js +68 -68
- package/commands/utils/VersionChecker.js +167 -167
- package/commands/utils/bundling/BundleGenerator.js +2292 -2292
- package/commands/utils/bundling/DependencyAnalyzer.js +933 -933
- package/commands/utils/updateManager.js +453 -453
- package/docs/superpowers/specs/2026-05-10-pwa-generate-design.md +182 -0
- package/package.json +46 -46
- package/post.js +65 -25
- package/tests/bundle-generator.test.js +708 -708
- package/tests/bundle-v2-register-output.test.js +470 -470
- package/tests/client-launcher-contract.test.js +211 -211
- package/tests/client-update-flow-contract.test.js +272 -272
- package/tests/dependency-analyzer.test.js +24 -24
- package/tests/local-cli-delegation.test.js +79 -79
- package/tests/postinstall-command.test.js +72 -0
- package/tests/types-generator.test.js +356 -0
- package/tests/update-manager-notifications.test.js +88 -88
- package/refactor.md +0 -271
package/README.md
CHANGED
|
@@ -1,375 +1,171 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
<
|
|
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>
|
|
2
|
+
<img src="./assets/Slice.js-logo.png" alt="Slice.js logo" width="150" />
|
|
3
|
+
<h1>Slice.js CLI</h1>
|
|
4
|
+
<p>Command-line client for building web applications with the Slice.js framework</p>
|
|
5
|
+
<p>
|
|
6
|
+
<a href="https://slice-js-docs.vercel.app/Documentation/CLI"><strong>Explore the docs »</strong></a>
|
|
7
|
+
<br />
|
|
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
|
+
</p>
|
|
11
12
|
</div>
|
|
12
13
|
|
|
14
|
+
## About this repository
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</div>
|
|
16
|
+
This repository contains the Slice.js CLI (`slicejs-cli`), the command-line tool for developing applications with the Slice.js framework. It includes a development server, build system, component management, and more.
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Prerequisites
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
- Node.js >= 20
|
|
21
|
+
- npm or pnpm
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
## Local development
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
1. **Clone the repository**
|
|
26
|
+
```bash
|
|
27
|
+
git clone https://github.com/VKneider/slicejs-cli.git
|
|
28
|
+
cd slicejs-cli
|
|
29
|
+
```
|
|
27
30
|
|
|
28
|
-
2.
|
|
31
|
+
2. **Install dependencies**
|
|
32
|
+
```bash
|
|
33
|
+
npm install
|
|
34
|
+
```
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"build": "slice build",
|
|
35
|
-
"slice": "slice"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
```
|
|
36
|
+
3. **Test changes locally**
|
|
37
|
+
```bash
|
|
38
|
+
node client.js --help
|
|
39
|
+
```
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
To bypass delegation to a global installation:
|
|
42
|
+
```bash
|
|
43
|
+
SLICE_NO_LOCAL_DELEGATION=1 node client.js --help
|
|
44
|
+
```
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
```
|
|
46
|
+
4. **Run tests**
|
|
47
|
+
```bash
|
|
48
|
+
npm test
|
|
49
|
+
```
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
(commonly after a global install that puts `slice` in your PATH).
|
|
50
|
-
The launcher delegates to your nearest project-local `node_modules/slicejs-cli`
|
|
51
|
-
so project-pinned behavior is used from the project root and subdirectories.
|
|
51
|
+
## Installation (for users)
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
slice dev
|
|
55
|
-
slice build
|
|
56
|
-
slice version
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
If `slice` is not available in your shell, use:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
npx slicejs-cli dev
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
You can disable launcher delegation for a command when needed:
|
|
53
|
+
### Local (Recommended)
|
|
66
54
|
|
|
67
55
|
```bash
|
|
68
|
-
|
|
56
|
+
npm install slicejs-cli --save-dev
|
|
69
57
|
```
|
|
70
58
|
|
|
71
|
-
### Global (Not
|
|
72
|
-
|
|
73
|
-
Global installations can lead to version mismatches and "works on my machine" issues.
|
|
59
|
+
### Global (Not recommended)
|
|
74
60
|
|
|
75
61
|
```bash
|
|
76
62
|
npm install -g slicejs-cli
|
|
77
63
|
```
|
|
78
64
|
|
|
79
|
-
##
|
|
80
|
-
|
|
81
|
-
After installation, prefer your project-local CLI. When the `slice` launcher command is
|
|
82
|
-
available, it automatically delegates to the nearest local `slicejs-cli` install.
|
|
83
|
-
|
|
84
|
-
Use the `slice` command directly:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
slice [command] [options]
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Or with npx (without global install):
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
npx slicejs-cli [command]
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
Use `npx slicejs-cli [command]` as a fallback when the `slice` launcher command is unavailable.
|
|
97
|
-
|
|
98
|
-
## Essential Commands
|
|
99
|
-
|
|
100
|
-
### Initialize a project
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
slice init
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
Initializes a Slice.js project with the full structure (`src/` and `api/`), installs initial Visual components, and configures npm scripts.
|
|
107
|
-
|
|
108
|
-
### Development server
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
# Default port (3000)
|
|
112
|
-
slice dev
|
|
113
|
-
|
|
114
|
-
# Custom port
|
|
115
|
-
slice dev -p 8080
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Production build + server
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
# Build production output (minified + obfuscated by default)
|
|
122
|
-
slice build
|
|
123
|
-
|
|
124
|
-
# Disable minification or obfuscation
|
|
125
|
-
slice build --no-minify
|
|
126
|
-
slice build --no-obfuscate
|
|
127
|
-
|
|
128
|
-
# Start production server (serves /dist)
|
|
129
|
-
slice start
|
|
130
|
-
slice start -p 8080
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### Component management (local)
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
# Create a component (interactive)
|
|
137
|
-
slice component create
|
|
138
|
-
|
|
139
|
-
# List local components
|
|
140
|
-
slice component list
|
|
141
|
-
|
|
142
|
-
# Delete a component (interactive)
|
|
143
|
-
slice component delete
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
Shortcuts:
|
|
147
|
-
```bash
|
|
148
|
-
slice comp create
|
|
149
|
-
slice comp ls
|
|
150
|
-
slice comp remove
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### Official component registry
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
# Install Visual components
|
|
157
|
-
slice get Button Card Input
|
|
158
|
-
|
|
159
|
-
# Install a Service component
|
|
160
|
-
slice get FetchManager --service
|
|
161
|
-
|
|
162
|
-
# Force overwrite
|
|
163
|
-
slice get Button --force
|
|
164
|
-
|
|
165
|
-
# Browse available components
|
|
166
|
-
slice browse
|
|
65
|
+
## Main commands
|
|
167
66
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
slice
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
slice
|
|
176
|
-
slice
|
|
177
|
-
slice
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
### Utilities
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
# Version info
|
|
184
|
-
slice version
|
|
185
|
-
slice v
|
|
186
|
-
|
|
187
|
-
# Updates (CLI and Framework)
|
|
188
|
-
slice update # Check and prompt to update
|
|
189
|
-
slice update --yes # Update everything automatically
|
|
190
|
-
slice update --cli # CLI only
|
|
191
|
-
slice update --framework # Framework only
|
|
192
|
-
|
|
193
|
-
# Help
|
|
194
|
-
slice --help
|
|
195
|
-
slice [command] --help
|
|
196
|
-
```
|
|
67
|
+
| Command | Description |
|
|
68
|
+
|---------|-------------|
|
|
69
|
+
| `slice init` | Initialize a Slice.js project |
|
|
70
|
+
| `slice dev` | Development server with hot reload |
|
|
71
|
+
| `slice build` | Build for production |
|
|
72
|
+
| `slice start` | Serve production build |
|
|
73
|
+
| `slice get <component>` | Install components from the official registry |
|
|
74
|
+
| `slice browse` | Browse available components |
|
|
75
|
+
| `slice component create` | Create a local component |
|
|
76
|
+
| `slice doctor` | Run project diagnostics |
|
|
77
|
+
| `slice postinstall` | Configure npm scripts (alternative to postinstall) |
|
|
197
78
|
|
|
198
|
-
##
|
|
79
|
+
## Postinstall Scripts
|
|
199
80
|
|
|
200
|
-
`
|
|
81
|
+
When you install `slicejs-cli`, the `postinstall` script automatically configures `slice:*` npm scripts in your `package.json`:
|
|
201
82
|
|
|
202
83
|
```json
|
|
203
84
|
{
|
|
204
85
|
"scripts": {
|
|
205
|
-
"dev": "slice dev",
|
|
206
|
-
"start": "slice start",
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
"
|
|
210
|
-
"
|
|
211
|
-
"
|
|
212
|
-
"
|
|
86
|
+
"slice:dev": "slice dev",
|
|
87
|
+
"slice:start": "slice start",
|
|
88
|
+
"slice:create": "slice component create",
|
|
89
|
+
"slice:list": "slice component list",
|
|
90
|
+
"slice:delete": "slice component delete",
|
|
91
|
+
"slice:init": "slice init",
|
|
92
|
+
"slice:get": "slice get",
|
|
93
|
+
"slice:browse": "slice browse",
|
|
94
|
+
"slice:sync": "slice sync",
|
|
95
|
+
"slice:version": "slice version",
|
|
96
|
+
"slice:update": "slice update"
|
|
213
97
|
}
|
|
214
98
|
}
|
|
215
99
|
```
|
|
216
100
|
|
|
217
|
-
|
|
101
|
+
If you installed with `--ignore-scripts`, run manually:
|
|
102
|
+
|
|
218
103
|
```bash
|
|
219
|
-
|
|
220
|
-
npm run get
|
|
221
|
-
npm run browse
|
|
104
|
+
npx slicejs-cli postinstall
|
|
222
105
|
```
|
|
223
106
|
|
|
224
|
-
## Quick
|
|
107
|
+
## Quick start
|
|
225
108
|
|
|
226
109
|
```bash
|
|
227
|
-
# 1. Create
|
|
228
|
-
mkdir my-
|
|
229
|
-
cd my-slice-project
|
|
230
|
-
|
|
231
|
-
# 2. Initialize npm and install Slice CLI
|
|
110
|
+
# 1. Create project
|
|
111
|
+
mkdir my-project && cd my-project
|
|
232
112
|
npm init -y
|
|
233
|
-
npm install slicejs-cli --save-dev
|
|
234
113
|
|
|
235
|
-
#
|
|
236
|
-
|
|
114
|
+
# 2. Install CLI
|
|
115
|
+
npm install slicejs-cli --save-dev
|
|
237
116
|
|
|
238
|
-
#
|
|
239
|
-
|
|
117
|
+
# 3. Initialize
|
|
118
|
+
npx slicejs-cli init
|
|
240
119
|
|
|
241
|
-
#
|
|
120
|
+
# 4. Development
|
|
121
|
+
npx slicejs-cli dev
|
|
242
122
|
```
|
|
243
123
|
|
|
244
|
-
##
|
|
124
|
+
## Tests
|
|
245
125
|
|
|
246
|
-
|
|
126
|
+
The CLI uses Node.js native test runner:
|
|
247
127
|
|
|
248
128
|
```bash
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
```
|
|
129
|
+
# All tests
|
|
130
|
+
node --test
|
|
252
131
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
```bash
|
|
256
|
-
slice build
|
|
257
|
-
slice start
|
|
132
|
+
# Specific tests
|
|
133
|
+
node --test tests/postinstall-command.test.js
|
|
258
134
|
```
|
|
259
135
|
|
|
260
|
-
|
|
136
|
+
## Project structure
|
|
261
137
|
|
|
262
|
-
```bash
|
|
263
|
-
# Browse available components
|
|
264
|
-
slice browse
|
|
265
|
-
|
|
266
|
-
# Install specific components
|
|
267
|
-
slice get Button Card Input
|
|
268
|
-
|
|
269
|
-
# Create custom component
|
|
270
|
-
slice component create
|
|
271
138
|
```
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
#
|
|
277
|
-
slice
|
|
278
|
-
|
|
279
|
-
#
|
|
280
|
-
|
|
139
|
+
slicejs-cli/
|
|
140
|
+
├── client.js # CLI entry point
|
|
141
|
+
├── commands/ # Command implementations
|
|
142
|
+
│ ├── init/ # slice init
|
|
143
|
+
│ ├── build/ # slice build
|
|
144
|
+
│ ├── startServer/ # slice dev / slice start
|
|
145
|
+
│ ├── createComponent/ # slice component create
|
|
146
|
+
│ └── utils/ # PathHelper, VersionChecker, etc.
|
|
147
|
+
├── tests/ # Tests
|
|
148
|
+
└── post.js # Postinstall hook
|
|
281
149
|
```
|
|
282
150
|
|
|
283
|
-
##
|
|
151
|
+
## Local delegation
|
|
284
152
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
- ✅ Hot reload
|
|
288
|
-
- ✅ Serves directly from `/src`
|
|
289
|
-
- ✅ No build step
|
|
290
|
-
- ✅ Port validation
|
|
291
|
-
- ✅ Clear error messages
|
|
292
|
-
|
|
293
|
-
## Production Mode
|
|
294
|
-
|
|
295
|
-
The production workflow uses `slice build` + `slice start`:
|
|
296
|
-
|
|
297
|
-
- ✅ Builds to `/dist`
|
|
298
|
-
- ✅ Generates bundles into `/dist/bundles`
|
|
299
|
-
- ✅ Generates a dedicated framework bundle for Structural components (`slice-bundle.framework.js`)
|
|
300
|
-
- ✅ Minifies + obfuscates by default
|
|
301
|
-
- ✅ Serves production assets only
|
|
302
|
-
|
|
303
|
-
## Requirements
|
|
304
|
-
|
|
305
|
-
- Node.js >= 20.0.0
|
|
306
|
-
- npm or yarn
|
|
307
|
-
|
|
308
|
-
## Configuration
|
|
309
|
-
|
|
310
|
-
Project configuration is stored in `src/sliceConfig.json` and is created automatically by `slice init`.
|
|
311
|
-
|
|
312
|
-
In production, `publicFolders` defines **public asset folders** served by the server (defaults to
|
|
313
|
-
`/Themes`, `/Styles`, `/assets`). This keeps source-only folders private while exposing the assets
|
|
314
|
-
your app needs.
|
|
315
|
-
|
|
316
|
-
## Features
|
|
317
|
-
|
|
318
|
-
- 🚀 Development server with hot reload
|
|
319
|
-
- 📦 Official component registry
|
|
320
|
-
- 🎨 Visual and Service component types
|
|
321
|
-
- ✨ Interactive component creation
|
|
322
|
-
- 🔄 Automatic component synchronization
|
|
323
|
-
- 🛠️ Built-in validation and error handling
|
|
324
|
-
|
|
325
|
-
### Smart Updates
|
|
326
|
-
|
|
327
|
-
- Detects whether the CLI in use is global or local
|
|
328
|
-
- Shows an update plan (GLOBAL/PROJECT) before execution
|
|
329
|
-
- Offers to include global CLI update interactively
|
|
330
|
-
- Applies `uninstall` + `install @latest` to ensure latest versions
|
|
331
|
-
|
|
332
|
-
### Cross-platform Paths
|
|
333
|
-
|
|
334
|
-
- Centralized path helper avoids `../../..`
|
|
335
|
-
- Windows/Linux/Mac compatibility using `import.meta.url` and `fileURLToPath`
|
|
336
|
-
|
|
337
|
-
## Troubleshooting
|
|
338
|
-
|
|
339
|
-
### Port already in use
|
|
153
|
+
When the `slice` command is globally available, it automatically delegates to the project-local CLI (`node_modules/slicejs-cli`). To disable:
|
|
340
154
|
|
|
341
155
|
```bash
|
|
342
|
-
|
|
343
|
-
slice dev -p 8080
|
|
156
|
+
SLICE_NO_LOCAL_DELEGATION=1 slice version
|
|
344
157
|
```
|
|
345
158
|
|
|
346
|
-
|
|
159
|
+
## Contributing
|
|
347
160
|
|
|
348
|
-
|
|
349
|
-
# Make sure to run init first
|
|
350
|
-
slice init
|
|
351
|
-
```
|
|
161
|
+
We welcome contributions. Please review the guidelines in [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) before submitting changes.
|
|
352
162
|
|
|
353
|
-
|
|
163
|
+
## License
|
|
354
164
|
|
|
355
|
-
|
|
356
|
-
# If the launcher command is unavailable, run the local CLI via npx
|
|
357
|
-
npx slicejs-cli dev
|
|
358
|
-
|
|
359
|
-
# Optional: install globally to expose the slice launcher command
|
|
360
|
-
npm install -g slicejs-cli
|
|
361
|
-
```
|
|
165
|
+
Distributed under the ISC License. See `LICENSE` for more information.
|
|
362
166
|
|
|
363
167
|
## Links
|
|
364
168
|
|
|
365
|
-
- 📘
|
|
366
|
-
- 🐙 GitHub: https://github.com/VKneider/
|
|
169
|
+
- 📘 Documentation: https://slice-js-docs.vercel.app/Documentation/CLI
|
|
170
|
+
- 🐙 GitHub: https://github.com/VKneider/slicejs-cli
|
|
367
171
|
- 📦 npm: https://www.npmjs.com/package/slicejs-cli
|
|
368
|
-
|
|
369
|
-
## License
|
|
370
|
-
|
|
371
|
-
ISC
|
|
372
|
-
|
|
373
|
-
## Author
|
|
374
|
-
|
|
375
|
-
vkneider
|