@drupal-canvas/cli 0.3.0 → 0.4.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,69 @@ 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
66
69
 
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.
70
+ **Note:** `--components` and `--all` cannot be used together.
71
+
72
+ **About prompts:**
73
+
74
+ - Without flags: Interactive mode with all prompts (component selection,
75
+ download confirmation, overwrite confirmation)
76
+ - With `--yes`: Fully non-interactive - skips all prompts and overwrites
77
+ existing components (suitable for CI/CD)
78
+ - With `--skip-overwrite`: Downloads only new components; skips existing ones
79
+ without overwriting
80
+ - With both `--yes --skip-overwrite`: Fully non-interactive and only downloads
81
+ new components
82
+
83
+ **Examples:**
84
+
85
+ Interactive mode - select components from a list:
86
+
87
+ ```bash
88
+ npx canvas download
89
+ ```
90
+
91
+ Download specific components:
92
+
93
+ ```bash
94
+ npx canvas download --components button,card,hero
95
+ ```
96
+
97
+ Download all components:
98
+
99
+ ```bash
100
+ npx canvas download --all
101
+ ```
102
+
103
+ Fully non-interactive mode for CI/CD (overwrites existing):
104
+
105
+ ```bash
106
+ npx canvas download --all --yes
107
+ ```
108
+
109
+ Download only new components (skip existing):
110
+
111
+ ```bash
112
+ npx canvas download --all --skip-overwrite
113
+ ```
114
+
115
+ Fully non-interactive, only download new components:
116
+
117
+ ```bash
118
+ npx canvas download --all --yes --skip-overwrite
119
+ ```
120
+
121
+ Downloads one or more components from your site. You can select components
122
+ interactively, specify them with `--components`, or use `--all` to download
123
+ everything. By default, existing component directories will be overwritten after
124
+ confirmation. Use `--yes` for non-interactive mode (suitable for CI/CD), or
125
+ `--skip-overwrite` to preserve existing components. Also downloads global CSS
126
+ assets if available.
71
127
 
72
128
  ---
73
129
 
@@ -92,15 +148,60 @@ Creates a new component directory with example files (`component.yml`,
92
148
 
93
149
  Build local components and Tailwind CSS assets.
94
150
 
151
+ **Usage:**
152
+
95
153
  ```bash
96
154
  npx canvas build [options]
97
155
  ```
98
156
 
99
157
  **Options:**
100
158
 
159
+ - `-c, --components <names>`: Build specific component(s) by machine name
160
+ (comma-separated for multiple)
101
161
  - `--all`: Build all components
162
+ - `-y, --yes`: Skip confirmation prompts (non-interactive mode)
102
163
  - `--no-tailwind`: Skip Tailwind CSS build
103
164
 
165
+ **Note:** `--components` and `--all` cannot be used together.
166
+
167
+ **Examples:**
168
+
169
+ Interactive mode - select components from a list:
170
+
171
+ ```bash
172
+ npx canvas build
173
+ ```
174
+
175
+ Build specific components:
176
+
177
+ ```bash
178
+ npx canvas build --components button,card,hero
179
+ ```
180
+
181
+ Build all components:
182
+
183
+ ```bash
184
+ npx canvas build --all
185
+ ```
186
+
187
+ Build without Tailwind CSS:
188
+
189
+ ```bash
190
+ npx canvas build --components button --no-tailwind
191
+ ```
192
+
193
+ Non-interactive mode for CI/CD:
194
+
195
+ ```bash
196
+ npx canvas build --all --yes
197
+ ```
198
+
199
+ CI/CD without Tailwind:
200
+
201
+ ```bash
202
+ npx canvas build --all --yes --no-tailwind
203
+ ```
204
+
104
205
  Builds the selected (or all) local components, compiling their source files.
105
206
  Also builds Tailwind CSS assets for all components (can be skipped with
106
207
  `--no-tailwind`). For each component, a `dist` directory will be created
@@ -113,16 +214,126 @@ be created, which will be used for the generated Tailwind CSS assets.
113
214
 
114
215
  Build and upload local components and global CSS assets.
115
216
 
217
+ **Usage:**
218
+
116
219
  ```bash
117
220
  npx canvas upload [options]
118
221
  ```
119
222
 
120
223
  **Options:**
121
224
 
225
+ - `-c, --components <names>`: Upload specific component(s) by machine name
226
+ (comma-separated for multiple)
122
227
  - `--all`: Upload all components in the directory
228
+ - `-y, --yes`: Skip confirmation prompts (non-interactive mode)
123
229
  - `--no-tailwind`: Skip Tailwind CSS build and global asset upload
124
230
 
231
+ **Note:** `--components` and `--all` cannot be used together.
232
+
233
+ **Examples:**
234
+
235
+ Interactive mode - select components from a list:
236
+
237
+ ```bash
238
+ npx canvas upload
239
+ ```
240
+
241
+ Upload specific components:
242
+
243
+ ```bash
244
+ npx canvas upload --components button,card,hero
245
+ ```
246
+
247
+ Upload all components:
248
+
249
+ ```bash
250
+ npx canvas upload --all
251
+ ```
252
+
253
+ Upload without Tailwind CSS build:
254
+
255
+ ```bash
256
+ npx canvas upload --components button,card --no-tailwind
257
+ ```
258
+
259
+ Non-interactive mode for CI/CD:
260
+
261
+ ```bash
262
+ npx canvas upload --all --yes
263
+ ```
264
+
265
+ CI/CD without Tailwind:
266
+
267
+ ```bash
268
+ npx canvas upload --all --yes --no-tailwind
269
+ ```
270
+
125
271
  Builds and uploads the selected (or all) local components to your site. Also
126
272
  builds and uploads global Tailwind CSS assets unless `--no-tailwind` is
127
273
  specified. Existing components on the site will be updated if they already
128
274
  exist.
275
+
276
+ ---
277
+
278
+ ### `validate`
279
+
280
+ Validate local components using ESLint.
281
+
282
+ **Usage:**
283
+
284
+ ```bash
285
+ npx canvas validate [options]
286
+ ```
287
+
288
+ **Options:**
289
+
290
+ - `-c, --components <names>`: Validate specific component(s) by machine name
291
+ (comma-separated for multiple)
292
+ - `--all`: Validate all components
293
+ - `-y, --yes`: Skip confirmation prompts (non-interactive mode)
294
+ - `--fix`: Apply available automatic fixes for linting issues
295
+
296
+ **Note:** `--components` and `--all` cannot be used together.
297
+
298
+ **Examples:**
299
+
300
+ Interactive mode - select components from a list:
301
+
302
+ ```bash
303
+ npx canvas validate
304
+ ```
305
+
306
+ Validate specific components:
307
+
308
+ ```bash
309
+ npx canvas validate --components button,card,hero
310
+ ```
311
+
312
+ Validate all components:
313
+
314
+ ```bash
315
+ npx canvas validate --all
316
+ ```
317
+
318
+ Validate and auto-fix issues:
319
+
320
+ ```bash
321
+ npx canvas validate --components button --fix
322
+ ```
323
+
324
+ Non-interactive mode for CI/CD:
325
+
326
+ ```bash
327
+ npx canvas validate --all --yes
328
+ ```
329
+
330
+ CI/CD with auto-fix:
331
+
332
+ ```bash
333
+ npx canvas validate --all --yes --fix
334
+ ```
335
+
336
+ Validates local components using ESLint with `required` configuration from
337
+ [@drupal-canvas/eslint-config](https://www.npmjs.com/package/@drupal-canvas/eslint-config).
338
+ With `--fix` option specified, also applies automatic fixes available for some
339
+ validation rules.