Merge PTC cleanup and refresh CUA dependency graph
This commit is contained in:
commit
810fd8601f
2 files changed
-25
No files matched your search
@@ -1,9 +1,7 @@
|
||||
import { existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import ts from 'typescript'
|
||||
|
||||
import { RepositoryCleaner } from './clean.ts'
|
||||
|
||||
@@ -34,28 +32,6 @@ afterEach(() => {
|
||||
})
|
||||
|
||||
describe('RepositoryCleaner', () => {
|
||||
it('cleans the Desktop keyboard compiler output and its retired directory without deleting sibling files', async () => {
|
||||
const root = fixture()
|
||||
const configPath = fileURLToPath(new URL('../tsconfig.desktop-keyboard-tests.json', import.meta.url))
|
||||
const config = ts.readConfigFile(configPath, path => ts.sys.readFile(path)).config as { compilerOptions: { outDir: string } }
|
||||
write(join(root, 'tsconfig.json'), JSON.stringify({ files: [], references: [{ path: './tsconfig.desktop-keyboard-tests.json' }] }))
|
||||
write(join(root, 'tsconfig.desktop-keyboard-tests.json'), JSON.stringify({
|
||||
compilerOptions: { composite: true, emitDeclarationOnly: true, outDir: config.compilerOptions.outDir },
|
||||
files: ['keyboard.ts'],
|
||||
}))
|
||||
write(join(root, 'keyboard.ts'), 'export {}\n')
|
||||
write(join(root, config.compilerOptions.outDir, 'keyboard.d.ts'))
|
||||
write(join(root, 'lib/desktop-keyboard-test-types/keyboard.d.ts'))
|
||||
write(join(root, 'lib/retained.txt'), 'unrelated sibling')
|
||||
|
||||
await new RepositoryCleaner(root).clean()
|
||||
|
||||
expect(existsSync(join(root, 'lib/desktop-keyboard-tests'))).toBe(false)
|
||||
expect(existsSync(join(root, 'lib/desktop-keyboard-test-types'))).toBe(false)
|
||||
expect(existsSync(join(root, 'lib/retained.txt'))).toBe(true)
|
||||
expect(existsSync(join(root, 'keyboard.ts'))).toBe(true)
|
||||
})
|
||||
|
||||
it('derives live build outputs from project references and removes safe stale package residue', async () => {
|
||||
const root = fixture()
|
||||
addProject(root, 'products/shell')
|
||||
|
||||
@@ -72,7 +72,6 @@ export class RepositoryCleaner {
|
||||
|
||||
// These checks cover legacy root-level incremental state emitted by older configs.
|
||||
await this.addIfPresent(targets, join(this.root, '.typecheck'), canonicalRoot)
|
||||
await this.addIfPresent(targets, join(this.root, 'lib/desktop-keyboard-test-types'), canonicalRoot)
|
||||
for (const entry of await readdir(this.root, { withFileTypes: true })) {
|
||||
if (entry.isFile() && entry.name.endsWith('.tsbuildinfo')) targets.add(join(this.root, entry.name))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user