refactor(landlock-run): unify workspace release (review round 1)

This commit is contained in:
Hypatia May
2026-08-06 10:23:26 +08:00
parent e88bace07e
commit 598f9719f4
40 changed files with 535 additions and 530 deletions

View File

@@ -18,10 +18,10 @@ function write(path: string, content = ''): void {
writeFileSync(path, content)
}
function addProject(root: string, path: string): void {
function addProject(root: string, path: string, outDir = 'lib/types'): void {
write(join(root, 'tsconfig.json'), JSON.stringify({ files: [], references: [{ path }] }))
write(join(root, path, 'tsconfig.json'), JSON.stringify({
compilerOptions: { composite: true, outDir: 'lib/types' },
compilerOptions: { composite: true, outDir },
include: ['src'],
}))
write(join(root, path, 'src/index.ts'), 'export {}\n')
@@ -60,6 +60,18 @@ describe('RepositoryCleaner', () => {
expect(existsSync(join(root, 'products/shell/lib'))).toBe(true)
})
it('removes the native Landlock entry output that emits directly to lib', async () => {
const root = fixture()
const entry = 'native/landlock-run/packages/entry'
addProject(root, entry, 'lib')
write(join(root, entry, 'lib/index.js'))
await new RepositoryCleaner(root).clean()
expect(existsSync(join(root, entry, 'lib'))).toBe(false)
expect(existsSync(join(root, entry, 'src/index.ts'))).toBe(true)
})
it('refuses project outputs reached through a symlink outside the repository', async () => {
const root = fixture()
const externalProject = fixture()