@drupal-canvas/cli 0.3.0 → 0.5.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/README.md CHANGED
@@ -61,13 +61,87 @@ npx canvas download [options]
61
61
 
62
62
  **Options:**
63
63
 
64
- - `-c, --component <name>`: Download a specific component by machine name
64
+ - `-c, --components <names>`: Download specific component(s) by machine name
65
+ (comma-separated for multiple)
65
66
  - `--all`: Download all components
67
+ - `-y, --yes`: Skip all confirmation prompts (non-interactive mode)
68
+ - `--skip-overwrite`: Skip downloading components that already exist locally
69
+ - `--skip-css`: Skip global CSS download
70
+ - `--css-only`: Download only global CSS (skip components)
66
71
 
67
- Downloads one or more components from your site. You can select components to
68
- download, or use `--all` to download everything. Existing component directories
69
- will be overwritten after confirmation. Also downloads global CSS assets if
70
- available.
72
+ **Notes:**
73
+
74
+ - `--components` and `--all` cannot be used together
75
+ - `--skip-css` and `--css-only` cannot be used together
76
+
77
+ **About prompts:**
78
+
79
+ - Without flags: Interactive mode with all prompts (component selection,
80
+ download confirmation, overwrite confirmation)
81
+ - With `--yes`: Fully non-interactive - skips all prompts and overwrites
82
+ existing components (suitable for CI/CD)
83
+ - With `--skip-overwrite`: Downloads only new components; skips existing ones
84
+ without overwriting
85
+ - With both `--yes --skip-overwrite`: Fully non-interactive and only downloads
86
+ new components
87
+
88
+ **Examples:**
89
+
90
+ Interactive mode - select components from a list:
91
+
92
+ ```bash
93
+ npx canvas download
94
+ ```
95
+
96
+ Download specific components:
97
+
98
+ ```bash
99
+ npx canvas download --components button,card,hero
100
+ ```
101
+
102
+ Download all components:
103
+
104
+ ```bash
105
+ npx canvas download --all
106
+ ```
107
+
108
+ Fully non-interactive mode for CI/CD (overwrites existing):
109
+
110
+ ```bash
111
+ npx canvas download --all --yes
112
+ ```
113
+
114
+ Download only new components (skip existing):
115
+
116
+ ```bash
117
+ npx canvas download --all --skip-overwrite
118
+ ```
119
+
120
+ Fully non-interactive, only download new components:
121
+
122
+ ```bash
123
+ npx canvas download --all --yes --skip-overwrite
124
+ ```
125
+
126
+ Download components without global CSS:
127
+
128
+ ```bash
129
+ npx canvas download --all --skip-css
130
+ ```
131
+
132
+ Download only global CSS (skip components):
133
+
134
+ ```bash
135
+ npx canvas download --css-only
136
+ ```
137
+
138
+ Downloads one or more components from your site. You can select components
139
+ interactively, specify them with `--components`, or use `--all` to download
140
+ everything. By default, existing component directories will be overwritten after
141
+ confirmation. Use `--yes` for non-interactive mode (suitable for CI/CD), or
142
+ `--skip-overwrite` to preserve existing components. Global CSS assets are
143
+ downloaded by default and can be controlled with `--skip-css` to exclude them or
144
+ `--css-only` to download only CSS without components.
71
145
 
72
146
  ---
73
147
 
