Skip to content

Commit 89522f6

Browse files
committed
test(cli): declare tsconfig.base.json as an input of the cli test task
The in-repo scaffold typecheck test copies the repo-root base into its sandbox, so check:cross-package-test-inputs requires the read declared: the cli roster glob, the turbo.json input, and the pinned root-file list. The test now reads the cli package's own typescript range instead of the root manifest and the sibling plugins. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019uZ84EhCM1NaBkJM8y1sjE
1 parent 27bcd6b commit 89522f6

5 files changed

Lines changed: 23 additions & 22 deletions

File tree

‎packages/cli/src/commands/create.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ export function objectstackDependencySpec(placement: ScaffoldPlacement): string
179179
* here, and never this range for `standalone`.
180180
*
181181
* `test/create-in-repo-scaffold-typechecks.test.ts` pins it equal to the range
182-
* the repository root and every sibling under `packages/plugins/` declare, so a
183-
* workspace TypeScript bump reddens there until this moves with it.
182+
* this package declares (the root and every sibling package declare the same
183+
* one), so a workspace TypeScript bump reddens there until this moves with it.
184184
*/
185185
export const IN_REPO_TYPESCRIPT_RANGE = '^6.0.3';
186186

‎packages/cli/test/create-in-repo-scaffold-typechecks.test.ts‎

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@
3434
*
3535
* The TypeScript VERSION a contributor installs cannot be spawned here without
3636
* an install, so the TS5103 half is pinned on the declaration instead: the
37-
* in-repo range is the workspace's range, and its floor is a major that
38-
* accepts the base's `ignoreDeprecations`. The standalone range is pinned
39-
* unchanged beside it.
37+
* in-repo range is the range this package declares for the very `tsc` the
38+
* cases spawn (the workspace's TypeScript, which the root and every sibling
39+
* declare too), and its floor is a major that accepts the base's
40+
* `ignoreDeprecations`. The standalone range is pinned unchanged beside it.
4041
*
4142
* ## The control
4243
*
@@ -56,9 +57,8 @@ import { SCAFFOLD_TYPESCRIPT_RANGE } from '../src/commands/init.js';
5657
import { childEnv } from './helpers/serve-process.js';
5758

5859
const HERE = path.dirname(fileURLToPath(import.meta.url));
59-
const REPO_ROOT = path.resolve(HERE, '../../..');
60+
const PKG = path.resolve(HERE, '..');
6061
const BASE_TSCONFIG = path.resolve(HERE, '../../..', 'tsconfig.base.json');
61-
const PLUGINS_DIR = path.resolve(HERE, '../../..', 'packages/plugins');
6262

6363
const require = createRequire(import.meta.url);
6464
const TSC = require.resolve('typescript/bin/tsc');
@@ -143,20 +143,10 @@ describe('os create plugin --in-repo: the scaffold passes its own scripts', () =
143143
});
144144

145145
describe('os create plugin: the TypeScript each placement declares', () => {
146-
it('in-repo declares the workspace\'s TypeScript, the range the root and every sibling plugin declare', () => {
147-
const root = JSON.parse(fs.readFileSync(path.join(REPO_ROOT, 'package.json'), 'utf8')) as Manifest;
148-
expect(manifestFor('in-repo').devDependencies.typescript).toBe(root.devDependencies.typescript);
149-
expect(IN_REPO_TYPESCRIPT_RANGE).toBe(root.devDependencies.typescript);
150-
151-
const siblings = fs
152-
.readdirSync(PLUGINS_DIR)
153-
.map((name) => path.join(PLUGINS_DIR, name, 'package.json'))
154-
.filter((file) => fs.existsSync(file))
155-
.map((file) => JSON.parse(fs.readFileSync(file, 'utf8')) as Partial<Manifest>)
156-
.map((pkg) => pkg.devDependencies?.typescript)
157-
.filter((range): range is string => typeof range === 'string');
158-
expect(siblings.length, 'no sibling under packages/plugins declares typescript').toBeGreaterThan(0);
159-
expect([...new Set(siblings)]).toEqual([IN_REPO_TYPESCRIPT_RANGE]);
146+
it('in-repo declares the workspace\'s TypeScript, the range of the tsc the cases above spawn', () => {
147+
const own = JSON.parse(fs.readFileSync(path.join(PKG, 'package.json'), 'utf8')) as Manifest;
148+
expect(manifestFor('in-repo').devDependencies.typescript).toBe(own.devDependencies.typescript);
149+
expect(IN_REPO_TYPESCRIPT_RANGE).toBe(own.devDependencies.typescript);
160150
});
161151

162152
it('in-repo\'s TypeScript floor accepts the base\'s ignoreDeprecations (TS5103)', () => {

‎scripts/check-cross-package-test-inputs.mjs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1458,8 +1458,11 @@ export const TOP_LEVEL_DIRECTORIES_AWAITING_IMPORT = Object.freeze({});
14581458
* Repo-root FILES declared as `$TURBO_ROOT$` inputs -- the fourth shape, pinned, not collected.
14591459
* `vitest.preset.mts` is the shared vitest preset the package configs re-export by
14601460
* relative import; it is the `test` task's input so an edit to it reruns their suites.
1461+
* `tsconfig.base.json` is `@objectstack/cli#test`'s: the in-repo scaffold test copies
1462+
* it into its sandbox. It is a turbo `globalDependencies` entry too, which this gate
1463+
* does not read, so the task declares it as well.
14611464
*/
1462-
export const TURBO_ROOT_FILE_INPUTS = Object.freeze(['sdui.manifest.json', 'vitest.preset.mts']);
1465+
export const TURBO_ROOT_FILE_INPUTS = Object.freeze(['sdui.manifest.json', 'tsconfig.base.json', 'vitest.preset.mts']);
14631466

14641467
/** `.` is the only regex metacharacter these names carry today; escape the class anyway. */
14651468
const TOP_LEVEL_ALTERNATION = RECOGNISED_TOP_LEVEL_DIRECTORIES

‎scripts/cross-package-test-inputs.mjs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,13 @@ export const CROSS_PACKAGE_TEST_INPUTS = {
728728
// their trees: the pin reads nothing else from either package.
729729
'packages/spec/src/data/hook.zod.ts',
730730
'packages/runtime/src/sandbox/body-runner.ts',
731+
// The repo-root base every package extends. test/create-in-repo-scaffold-typechecks.test.ts
732+
// copies it into a sandbox laid out like this repo and type-checks an
733+
// `os create plugin --in-repo` scaffold under it, so a strictness or
734+
// `ignoreDeprecations` change in the base is exactly what must re-run
735+
// this suite. It is a turbo `globalDependencies` entry as well, which
736+
// this roster does not read.
737+
'tsconfig.base.json',
731738
],
732739
heldBy: {
733740
// The parity pin joins each barrel path from `SCAFFOLD_WIRED_BARRELS`, a

‎turbo.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@
255255
"!**/node_modules/**",
256256
"$TURBO_ROOT$/scripts/nightly-tiers.mjs",
257257
"$TURBO_ROOT$/scripts/nightly-tiers.d.mts",
258+
"$TURBO_ROOT$/tsconfig.base.json",
258259
"$TURBO_ROOT$/packages/verify/src/**",
259260
"$TURBO_ROOT$/packages/plugins/plugin-security/src/**",
260261
"$TURBO_ROOT$/packages/services/service-cluster/src/**",

0 commit comments

Comments
 (0)