Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-marechal committed Sep 24, 2021
1 parent ded917a commit 1de2cbf
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions dev-packages/ext-scripts/theia-ts-clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,23 @@ async function tsClean() {
debug(`"${root}" is not a directory, skipping...`);
return;
}
const tsconfig = path.resolve(root, 'tsconfig.json');
if (!await exists(tsconfig)) {
const tsconfigPath = path.resolve(root, 'tsconfig.json');
if (!await exists(tsconfigPath)) {
debug(`"${root}" is not a TypeScript package, skipping...`);
return;
}
const { compilerOptions } = await fs.promises.readFile(tsconfig, 'utf8').then(JSON.parse);
const src = path.resolve(root, compilerOptions.rootDir);
const dst = path.resolve(root, compilerOptions.outDir);
const {
compilerOptions: {
outDir = undefined,
rootDir = undefined,
} = {},
} = await fs.promises.readFile(tsconfigPath, 'utf8').then(JSON.parse);
if (typeof outDir !== 'string' || typeof rootDir !== 'string') {
debug(`"${tsconfigPath}" doesn't look like a compilation configuration, skipping...`);
return;
}
const src = path.resolve(root, rootDir);
const dst = path.resolve(root, outDir);
await watch
? tsCleanWatch(src, dst, dry)
: tsCleanRun(src, dst, dry);
Expand Down

0 comments on commit 1de2cbf

Please sign in to comment.