@astryxdesign/cli 0.7.5 → 0.7.6-canary.39a40e9
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.
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import {describe, it, expect} from 'vitest';
|
|
17
17
|
import * as fs from 'node:fs';
|
|
18
|
+
import * as os from 'node:os';
|
|
18
19
|
import * as path from 'node:path';
|
|
19
20
|
import {fileURLToPath} from 'node:url';
|
|
20
21
|
import {
|
|
@@ -129,8 +130,10 @@ describe('import hint correctness', () => {
|
|
|
129
130
|
* @returns {string} the fixture's project root (pass as runCli's cwd)
|
|
130
131
|
*/
|
|
131
132
|
function createIntegrationFixture({exports: pkgExports} = {}) {
|
|
133
|
+
// Outside the source tree: a scan of the repo's docs (docs-drift)
|
|
134
|
+
// running at the same time must never find this fixture's doc.
|
|
132
135
|
const fixtureDir = fs.mkdtempSync(
|
|
133
|
-
path.join(
|
|
136
|
+
path.join(os.tmpdir(), 'astryx-import-hint-integration-'),
|
|
134
137
|
);
|
|
135
138
|
|
|
136
139
|
fs.mkdirSync(path.join(fixtureDir, 'packages'), {recursive: true});
|
|
@@ -209,6 +212,22 @@ describe('import hint correctness', () => {
|
|
|
209
212
|
fs.rmSync(fixtureDir, {recursive: true, force: true});
|
|
210
213
|
}
|
|
211
214
|
});
|
|
215
|
+
|
|
216
|
+
it('builds its fixture where a scan of the repo\u2019s docs running at the same time never finds it', async () => {
|
|
217
|
+
// The docs-drift scan walks packages/cli/clients/cli/commands for
|
|
218
|
+
// .doc.mjs files. A fixture built there handed it this test's Widget
|
|
219
|
+
// doc, which could vanish before the scan imported it.
|
|
220
|
+
const fixtureDir = createIntegrationFixture();
|
|
221
|
+
try {
|
|
222
|
+
const {collectDocs} = await import('../../../test/drift/docs-drift.mjs');
|
|
223
|
+
const found = (await collectDocs())
|
|
224
|
+
.map(({file}) => path.resolve(REPO_ROOT, file))
|
|
225
|
+
.filter(file => file.startsWith(fixtureDir + path.sep));
|
|
226
|
+
expect(found).toEqual([]);
|
|
227
|
+
} finally {
|
|
228
|
+
fs.rmSync(fixtureDir, {recursive: true, force: true});
|
|
229
|
+
}
|
|
230
|
+
});
|
|
212
231
|
});
|
|
213
232
|
|
|
214
233
|
describe('group names do NOT resolve to incorrect import paths', () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
-
import {describe, it, expect, afterEach, vi} from 'vitest';
|
|
3
|
+
import {describe, it, expect, afterEach, beforeAll, vi} from 'vitest';
|
|
4
4
|
import {spawnSync} from 'node:child_process';
|
|
5
5
|
import * as fs from 'node:fs';
|
|
6
6
|
import * as path from 'node:path';
|
|
@@ -847,6 +847,19 @@ describe('commandInFolder', () => {
|
|
|
847
847
|
);
|
|
848
848
|
|
|
849
849
|
describe.runIf(PWSH)('in PowerShell, where it is installed', () => {
|
|
850
|
+
// The first `pwsh` a job starts pays PowerShell's cold start, which on a
|
|
851
|
+
// busy runner has outlasted a test's 30 s. `spawnSync` blocks, so that
|
|
852
|
+
// start landed on the first test's clock. Starting it once here, on the
|
|
853
|
+
// hook's own timeout, leaves each test's clock to its command.
|
|
854
|
+
beforeAll(() => {
|
|
855
|
+
const warm = spawnSync(
|
|
856
|
+
/** @type {string} */ (PWSH),
|
|
857
|
+
['-NoProfile', '-NonInteractive', '-Command', 'exit 0'],
|
|
858
|
+
{encoding: 'utf8'},
|
|
859
|
+
);
|
|
860
|
+
expect(warm.status, warm.stderr).toBe(0);
|
|
861
|
+
}, 120_000);
|
|
862
|
+
|
|
850
863
|
it('runs in the folder with every argument unchanged', () => {
|
|
851
864
|
const root = makeTmpDir();
|
|
852
865
|
const project = path.join(root, 'it\'s Macy’s ‘q’ $5 %x% !y `z` "q" [1]');
|
|
@@ -85,6 +85,14 @@ const BLOCK = () =>
|
|
|
85
85
|
|
|
86
86
|
beforeEach(() => {
|
|
87
87
|
dir = fs.mkdtempSync(path.join(process.cwd(), '.astryx-public-imports-'));
|
|
88
|
+
// The fixture is a package with its own TypeScript config, scoped to its
|
|
89
|
+
// own files. Without one, the prop check reads the repository's root
|
|
90
|
+
// config, as `tsc` would for a folder inside it, and compiles every
|
|
91
|
+
// declaration in the repository for each check.
|
|
92
|
+
fs.writeFileSync(
|
|
93
|
+
path.join(dir, 'tsconfig.json'),
|
|
94
|
+
`${JSON.stringify({extends: '../tsconfig.json', include: ['**/*']})}\n`,
|
|
95
|
+
);
|
|
88
96
|
write(
|
|
89
97
|
'package.json',
|
|
90
98
|
JSON.stringify({
|
|
@@ -282,25 +290,42 @@ describe('public imports: component doc import', () => {
|
|
|
282
290
|
);
|
|
283
291
|
});
|
|
284
292
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
293
|
+
// One whole check per case, so each has the full test budget: the four
|
|
294
|
+
// run back to back took most of one budget alone and timed out under load.
|
|
295
|
+
describe('lists its findings only: neither validate nor --strict counts or fails on them', () => {
|
|
296
|
+
beforeEach(() => {
|
|
297
|
+
pkg(p => {
|
|
298
|
+
delete p.exports['./components/AcmeWidget'];
|
|
299
|
+
});
|
|
300
|
+
write(
|
|
301
|
+
'templates/account-card.tsx',
|
|
302
|
+
"import {X} from '../components/AcmeWidget';\nexport default function A() {\n return <X />;\n}\n",
|
|
303
|
+
);
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
it('validate lists them as notes, with no severity, and counts none as an issue', async () => {
|
|
307
|
+
const validated = await validateLocalIntegration(dir);
|
|
308
|
+
const notes = (validated.notes ?? []).filter(note =>
|
|
309
|
+
CODES.has(note.code),
|
|
310
|
+
);
|
|
311
|
+
expect(notes.length).toBeGreaterThan(2);
|
|
312
|
+
expect(notes.every(note => !('severity' in note))).toBe(true);
|
|
313
|
+
expect(validated.issues.filter(issue => CODES.has(issue.code))).toEqual(
|
|
314
|
+
[],
|
|
315
|
+
);
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
it('the integration check counts none of them', async () => {
|
|
319
|
+
const plain = await integrationCheck({cwd: dir});
|
|
320
|
+
expect(plain.data.errors).toBe(0);
|
|
321
|
+
expect(plain.data.warnings).toBe(0);
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
it('--strict fails on none of them', async () => {
|
|
325
|
+
const strict = await integrationCheck({cwd: dir, strict: true});
|
|
326
|
+
expect(strict.data.failed).toBe(false);
|
|
327
|
+
expect(strict.data.failures).toEqual([]);
|
|
288
328
|
});
|
|
289
|
-
write(
|
|
290
|
-
'templates/account-card.tsx',
|
|
291
|
-
"import {X} from '../components/AcmeWidget';\nexport default function A() {\n return <X />;\n}\n",
|
|
292
|
-
);
|
|
293
|
-
const issues = await found();
|
|
294
|
-
expect(issues.length).toBeGreaterThan(2);
|
|
295
|
-
expect(issues.every(i => !('severity' in i))).toBe(true);
|
|
296
|
-
const validated = await validateLocalIntegration(dir);
|
|
297
|
-
expect(validated.issues.filter(issue => CODES.has(issue.code))).toEqual([]);
|
|
298
|
-
const plain = await integrationCheck({cwd: dir});
|
|
299
|
-
expect(plain.data.errors).toBe(0);
|
|
300
|
-
expect(plain.data.warnings).toBe(0);
|
|
301
|
-
const strict = await integrationCheck({cwd: dir, strict: true});
|
|
302
|
-
expect(strict.data.failed).toBe(false);
|
|
303
|
-
expect(strict.data.failures).toEqual([]);
|
|
304
329
|
});
|
|
305
330
|
|
|
306
331
|
it('flags a require-only condition', async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6-canary.39a40e9",
|
|
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",
|
|
@@ -111,10 +111,10 @@
|
|
|
111
111
|
"zod": "^4.4.3"
|
|
112
112
|
},
|
|
113
113
|
"peerDependencies": {
|
|
114
|
-
"@astryxdesign/charts": "
|
|
115
|
-
"@astryxdesign/core": "
|
|
116
|
-
"@astryxdesign/lab": "
|
|
117
|
-
"@astryxdesign/theme-neutral": "
|
|
114
|
+
"@astryxdesign/charts": "0.7.6-canary.39a40e9",
|
|
115
|
+
"@astryxdesign/core": "0.7.6-canary.39a40e9",
|
|
116
|
+
"@astryxdesign/lab": "0.7.6-canary.39a40e9",
|
|
117
|
+
"@astryxdesign/theme-neutral": "0.7.6-canary.39a40e9"
|
|
118
118
|
},
|
|
119
119
|
"peerDependenciesMeta": {
|
|
120
120
|
"@astryxdesign/charts": {
|
|
@@ -131,10 +131,10 @@
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
"devDependencies": {
|
|
134
|
-
"@astryxdesign/charts": "
|
|
135
|
-
"@astryxdesign/core": "
|
|
136
|
-
"@astryxdesign/lab": "
|
|
137
|
-
"@astryxdesign/theme-neutral": "
|
|
134
|
+
"@astryxdesign/charts": "0.7.6-canary.39a40e9",
|
|
135
|
+
"@astryxdesign/core": "0.7.6-canary.39a40e9",
|
|
136
|
+
"@astryxdesign/lab": "0.7.6-canary.39a40e9",
|
|
137
|
+
"@astryxdesign/theme-neutral": "0.7.6-canary.39a40e9",
|
|
138
138
|
"@heroicons/react": "^2.2.0",
|
|
139
139
|
"@stylexjs/stylex": "^0.19.0",
|
|
140
140
|
"@types/babel__core": "^7.20.5",
|