@astryxdesign/cli 0.6.4-canary.ed2e54e → 0.6.4
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 +66 -64
- package/api/component/_adapter.d.mts +0 -25
- package/api/component/_adapter.mjs +5 -59
- package/api/component/component.d.mts +3 -6
- package/api/component/component.doc.mjs +10 -23
- package/api/component/component.mjs +9 -249
- package/api/component/component.type.d.mts +0 -25
- package/api/component/component.type.mjs +0 -44
- package/api/discover/_adapter.d.mts +6 -114
- package/api/discover/_adapter.mjs +17 -372
- package/api/discover/detail/detail.d.mts +6 -18
- package/api/discover/detail/detail.mjs +13 -67
- package/api/discover/detail/detail.test.mjs +0 -85
- package/api/discover/discover.d.mts +9 -3
- package/api/discover/discover.doc.mjs +18 -61
- package/api/discover/discover.mjs +36 -220
- package/api/discover/discover.test.mjs +2 -11
- package/api/discover/discover.type.d.mts +8 -147
- package/api/discover/discover.type.mjs +12 -102
- package/api/discover/list/list.d.mts +6 -20
- package/api/discover/list/list.mjs +12 -45
- package/api/discover/list/list.test.mjs +0 -46
- package/api/discover/search/search.d.mts +16 -18
- package/api/discover/search/search.mjs +56 -102
- package/api/discover/search/search.test.mjs +10 -144
- package/api/docs/docs.test.mjs +0 -2
- package/api/doctor/doctor.d.mts +3 -8
- package/api/doctor/doctor.mjs +9 -90
- package/api/doctor/doctor.test.mjs +10 -122
- package/api/index.d.mts +2 -1
- package/api/index.mjs +4 -4
- package/api/integration/add-helpers.d.mts +2 -5
- package/api/integration/add-helpers.mjs +9 -36
- package/api/integration/pack-check.mjs +3 -28
- package/api/json/index.ts +1 -0
- package/api/layout/_adapter.d.mts +34 -0
- package/api/layout/_adapter.mjs +148 -0
- package/api/layout/check/check.d.mts +16 -0
- package/api/layout/check/check.mjs +40 -0
- package/api/layout/expand/expand.d.mts +22 -0
- package/api/layout/expand/expand.mjs +155 -0
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.d.mts +13 -0
- package/api/layout/grammar/grammar.mjs +87 -0
- package/api/layout/layout.d.mts +6 -0
- package/api/layout/layout.mjs +17 -0
- package/api/layout/layout.test.mjs +297 -0
- package/api/layout/layout.type.d.mts +89 -0
- package/api/layout/layout.type.mjs +103 -0
- package/api/layout/layoutCheck.doc.d.mts +11 -0
- package/api/layout/layoutCheck.doc.mjs +85 -0
- package/api/layout/layoutExpand.doc.d.mts +11 -0
- package/api/layout/layoutExpand.doc.mjs +107 -0
- package/api/layout/layoutGrammar.doc.d.mts +11 -0
- package/api/layout/layoutGrammar.doc.mjs +57 -0
- package/api/search/search.test.mjs +0 -18
- package/api/template/template-integration.test.mjs +65 -1
- package/api/template/template.mjs +1 -1
- package/api/theme/add/add.mjs +25 -17
- package/api/theme/add/add.staging.test.mjs +23 -40
- package/api/theme/build/build.family.test.mjs +12 -7
- package/api/theme/build/build.mjs +18 -8
- package/api/upgrade/run/run.mjs +4 -6
- package/api/upgrade/upgrade.type.mjs +2 -2
- package/assets/codemods/__tests__/runner.test.mjs +1 -3
- package/assets/codemods/integration-runner.mjs +3 -3
- package/assets/codemods/runner.mjs +4 -5
- package/assets/docs/internationalization.doc.mjs +5 -7
- package/assets/docs/tree/integrations.doc.mjs +1 -20
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
- package/authoring/config/config.doc.mjs +1 -9
- package/authoring/config/parse.d.mts +0 -2
- package/authoring/config/parse.mjs +0 -19
- package/authoring/config/parse.test.mjs +0 -8
- package/authoring/config/type.ts +2 -13
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +1 -1
- package/authoring/index.d.mts +0 -1
- package/authoring/index.d.ts +0 -10
- package/authoring/index.mjs +0 -1
- package/clients/cli/command-result-coverage.test.mjs +7 -7
- package/clients/cli/commands/component/index.mjs +55 -152
- package/clients/cli/commands/component-ownership.test.mjs +0 -89
- package/clients/cli/commands/component.doc.mjs +6 -23
- package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
- package/clients/cli/commands/discover.doc.mjs +9 -53
- package/clients/cli/commands/discover.mjs +118 -393
- package/clients/cli/commands/docs.test.mjs +0 -29
- package/clients/cli/commands/layout-check.doc.mjs +65 -0
- package/clients/cli/commands/layout-expand.doc.mjs +83 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +30 -0
- package/clients/cli/commands/layout.doc.mjs +34 -0
- package/clients/cli/commands/layout.error-codes.test.mjs +66 -0
- package/clients/cli/commands/layout.exit-parity.test.mjs +41 -0
- package/clients/cli/commands/layout.mjs +275 -0
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/text-json-parity.test.mjs +17 -0
- package/clients/cli/index.mjs +4 -0
- package/clients/cli/lib/exit-codes.test.mjs +8 -1
- package/clients/cli/lib/json-shim.mjs +14 -24
- package/clients/cli/lib/json-shim.test.mjs +20 -6
- package/clients/cli/lib/manifest.mjs +8 -3
- package/clients/cli/lib/manifest.test.mjs +2 -5
- package/foundation/discovery/authoring-self-docs.mjs +0 -1
- package/foundation/discovery/template-adapter.mjs +1 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +12 -0
- package/foundation/doc-compiler/tree.test.mjs +1 -9
- package/foundation/integrations/integrations.d.mts +1 -14
- package/foundation/integrations/integrations.mjs +1 -41
- package/foundation/integrations/integrations.test.mjs +0 -31
- package/foundation/response/response-types.doc.mjs +21 -15
- package/foundation/response/response-types.doc.test.mjs +0 -23
- package/foundation/xle/browser.d.mts +3 -3
- package/foundation/xle/browser.mjs +3 -3
- package/foundation/xle/expand.mjs +2 -2
- package/foundation/xle/parse.mjs +1 -1
- package/foundation/xle/print.mjs +2 -2
- package/foundation/xle/splice.mjs +1 -1
- package/package.json +9 -9
- package/api/discover/_adapter.test.mjs +0 -215
- package/api/discover/_catalog-view.d.mts +0 -115
- package/api/discover/_catalog-view.mjs +0 -203
- package/api/discover/_catalog-view.test.mjs +0 -128
- package/api/discover/detail/item/item.d.mts +0 -26
- package/api/discover/detail/item/item.mjs +0 -78
- package/api/discover/detail/item/item.test.mjs +0 -73
- package/api/integration/pack-check.lifecycle-output.test.mjs +0 -105
- package/api/theme/add/add.rollback.test.mjs +0 -158
- package/api/theme/build/build.rollback.test.mjs +0 -148
- package/api/upgrade/run/files-changed.test.mjs +0 -111
- package/assets/codemods/file-count.test.mjs +0 -163
- package/assets/docs/tree/component-lookups.doc.mjs +0 -149
- package/authoring/discover/discover.doc.d.mts +0 -13
- package/authoring/discover/discover.doc.mjs +0 -138
- package/authoring/discover/parse.d.mts +0 -24
- package/authoring/discover/parse.mjs +0 -128
- package/authoring/discover/parse.test.mjs +0 -124
- package/authoring/discover/type.ts +0 -87
- package/clients/cli/commands/component-batch.test.mjs +0 -341
- package/clients/cli/commands/discover.sources.test.mjs +0 -267
- package/clients/cli/lib/parse-error-format.test.mjs +0 -81
- package/foundation/response/batch.type.d.mts +0 -33
- package/foundation/response/batch.type.mjs +0 -34
|
@@ -38,7 +38,6 @@ import {doc as componentFn} from '../../../../api/component/component.doc.mjs';
|
|
|
38
38
|
*
|
|
39
39
|
* @typedef {(
|
|
40
40
|
* | import('../../../../api/component/component.type.mjs').ComponentListResponse
|
|
41
|
-
* | import('../../../../api/component/component.type.mjs').ComponentBatchResponse
|
|
42
41
|
* | import('../../../../api/component/component.type.mjs').ComponentDetailResponse
|
|
43
42
|
* | import('../../../../api/component/component.type.mjs').ComponentDetailPropsResponse
|
|
44
43
|
* | import('../../../../api/component/component.type.mjs').ComponentDetailSourceResponse
|
|
@@ -68,11 +67,6 @@ function summarize(result) {
|
|
|
68
67
|
);
|
|
69
68
|
return resultSet({count, resultKind: 'component'});
|
|
70
69
|
}
|
|
71
|
-
case 'component.batch':
|
|
72
|
-
return resultSet({
|
|
73
|
-
count: result.data.results.filter(row => row.status === 'found').length,
|
|
74
|
-
resultKind: 'component',
|
|
75
|
-
});
|
|
76
70
|
case 'component.detail':
|
|
77
71
|
case 'component.detail.props':
|
|
78
72
|
case 'component.detail.source':
|
|
@@ -88,103 +82,19 @@ function summarize(result) {
|
|
|
88
82
|
}
|
|
89
83
|
}
|
|
90
84
|
|
|
91
|
-
/**
|
|
92
|
-
* Project one single-component API result through the existing formatter kit.
|
|
93
|
-
* @param {import('../../../../api/component/component.type.mjs').ComponentSingleResponse} result
|
|
94
|
-
* @param {string} requestedName
|
|
95
|
-
* @param {'full'|'compact'|'brief'} detail
|
|
96
|
-
* @param {ReturnType<typeof resolveTheme>} themeData
|
|
97
|
-
* @returns {import('../../formatters/index.mjs').Block[]}
|
|
98
|
-
*/
|
|
99
|
-
function componentDetailBlocks(result, requestedName, detail, themeData) {
|
|
100
|
-
const resolvedName = (requestedName.split('/').pop() ?? requestedName).replace(
|
|
101
|
-
/^XDS/,
|
|
102
|
-
'',
|
|
103
|
-
);
|
|
104
|
-
switch (result.type) {
|
|
105
|
-
case 'component.detail': {
|
|
106
|
-
/** @type {import('../../formatters/index.mjs').Block[]} */
|
|
107
|
-
const out = [];
|
|
108
|
-
if (result.data.parentDoc) {
|
|
109
|
-
out.push(record(result.data, {fields: ['parentDoc']}));
|
|
110
|
-
}
|
|
111
|
-
out.push(
|
|
112
|
-
detail === 'brief'
|
|
113
|
-
? code(
|
|
114
|
-
formatBrief(result.data, resolvedName, result.data.import, {
|
|
115
|
-
themeData,
|
|
116
|
-
}),
|
|
117
|
-
)
|
|
118
|
-
: detail === 'compact'
|
|
119
|
-
? code(
|
|
120
|
-
formatCompact(result.data, resolvedName, result.data.import),
|
|
121
|
-
)
|
|
122
|
-
: code(
|
|
123
|
-
formatFull(result.data, {
|
|
124
|
-
themeData,
|
|
125
|
-
importHint: result.data.import,
|
|
126
|
-
}),
|
|
127
|
-
),
|
|
128
|
-
);
|
|
129
|
-
return out;
|
|
130
|
-
}
|
|
131
|
-
case 'component.detail.props':
|
|
132
|
-
return [code(formatProps({props: result.data}, resolvedName))];
|
|
133
|
-
case 'component.detail.source':
|
|
134
|
-
case 'component.detail.showcase':
|
|
135
|
-
return [code(result.data.source)];
|
|
136
|
-
case 'component.detail.blocks': {
|
|
137
|
-
const {showcase, examples, related} = result.data;
|
|
138
|
-
/** @type {import('../../formatters/index.mjs').Block[]} */
|
|
139
|
-
const out = [];
|
|
140
|
-
if (showcase) {
|
|
141
|
-
out.push(
|
|
142
|
-
section('Showcase'),
|
|
143
|
-
record(showcase, {fields: ['displayName', 'description']}),
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
if (examples.length > 0) {
|
|
147
|
-
out.push(
|
|
148
|
-
section('Examples'),
|
|
149
|
-
records(examples, {fields: ['name', 'description']}),
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
if (related.length > 0) {
|
|
153
|
-
out.push(
|
|
154
|
-
section(
|
|
155
|
-
`Related: ${related.length} blocks that use ${result.data.component}`,
|
|
156
|
-
),
|
|
157
|
-
list(related.map(block => block.name)),
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
if (!showcase && examples.length === 0 && related.length === 0) {
|
|
161
|
-
out.push(text(`No blocks found for ${result.data.component}`));
|
|
162
|
-
}
|
|
163
|
-
return out;
|
|
164
|
-
}
|
|
165
|
-
default:
|
|
166
|
-
return [];
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
85
|
/**
|
|
171
86
|
* @param {import('commander').Command} program
|
|
172
87
|
*/
|
|
173
88
|
export function registerComponent(program) {
|
|
174
89
|
defineCommand(program, componentCommand, {
|
|
175
90
|
fn: componentFn,
|
|
176
|
-
action: async (
|
|
177
|
-
/** @type {string[] | undefined} */ names,
|
|
178
|
-
/** @type {{list?: boolean, category?: string, props?: boolean, source?: boolean, showcase?: boolean, blocks?: boolean, package?: string}} */ options,
|
|
179
|
-
) => {
|
|
91
|
+
action: async (/** @type {string | undefined} */ name, /** @type {{list?: boolean, category?: string, props?: boolean, source?: boolean, showcase?: boolean, blocks?: boolean, package?: string}} */ options) => {
|
|
180
92
|
const run = getCliInvocation();
|
|
181
|
-
const name = names?.length === 1 ? names[0] : undefined;
|
|
182
|
-
const apiInput = !names?.length ? undefined : name ?? names;
|
|
183
93
|
const zh = program.opts().zh || false;
|
|
184
94
|
const dense = program.opts().dense || false;
|
|
185
95
|
const lang = program.opts().lang || null;
|
|
186
96
|
const detailSource = program.getOptionValueSource('detail');
|
|
187
|
-
const isListView = options.list || options.category || !
|
|
97
|
+
const isListView = options.list || options.category || !name;
|
|
188
98
|
// Default detail level is full for single-component view, brief for list views.
|
|
189
99
|
// (List views are scannable name lists; users can opt into compact/full.)
|
|
190
100
|
let detail = program.opts().detail || 'full';
|
|
@@ -209,7 +119,7 @@ export function registerComponent(program) {
|
|
|
209
119
|
/** @type {ComponentResult} */
|
|
210
120
|
let result;
|
|
211
121
|
try {
|
|
212
|
-
result = /** @type {ComponentResult} */ (await componentApi(
|
|
122
|
+
result = /** @type {ComponentResult} */ (await componentApi(name, {
|
|
213
123
|
cwd: process.cwd(),
|
|
214
124
|
list: options.list,
|
|
215
125
|
category: options.category,
|
|
@@ -227,12 +137,6 @@ export function registerComponent(program) {
|
|
|
227
137
|
}
|
|
228
138
|
|
|
229
139
|
const answered = summarize(result);
|
|
230
|
-
if (
|
|
231
|
-
result.type === 'component.batch' &&
|
|
232
|
-
result.data.results.some(row => row.status !== 'found')
|
|
233
|
-
) {
|
|
234
|
-
process.exitCode = 1;
|
|
235
|
-
}
|
|
236
140
|
if (json) {
|
|
237
141
|
jsonOut(result);
|
|
238
142
|
return answered;
|
|
@@ -248,7 +152,7 @@ export function registerComponent(program) {
|
|
|
248
152
|
const listFooter = text(
|
|
249
153
|
[
|
|
250
154
|
`Import from the path shown (e.g. import {Button} from '@astryxdesign/core/Button')`,
|
|
251
|
-
`Usage: ${run} component <name
|
|
155
|
+
`Usage: ${run} component <name>`,
|
|
252
156
|
].join('\n'),
|
|
253
157
|
);
|
|
254
158
|
|
|
@@ -327,65 +231,64 @@ export function registerComponent(program) {
|
|
|
327
231
|
break;
|
|
328
232
|
}
|
|
329
233
|
|
|
330
|
-
case 'component.
|
|
234
|
+
case 'component.detail': {
|
|
235
|
+
const resolvedName = (name || '').replace(/^XDS/, '');
|
|
236
|
+
const importHint = result.data.import;
|
|
237
|
+
if (result.data.parentDoc) emit(record(result.data, {fields: ['parentDoc']}));
|
|
238
|
+
const doc =
|
|
239
|
+
detail === 'brief'
|
|
240
|
+
? code(formatBrief(result.data, resolvedName, importHint, {themeData}))
|
|
241
|
+
: detail === 'compact'
|
|
242
|
+
? code(formatCompact(result.data, resolvedName, importHint))
|
|
243
|
+
: code(formatFull(result.data, {themeData, importHint}));
|
|
244
|
+
emit(doc);
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
case 'component.detail.props': {
|
|
249
|
+
const resolvedName = (name || '').replace(/^XDS/, '');
|
|
250
|
+
emit(code(formatProps({props: result.data}, resolvedName)));
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
case 'component.detail.source': {
|
|
255
|
+
emit(code(result.data.source));
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
case 'component.detail.showcase': {
|
|
260
|
+
emit(code(result.data.source));
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
case 'component.detail.blocks': {
|
|
265
|
+
const {showcase, examples, related} = result.data;
|
|
331
266
|
/** @type {import('../../formatters/index.mjs').Block[]} */
|
|
332
|
-
const out = [
|
|
333
|
-
|
|
334
|
-
record({count: result.data.count}),
|
|
335
|
-
section('Results'),
|
|
336
|
-
];
|
|
337
|
-
for (const row of result.data.results) {
|
|
338
|
-
out.push(section(row.selector));
|
|
339
|
-
if (row.status === 'found') {
|
|
340
|
-
out.push(
|
|
341
|
-
record(row, {fields: ['selector', 'status']}),
|
|
342
|
-
section('Result'),
|
|
343
|
-
...componentDetailBlocks(
|
|
344
|
-
row.result,
|
|
345
|
-
row.selector,
|
|
346
|
-
detail,
|
|
347
|
-
themeData,
|
|
348
|
-
),
|
|
349
|
-
);
|
|
350
|
-
continue;
|
|
351
|
-
}
|
|
267
|
+
const out = [];
|
|
268
|
+
if (showcase) {
|
|
352
269
|
out.push(
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}),
|
|
270
|
+
section('Showcase'),
|
|
271
|
+
record(showcase, {fields: ['displayName', 'description']}),
|
|
356
272
|
);
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
273
|
+
}
|
|
274
|
+
if (examples.length > 0) {
|
|
275
|
+
out.push(
|
|
276
|
+
section('Examples'),
|
|
277
|
+
records(examples, {fields: ['name', 'description']}),
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
if (related.length > 0) {
|
|
281
|
+
out.push(
|
|
282
|
+
section(`Related: ${related.length} blocks that use ${result.data.component}`),
|
|
283
|
+
list(related.map(b => b.name)),
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
if (!showcase && examples.length === 0 && related.length === 0) {
|
|
287
|
+
out.push(text(`No blocks found for ${result.data.component}`));
|
|
370
288
|
}
|
|
371
289
|
emit(...out);
|
|
372
290
|
break;
|
|
373
291
|
}
|
|
374
|
-
|
|
375
|
-
case 'component.detail':
|
|
376
|
-
case 'component.detail.props':
|
|
377
|
-
case 'component.detail.source':
|
|
378
|
-
case 'component.detail.showcase':
|
|
379
|
-
case 'component.detail.blocks':
|
|
380
|
-
emit(
|
|
381
|
-
...componentDetailBlocks(
|
|
382
|
-
result,
|
|
383
|
-
name ?? '',
|
|
384
|
-
detail,
|
|
385
|
-
themeData,
|
|
386
|
-
),
|
|
387
|
-
);
|
|
388
|
-
break;
|
|
389
292
|
}
|
|
390
293
|
return answered;
|
|
391
294
|
},
|
|
@@ -277,95 +277,6 @@ describe('component() — integration ownership via config', () => {
|
|
|
277
277
|
expect(result.data.import).toBe(`${INTEGRATION_NAME}/Toolbar/Search`);
|
|
278
278
|
});
|
|
279
279
|
|
|
280
|
-
it('reports every installed candidate for an ambiguous batch selector', async () => {
|
|
281
|
-
createFixture({extraComponent: 'AppShell'});
|
|
282
|
-
const result = await component(['MetaAppShell', 'AppShell'], {cwd: tmpDir});
|
|
283
|
-
expect(result.type).toBe('component.batch');
|
|
284
|
-
expect(result.data.results[0]).toMatchObject({
|
|
285
|
-
selector: 'MetaAppShell',
|
|
286
|
-
status: 'found',
|
|
287
|
-
});
|
|
288
|
-
expect(result.data.results[1]).toMatchObject({
|
|
289
|
-
selector: 'AppShell',
|
|
290
|
-
status: 'ambiguous',
|
|
291
|
-
code: 'ERR_UNKNOWN_COMPONENT',
|
|
292
|
-
});
|
|
293
|
-
expect(result.data.results[1].candidates).toEqual(
|
|
294
|
-
expect.arrayContaining([
|
|
295
|
-
{
|
|
296
|
-
package: CORE_PACKAGE,
|
|
297
|
-
component: 'AppShell',
|
|
298
|
-
kind: 'component',
|
|
299
|
-
installed: true,
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
package: INTEGRATION_NAME,
|
|
303
|
-
component: 'AppShell',
|
|
304
|
-
kind: 'component',
|
|
305
|
-
installed: true,
|
|
306
|
-
},
|
|
307
|
-
]),
|
|
308
|
-
);
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
it('keeps the single-result envelope for one package-qualified selector', async () => {
|
|
312
|
-
createFixture();
|
|
313
|
-
const result = await component('@test/meta@1.2.3/MetaAppShell', {
|
|
314
|
-
cwd: tmpDir,
|
|
315
|
-
});
|
|
316
|
-
expect(result.type).toBe('component.detail');
|
|
317
|
-
expect(result.data).toMatchObject({
|
|
318
|
-
name: 'MetaAppShell',
|
|
319
|
-
package: INTEGRATION_NAME,
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
it('resolves an exact installed package version and refuses another version', async () => {
|
|
324
|
-
createFixture();
|
|
325
|
-
const result = await component(
|
|
326
|
-
[
|
|
327
|
-
'@test/meta@1.2.3/MetaAppShell',
|
|
328
|
-
'@test/meta@9.9.9/MetaAppShell',
|
|
329
|
-
],
|
|
330
|
-
{cwd: tmpDir},
|
|
331
|
-
);
|
|
332
|
-
expect(result.type).toBe('component.batch');
|
|
333
|
-
expect(result.data.results[0]).toMatchObject({
|
|
334
|
-
selector: '@test/meta@1.2.3/MetaAppShell',
|
|
335
|
-
status: 'found',
|
|
336
|
-
result: {type: 'component.detail'},
|
|
337
|
-
});
|
|
338
|
-
expect(result.data.results[1]).toMatchObject({
|
|
339
|
-
selector: '@test/meta@9.9.9/MetaAppShell',
|
|
340
|
-
status: 'not_found',
|
|
341
|
-
code: 'ERR_UNKNOWN_PACKAGE',
|
|
342
|
-
suggestions: [
|
|
343
|
-
{
|
|
344
|
-
name: 'astryx discover @test/meta@9.9.9',
|
|
345
|
-
reason: 'look up this package version',
|
|
346
|
-
},
|
|
347
|
-
],
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
it('reports a package-qualified selector that conflicts with --package', async () => {
|
|
352
|
-
createFixture();
|
|
353
|
-
const result = await component(
|
|
354
|
-
['@test/meta/MetaAppShell', 'Button'],
|
|
355
|
-
{cwd: tmpDir, package: CORE_PACKAGE},
|
|
356
|
-
);
|
|
357
|
-
expect(result.type).toBe('component.batch');
|
|
358
|
-
expect(result.data.results[0]).toMatchObject({
|
|
359
|
-
selector: '@test/meta/MetaAppShell',
|
|
360
|
-
status: 'error',
|
|
361
|
-
code: 'ERR_INVALID_ARGUMENT',
|
|
362
|
-
});
|
|
363
|
-
expect(result.data.results[1]).toMatchObject({
|
|
364
|
-
selector: 'Button',
|
|
365
|
-
status: 'found',
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
|
|
369
280
|
it('JSON list includes integration components as {name, package} objects', async () => {
|
|
370
281
|
createFixture();
|
|
371
282
|
const result = await component(undefined, {cwd: tmpDir, list: true});
|
|
@@ -16,23 +16,11 @@ export const doc = {
|
|
|
16
16
|
namespace: 'cli/commands',
|
|
17
17
|
summary: 'List components or print component docs',
|
|
18
18
|
description:
|
|
19
|
-
'Resolves
|
|
20
|
-
'
|
|
21
|
-
|
|
22
|
-
"'@acme/widgets@1.2.3/Button'. A version applies to the package and must match the " +
|
|
23
|
-
'installed version. Boolean flags narrow every resolved component to just its props, ' +
|
|
24
|
-
'source, showcase, or example blocks.',
|
|
19
|
+
'Resolves a component by name across core and integration packages and prints ' +
|
|
20
|
+
'its authored doc, or lists the catalog grouped by category. Boolean flags narrow ' +
|
|
21
|
+
'a single component to just its props, source, showcase, or example blocks.',
|
|
25
22
|
fn: 'component',
|
|
26
|
-
args: [
|
|
27
|
-
{
|
|
28
|
-
name: 'names',
|
|
29
|
-
param: 'name',
|
|
30
|
-
description:
|
|
31
|
-
'One or more exact selectors. Use Name, package/Name, @scope/package/Name, or @scope/package@version/Name. Two or more return one ordered batch. At most 100 selectors are accepted.',
|
|
32
|
-
required: false,
|
|
33
|
-
variadic: true,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
23
|
+
args: [{name: 'name', param: 'name', required: false}],
|
|
36
24
|
options: [
|
|
37
25
|
{
|
|
38
26
|
flag: '--list',
|
|
@@ -67,16 +55,11 @@ export const doc = {
|
|
|
67
55
|
{
|
|
68
56
|
flag: '--package <name>',
|
|
69
57
|
param: 'options.package',
|
|
70
|
-
description:
|
|
71
|
-
'Scope lookup to an external package (e.g. @acme/xds-widgets)',
|
|
58
|
+
description: 'Scope lookup to an external package (e.g. @acme/xds-widgets)',
|
|
72
59
|
},
|
|
73
60
|
],
|
|
74
61
|
examples: [
|
|
75
62
|
{label: 'Browse the catalog', cli: 'astryx component --list'},
|
|
76
|
-
{
|
|
77
|
-
label: 'Look up several components',
|
|
78
|
-
cli: 'astryx component Button Badge Text',
|
|
79
|
-
},
|
|
80
63
|
{
|
|
81
64
|
label: 'Props table as JSON',
|
|
82
65
|
cli: 'astryx component XDSButton --props --json',
|
|
@@ -86,7 +69,7 @@ export const doc = {
|
|
|
86
69
|
{code: 0, when: 'success'},
|
|
87
70
|
{
|
|
88
71
|
code: 1,
|
|
89
|
-
when: 'unknown component, category, or package
|
|
72
|
+
when: 'unknown component, category, or package, or @astryxdesign/core cannot be resolved',
|
|
90
73
|
},
|
|
91
74
|
],
|
|
92
75
|
related: ['search', 'hook', 'docs', 'template', 'swizzle'],
|
|
@@ -179,9 +179,9 @@ describe('DebugEvent result summary', () => {
|
|
|
179
179
|
it(
|
|
180
180
|
'says so explicitly when a command has no result set',
|
|
181
181
|
async () => {
|
|
182
|
-
//
|
|
182
|
+
// `layout check` returns a verdict on one expression: nothing was looked
|
|
183
183
|
// up, and the run says that rather than leaving four ambiguous nulls.
|
|
184
|
-
const {event} = await runWithDebug(['
|
|
184
|
+
const {event} = await runWithDebug(['layout', 'check', 'VStack>Text']);
|
|
185
185
|
expect(event.output).toMatchObject({
|
|
186
186
|
resultKind: 'none',
|
|
187
187
|
resultCount: null,
|
|
@@ -14,13 +14,11 @@ export const doc = {
|
|
|
14
14
|
name: 'discover',
|
|
15
15
|
displayName: 'astryx discover',
|
|
16
16
|
namespace: 'cli/commands',
|
|
17
|
-
summary:
|
|
18
|
-
'Browse and search integrations: the ones you have and the ones you could add',
|
|
17
|
+
summary: 'Discover external packages and components',
|
|
19
18
|
description:
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
|
|
23
|
-
'Anything else, even an exact component name, searches every item and package and lists the matches. Discover only reads: your package manager installs, updates, and removes packages.',
|
|
19
|
+
'Explores components contributed by configured external packages and integrations. ' +
|
|
20
|
+
'With no query it lists those packages; an @scope/name query browses one package; ' +
|
|
21
|
+
'an @scope/name/Component path or a free-text term resolves to a component doc.',
|
|
24
22
|
fn: 'discover',
|
|
25
23
|
args: [{name: 'query', param: 'query', required: false}],
|
|
26
24
|
options: [
|
|
@@ -28,61 +26,19 @@ export const doc = {
|
|
|
28
26
|
flag: '--components',
|
|
29
27
|
param: 'options.components',
|
|
30
28
|
description:
|
|
31
|
-
'In the package list, print every component
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
flag: '--type <kind>',
|
|
35
|
-
param: 'options.type',
|
|
36
|
-
description:
|
|
37
|
-
'Only one kind: component, template, doc, theme, codemod, or agent-doc. In the list, only packages that add it; in a search, only items of that kind.',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
flag: '--installed',
|
|
41
|
-
param: 'options.installed',
|
|
42
|
-
description:
|
|
43
|
-
'Only what this project has. Cannot be set with --available.',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
flag: '--available',
|
|
47
|
-
param: 'options.available',
|
|
48
|
-
description:
|
|
49
|
-
'Only what this project could add. Cannot be set with --installed.',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
flag: '--limit <n>',
|
|
53
|
-
param: 'options.limit',
|
|
54
|
-
description:
|
|
55
|
-
'Max number of search results, a positive integer (default 20).',
|
|
29
|
+
'In the package list, print every component of each package instead of the first 10 and a "+N more" count. No effect on --json output or on a package, component, or search query.',
|
|
56
30
|
},
|
|
57
31
|
],
|
|
58
32
|
examples: [
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
label: 'List every component of each package',
|
|
65
|
-
cli: 'astryx discover --components',
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
label: 'Only packages that add themes',
|
|
69
|
-
cli: 'astryx discover --type theme',
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
label: 'Browse a package and its versions',
|
|
73
|
-
cli: 'astryx discover @acme/ui',
|
|
74
|
-
},
|
|
75
|
-
{label: 'See one version', cli: 'astryx discover @acme/ui@2.1.0'},
|
|
76
|
-
{
|
|
77
|
-
label: 'Search templates you could add',
|
|
78
|
-
cli: 'astryx discover dashboard --type template --available',
|
|
79
|
-
},
|
|
33
|
+
{label: 'List packages', cli: 'astryx discover --json'},
|
|
34
|
+
{label: 'List every component of each package', cli: 'astryx discover --components'},
|
|
35
|
+
{label: 'Browse a package', cli: 'astryx discover @acme/ui'},
|
|
80
36
|
],
|
|
81
37
|
exitCodes: [
|
|
82
38
|
{code: 0, when: 'success'},
|
|
83
39
|
{
|
|
84
40
|
code: 1,
|
|
85
|
-
when: 'unknown package
|
|
41
|
+
when: 'unknown package or component, a malformed doc, or a blank query when packages are discovered',
|
|
86
42
|
},
|
|
87
43
|
],
|
|
88
44
|
related: ['component', 'search', 'template'],
|