@astryxdesign/cli 0.7.0-canary.e92e36f → 0.7.0-canary.ed07233
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 +61 -61
- package/api/integration/pack-check.test.mjs +8 -0
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.type.mjs +1 -1
- package/api/theme/build/build.d.mts +0 -1
- package/api/theme/build/build.mjs +4 -29
- package/api/theme/build/family.mjs +1 -1
- package/assets/codemods/transforms/next/__tests__/migrate-field-input-styling.test.mjs +108 -0
- package/assets/codemods/transforms/next/__tests__/validate-data-token-ownership.test.mjs +84 -0
- package/assets/codemods/transforms/next/index.mjs +16 -0
- package/assets/codemods/transforms/next/migrate-field-input-styling.mjs +198 -0
- package/assets/codemods/transforms/next/validate-data-token-ownership.mjs +102 -0
- package/assets/docs/author-a-theme.doc.mjs +1 -1
- package/assets/docs/tree/tokens-data.doc.mjs +2 -2
- package/assets/docs/tree/tokens-usage.doc.mjs +1 -1
- package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorDeadlinePicker.tsx +1 -1
- package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorShowcase.tsx +1 -1
- package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorTreeSearch.tsx +1 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +1 -1
- package/assets/templates/blocks/components/Selector/SelectorClearable.tsx +1 -1
- package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +2 -2
- package/assets/templates/blocks/components/Selector/SelectorShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Selector/SelectorWithSections.tsx +1 -1
- package/assets/templates/blocks/components/SelectorOption/SelectorOptionBasic.tsx +1 -1
- package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Slider/SliderFormattedValue.tsx +1 -1
- package/assets/templates/blocks/components/Slider/SliderRangeSlider.tsx +1 -1
- package/assets/templates/blocks/components/Slider/SliderShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Slider/SliderWithMarks.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +2 -2
- package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +2 -2
- package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx +4 -4
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +1 -1
- package/assets/templates/pages/canvas-editor/page.tsx +2 -2
- package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
- package/assets/templates/pages/payment-form/page.tsx +1 -1
- package/assets/templates/pages/table-filter/page.tsx +3 -3
- package/assets/templates/pages/theme-showcase/page.tsx +2 -2
- package/clients/cli/commands/build-theme.color-scheme.test.mjs +10 -6
- package/clients/cli/commands/build-theme.data-tokens.test.mjs +23 -75
- package/foundation/discovery/template-needs.mjs +93 -11
- package/foundation/discovery/template-needs.test.mjs +106 -3
- package/foundation/env/package-manager.d.mts +13 -0
- package/foundation/env/package-manager.mjs +106 -63
- package/foundation/response/response-types.doc.mjs +1 -2
- package/package.json +9 -9
|
@@ -144,6 +144,76 @@ function evidenceIn(dir) {
|
|
|
144
144
|
* them, because a tool that trusts the lockfile instead will disagree with us.
|
|
145
145
|
*/
|
|
146
146
|
|
|
147
|
+
/**
|
|
148
|
+
* What one directory's own files say about its package manager, by the rules
|
|
149
|
+
* {@link explainPackageManager} applies within a directory (declared field,
|
|
150
|
+
* then a single lockfile, then committed config when lockfiles tie). Returns
|
|
151
|
+
* null when the directory has neither a declaration nor a lockfile, so a caller
|
|
152
|
+
* walking up keeps looking. An ambiguous directory reports `ambiguous: true`
|
|
153
|
+
* with the lockfiles that disagree, so a caller can name them.
|
|
154
|
+
* @param {string} dir
|
|
155
|
+
* @returns {(Omit<PackageManagerResolution, 'dir'> & {lockfiles: FoundLockfile[]}) | null}
|
|
156
|
+
*/
|
|
157
|
+
export function decidePackageManagerIn(dir) {
|
|
158
|
+
const locks = lockfilesIn(dir);
|
|
159
|
+
const candidates = locks.map(lock => lock.pm);
|
|
160
|
+
const declared = declaredPackageManager(dir);
|
|
161
|
+
|
|
162
|
+
// The project declared one. Nothing on the filesystem outranks that.
|
|
163
|
+
if (declared) {
|
|
164
|
+
return {
|
|
165
|
+
pm: declared,
|
|
166
|
+
ambiguous: false,
|
|
167
|
+
candidates,
|
|
168
|
+
declared,
|
|
169
|
+
source: 'declared',
|
|
170
|
+
lockfiles: locks,
|
|
171
|
+
strayLockfiles: locks.filter(lock => lock.pm !== declared),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// One lockfile is unambiguous.
|
|
176
|
+
if (locks.length === 1) {
|
|
177
|
+
return {
|
|
178
|
+
pm: locks[0].pm,
|
|
179
|
+
ambiguous: false,
|
|
180
|
+
candidates,
|
|
181
|
+
declared: null,
|
|
182
|
+
source: 'lockfile',
|
|
183
|
+
lockfiles: locks,
|
|
184
|
+
strayLockfiles: [],
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Several lockfiles and no declaration: the filesystem cannot say. Only a
|
|
189
|
+
// file the project committed on purpose can.
|
|
190
|
+
if (locks.length > 1) {
|
|
191
|
+
const evidence = evidenceIn(dir).filter(pm => candidates.includes(pm));
|
|
192
|
+
if (evidence.length === 1) {
|
|
193
|
+
return {
|
|
194
|
+
pm: evidence[0],
|
|
195
|
+
ambiguous: false,
|
|
196
|
+
candidates,
|
|
197
|
+
declared: null,
|
|
198
|
+
source: 'evidence',
|
|
199
|
+
lockfiles: locks,
|
|
200
|
+
strayLockfiles: [],
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
pm: 'npx',
|
|
205
|
+
ambiguous: true,
|
|
206
|
+
candidates,
|
|
207
|
+
declared: null,
|
|
208
|
+
source: 'none',
|
|
209
|
+
lockfiles: locks,
|
|
210
|
+
strayLockfiles: [],
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
|
|
147
217
|
/**
|
|
148
218
|
* Detect the project's package manager, with the reasoning attached.
|
|
149
219
|
* Walks up from targetDir, taking the first directory that answers.
|
|
@@ -182,59 +252,16 @@ export function explainPackageManager(targetDir = process.cwd()) {
|
|
|
182
252
|
const root = path.parse(dir).root;
|
|
183
253
|
|
|
184
254
|
while (dir !== root) {
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
const declared = declaredPackageManager(dir);
|
|
188
|
-
|
|
189
|
-
// 1. The project declared one. Nothing on the filesystem outranks that.
|
|
190
|
-
if (declared) {
|
|
255
|
+
const decision = decidePackageManagerIn(dir);
|
|
256
|
+
if (decision) {
|
|
191
257
|
return {
|
|
192
|
-
pm:
|
|
193
|
-
ambiguous:
|
|
194
|
-
dir,
|
|
195
|
-
candidates,
|
|
196
|
-
declared,
|
|
197
|
-
source: 'declared',
|
|
198
|
-
strayLockfiles: locks.filter(lock => lock.pm !== declared),
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// 2. One lockfile is unambiguous.
|
|
203
|
-
if (locks.length === 1) {
|
|
204
|
-
return {
|
|
205
|
-
pm: locks[0].pm,
|
|
206
|
-
ambiguous: false,
|
|
258
|
+
pm: decision.pm,
|
|
259
|
+
ambiguous: decision.ambiguous,
|
|
207
260
|
dir,
|
|
208
|
-
candidates,
|
|
209
|
-
declared:
|
|
210
|
-
source:
|
|
211
|
-
strayLockfiles:
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// 3. Several lockfiles and no declaration: the filesystem cannot say.
|
|
216
|
-
// Only a file the project committed on purpose can.
|
|
217
|
-
if (locks.length > 1) {
|
|
218
|
-
const evidence = evidenceIn(dir).filter(pm => candidates.includes(pm));
|
|
219
|
-
if (evidence.length === 1) {
|
|
220
|
-
return {
|
|
221
|
-
pm: evidence[0],
|
|
222
|
-
ambiguous: false,
|
|
223
|
-
dir,
|
|
224
|
-
candidates,
|
|
225
|
-
declared: null,
|
|
226
|
-
source: 'evidence',
|
|
227
|
-
strayLockfiles: [],
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
return {
|
|
231
|
-
pm: 'npx',
|
|
232
|
-
ambiguous: true,
|
|
233
|
-
dir,
|
|
234
|
-
candidates,
|
|
235
|
-
declared: null,
|
|
236
|
-
source: 'none',
|
|
237
|
-
strayLockfiles: [],
|
|
261
|
+
candidates: decision.candidates,
|
|
262
|
+
declared: decision.declared,
|
|
263
|
+
source: decision.source,
|
|
264
|
+
strayLockfiles: decision.strayLockfiles,
|
|
238
265
|
};
|
|
239
266
|
}
|
|
240
267
|
|
|
@@ -279,11 +306,15 @@ export function detectPackageManager(targetDir = process.cwd()) {
|
|
|
279
306
|
export function getRunPrefix(targetDir) {
|
|
280
307
|
const pm = detectPackageManager(targetDir);
|
|
281
308
|
switch (pm) {
|
|
282
|
-
case 'yarn':
|
|
283
|
-
|
|
284
|
-
case '
|
|
309
|
+
case 'yarn':
|
|
310
|
+
return 'yarn';
|
|
311
|
+
case 'pnpm':
|
|
312
|
+
return 'pnpm exec';
|
|
313
|
+
case 'bun':
|
|
314
|
+
return 'bunx';
|
|
285
315
|
case 'npm':
|
|
286
|
-
default:
|
|
316
|
+
default:
|
|
317
|
+
return 'npx';
|
|
287
318
|
}
|
|
288
319
|
}
|
|
289
320
|
|
|
@@ -310,11 +341,15 @@ export const CLI_BIN = 'astryx';
|
|
|
310
341
|
export function getDlxPrefix(targetDir) {
|
|
311
342
|
const resolution = explainPackageManager(targetDir);
|
|
312
343
|
switch (resolution.pm) {
|
|
313
|
-
case 'yarn':
|
|
314
|
-
|
|
315
|
-
case '
|
|
344
|
+
case 'yarn':
|
|
345
|
+
return isYarnClassic(resolution) ? 'npx' : 'yarn dlx';
|
|
346
|
+
case 'pnpm':
|
|
347
|
+
return 'pnpm dlx';
|
|
348
|
+
case 'bun':
|
|
349
|
+
return 'bunx';
|
|
316
350
|
case 'npm':
|
|
317
|
-
default:
|
|
351
|
+
default:
|
|
352
|
+
return 'npx';
|
|
318
353
|
}
|
|
319
354
|
}
|
|
320
355
|
|
|
@@ -343,7 +378,9 @@ function isYarnClassic({dir}) {
|
|
|
343
378
|
if (fs.existsSync(path.join(dir, '.yarnrc.yml'))) return false;
|
|
344
379
|
if (fs.existsSync(path.join(dir, '.yarnrc'))) return true;
|
|
345
380
|
}
|
|
346
|
-
const agent = /^yarn\/(\d+)\./.exec(
|
|
381
|
+
const agent = /^yarn\/(\d+)\./.exec(
|
|
382
|
+
String(process.env.npm_config_user_agent ?? ''),
|
|
383
|
+
);
|
|
347
384
|
return agent ? agent[1] === '1' : false;
|
|
348
385
|
}
|
|
349
386
|
|
|
@@ -354,8 +391,12 @@ function isYarnClassic({dir}) {
|
|
|
354
391
|
*/
|
|
355
392
|
function declaredYarnMajor(dir) {
|
|
356
393
|
try {
|
|
357
|
-
const pkg = JSON.parse(
|
|
358
|
-
|
|
394
|
+
const pkg = JSON.parse(
|
|
395
|
+
fs.readFileSync(path.join(dir, 'package.json'), 'utf-8'),
|
|
396
|
+
);
|
|
397
|
+
const match = /^yarn@(\d+)(?:[.+]|$)/.exec(
|
|
398
|
+
String(pkg.packageManager ?? ''),
|
|
399
|
+
);
|
|
359
400
|
return match ? Number(match[1]) : null;
|
|
360
401
|
} catch {
|
|
361
402
|
// Best-effort: no package.json, or an unreadable one.
|
|
@@ -465,7 +506,9 @@ export function getCliInvocation(targetDir) {
|
|
|
465
506
|
* @returns {string}
|
|
466
507
|
*/
|
|
467
508
|
export function formatCliCommand(command, targetDir) {
|
|
468
|
-
const sub = String(command)
|
|
509
|
+
const sub = String(command)
|
|
510
|
+
.replace(/^\s*astryx\b\s*/, '')
|
|
511
|
+
.trim();
|
|
469
512
|
const stem = getCliInvocation(targetDir);
|
|
470
513
|
return sub ? `${stem} ${sub}` : stem;
|
|
471
514
|
}
|
|
@@ -196,7 +196,7 @@ export const doc = {
|
|
|
196
196
|
{
|
|
197
197
|
value: 'template.copy',
|
|
198
198
|
description:
|
|
199
|
-
"A scaffold receipt: template id, output directory, written file name, file count, demoMediaReplaced (how many Astryx demo media references were replaced with placeholders), notes (setup notes naming what the template needs that the project lacks — missing packages, missing StyleX compiler; empty when satisfied), missingPackages (external package names the template imports that are not in the project), and installCommand (a ready-to-run install command with the detected package manager and workspace version ranges; null when nothing is missing). The envelope's package names the npm package that owns the template.",
|
|
199
|
+
"A scaffold receipt: template id, output directory, written file name, file count, demoMediaReplaced (how many Astryx demo media references were replaced with placeholders), notes (setup notes naming what the template needs that the project lacks — missing packages, missing StyleX compiler; empty when satisfied), missingPackages (external package names the template imports that are not in the project), and installCommand (a ready-to-run install command with the detected package manager and workspace version ranges; null when nothing is missing, or when several lockfiles leave the package manager undetermined). The envelope's package names the npm package that owns the template.",
|
|
200
200
|
},
|
|
201
201
|
|
|
202
202
|
{
|
|
@@ -349,6 +349,5 @@ export const doc = {
|
|
|
349
349
|
description:
|
|
350
350
|
'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` | `error`) and `relationship` (`replaces` | `extends` | `accidental`).',
|
|
351
351
|
},
|
|
352
|
-
|
|
353
352
|
],
|
|
354
353
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.0-canary.
|
|
3
|
+
"version": "0.7.0-canary.ed07233",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
"zod": "^4.4.3"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@astryxdesign/charts": "0.7.0-canary.
|
|
105
|
-
"@astryxdesign/core": "0.7.0-canary.
|
|
106
|
-
"@astryxdesign/lab": "0.7.0-canary.
|
|
107
|
-
"@astryxdesign/theme-neutral": "0.7.0-canary.
|
|
104
|
+
"@astryxdesign/charts": "0.7.0-canary.ed07233",
|
|
105
|
+
"@astryxdesign/core": "0.7.0-canary.ed07233",
|
|
106
|
+
"@astryxdesign/lab": "0.7.0-canary.ed07233",
|
|
107
|
+
"@astryxdesign/theme-neutral": "0.7.0-canary.ed07233"
|
|
108
108
|
},
|
|
109
109
|
"peerDependenciesMeta": {
|
|
110
110
|
"@astryxdesign/charts": {
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"@astryxdesign/charts": "0.7.0-canary.
|
|
125
|
-
"@astryxdesign/core": "0.7.0-canary.
|
|
126
|
-
"@astryxdesign/lab": "0.7.0-canary.
|
|
127
|
-
"@astryxdesign/theme-neutral": "0.7.0-canary.
|
|
124
|
+
"@astryxdesign/charts": "0.7.0-canary.ed07233",
|
|
125
|
+
"@astryxdesign/core": "0.7.0-canary.ed07233",
|
|
126
|
+
"@astryxdesign/lab": "0.7.0-canary.ed07233",
|
|
127
|
+
"@astryxdesign/theme-neutral": "0.7.0-canary.ed07233",
|
|
128
128
|
"@heroicons/react": "^2.2.0",
|
|
129
129
|
"@stylexjs/stylex": "^0.19.0",
|
|
130
130
|
"@types/babel__core": "^7.20.5",
|