Tools live under tools/<role>/<domain> (checks, generate, release, ci, dev), every tool is a workspace named @open-pencil/<domain>-tools, a shared tools/tsconfig.json backs the new check:tools gate that fixed 55 latent type errors, test:tools runs through bun --filter, the placement check is its own checks/test-homes package, and every tool resolves the repository through resolveWorkspaceRoot. Bun, Node, and mdast types live in a tools-root workspace so they never reach the app program.
50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
import { expect, test } from 'bun:test'
|
|
import { execFile } from 'node:child_process'
|
|
import { mkdtemp, rm, writeFile } from 'node:fs/promises'
|
|
import { tmpdir } from 'node:os'
|
|
import { join } from 'node:path'
|
|
import { promisify } from 'node:util'
|
|
|
|
import { resolveWorkspaceRoot } from '@open-pencil/package-artifacts-tools'
|
|
|
|
const execute = promisify(execFile)
|
|
const root = await resolveWorkspaceRoot(import.meta.dir)
|
|
|
|
test.each(['app-first', 'sdk-first'])(
|
|
'Vue module declarations preserve Storybook default args (%s)',
|
|
async (order) => {
|
|
const directory = await mkdtemp(join(tmpdir(), 'open-pencil-vue-module-'))
|
|
try {
|
|
const declarations = [join(root, 'src/env.d.ts'), join(root, 'packages/vue/src/global.d.ts')]
|
|
if (order === 'sdk-first') declarations.reverse()
|
|
const project = join(directory, 'tsconfig.json')
|
|
await writeFile(
|
|
project,
|
|
JSON.stringify({
|
|
extends: join(root, 'tsconfig.json'),
|
|
include: [],
|
|
files: [
|
|
...declarations,
|
|
join(root, 'src/components/ui/paint/FillSwatchTrigger.stories.ts')
|
|
]
|
|
})
|
|
)
|
|
const result = await execute(
|
|
process.execPath,
|
|
[
|
|
join(root, 'node_modules/@typescript/native-preview/bin/tsgo'),
|
|
'--noEmit',
|
|
'--project',
|
|
project
|
|
],
|
|
{ cwd: root, timeout: 20_000, maxBuffer: 2 * 1024 * 1024 }
|
|
)
|
|
expect(result.stdout).toBe('')
|
|
expect(result.stderr).toBe('')
|
|
} finally {
|
|
await rm(directory, { recursive: true, force: true })
|
|
}
|
|
},
|
|
30_000
|
|
)
|