@@ -92,15 +166,60 @@ Creates a new component directory with example files (`component.yml`,
92
166
 
93
167
  Build local components and Tailwind CSS assets.
94
168
 
169
+ **Usage:**
170
+
95
171
  ```bash
96
172
  npx canvas build [options]
97
173
  ```
98
174
 
99
175
  **Options:**
100
176
 
177
+ - `-c, --components <names>`: Build specific component(s) by machine name
178
+ (comma-separated for multiple)
101
179
  - `--all`: Build all components
180
+ - `-y, --yes`: Skip confirmation prompts (non-interactive mode)
102
181
  - `--no-tailwind`: Skip Tailwind CSS build
103
182
 
183
+ **Note:** `--components` and `--all` cannot be used together.
184
+
185
+ **Examples:**
186
+
187
+ Interactive mode - select components from a list:
188
+
189
+ ```bash
190
+ npx canvas build
191
+ ```
192
+
193
+ Build specific components:
194
+
195
+ ```bash
196
+ npx canvas build --components button,card,hero
197
+ ```
198
+
199
+ Build all components:
200
+
201
+ ```bash
202
+ npx canvas build --all
203
+ ```
204
+
205
+ Build without Tailwind CSS:
206
+
207
+ ```bash
208
+ npx canvas build --components button --no-tailwind
209
+ ```
210
+
211
+ Non-interactive mode for CI/CD:
212
+
213
+ ```bash
214
+ npx canvas build --all --yes
215
+ ```
216
+
217
+ CI/CD without Tailwind:
218
+
219
+ ```bash
220
+ npx canvas build --all --yes --no-tailwind
221
+ ```
222
+
104
223
  Builds the selected (or all) local components, compiling their source files.
105
224
  Also builds Tailwind CSS assets for all components (can be skipped with
106
225
  `--no-tailwind`). For each component, a `dist` directory will be created
@@ -113,16 +232,144 @@ be created, which will be used for the generated Tailwind CSS assets.
113
232
 
114
233
  Build and upload local components and global CSS assets.
115
234
 
235
+ **Usage:**
236
+
116
237
  ```bash
117
238
  npx canvas upload [options]
118
239
  ```
119
240
 
120
241
  **Options:**
121
242
 
243
+ - `-c, --components <names>`: Upload specific component(s) by machine name
244
+ (comma-separated for multiple)
122
245
  - `--all`: Upload all components in the directory
246
+ - `-y, --yes`: Skip confirmation prompts (non-interactive mode)
123
247
  - `--no-tailwind`: Skip Tailwind CSS build and global asset upload
248
+ - `--skip-css`: Skip global CSS upload
249
+ - `--css-only`: Upload only global CSS (skip components)
250
+
251
+ **Notes:**
252
+
253
+ - `--components` and `--all` cannot be used together
254
+ - `--skip-css` and `--css-only` cannot be used together
255
+
256
+ **Examples:**
257
+
258
+ Interactive mode - select components from a list:
259
+
260
+ ```bash
261
+ npx canvas upload
262
+ ```
263
+
264
+ Upload specific components:
265
+
266
+ ```bash
267
+ npx canvas upload --components button,card,hero
268
+ ```
269
+
270
+ Upload all components:
271
+
272
+ ```bash
273
+ npx canvas upload --all
274
+ ```
275
+
276
+ Upload without Tailwind CSS build:
277
+
278
+ ```bash
279
+ npx canvas upload --components button,card --no-tailwind
280
+ ```
281
+
282
+ Non-interactive mode for CI/CD:
283
+
284
+ ```bash
285
+ npx canvas upload --all --yes
286
+ ```
287
+
288
+ CI/CD without Tailwind:
289
+
290
+ ```bash
291
+ npx canvas upload --all --yes --no-tailwind
292
+ ```
293
+
294
+ Upload components without global CSS:
295
+
296
+ ```bash
297
+ npx canvas upload --all --skip-css
298
+ ```
299
+
300
+ Upload only global CSS (skip components):
301
+
302
+ ```bash
303
+ npx canvas upload --css-only
304
+ ```
124
305
 
125
306
  Builds and uploads the selected (or all) local components to your site. Also
126
307
  builds and uploads global Tailwind CSS assets unless `--no-tailwind` is
127
- specified. Existing components on the site will be updated if they already
128
- exist.
308
+ specified. Global CSS upload can be controlled with `--skip-css` to exclude it
309
+ or `--css-only` to upload only CSS without components. Existing components on
310
+ the site will be updated if they already exist.
311
+
312
+ ---
313
+
314
+ ### `validate`
315
+
316
+ Validate local components using ESLint.
317
+
318
+ **Usage:**
319
+
320
+ ```bash
321
+ npx canvas validate [options]
322
+ ```
323
+
324
+ **Options:**
325
+
326
+ - `-c, --components <names>`: Validate specific component(s) by machine name
327
+ (comma-separated for multiple)
328
+ - `--all`: Validate all components
329
+ - `-y, --yes`: Skip confirmation prompts (non-interactive mode)
330
+ - `--fix`: Apply available automatic fixes for linting issues
331
+
332
+ **Note:** `--components` and `--all` cannot be used together.
333
+
334
+ **Examples:**
335
+
336
+ Interactive mode - select components from a list:
337
+
338
+ ```bash
339
+ npx canvas validate
340
+ ```
341
+
342
+ Validate specific components:
343
+
344
+ ```bash
345
+ npx canvas validate --components button,card,hero
346
+ ```
347
+
348
+ Validate all components:
349
+
350
+ ```bash
351
+ npx canvas validate --all
352
+ ```
353
+
354
+ Validate and auto-fix issues:
355
+
356
+ ```bash
357
+ npx canvas validate --components button --fix
358
+ ```
359
+
360
+ Non-interactive mode for CI/CD:
361
+
362
+ ```bash
363
+ npx canvas validate --all --yes
364
+ ```
365
+
366
+ CI/CD with auto-fix:
367
+
368
+ ```bash
369
+ npx canvas validate --all --yes --fix
370
+ ```
371
+
372
+ Validates local components using ESLint with `required` configuration from
373
+ [@drupal-canvas/eslint-config](https://www.npmjs.com/package/@drupal-canvas/eslint-config).
374
+ With `--fix` option specified, also applies automatic fixes available for some
375
+ validation rules.