chore: set up typeRoots for package tsconfig (#2286)
This commit is contained in:
Родитель
9f2bc41185
Коммит
d378b20110
|
@ -4,6 +4,16 @@ import * as path from 'path';
|
|||
const BASE_DIR = path.resolve(__dirname, '..');
|
||||
const PACKAGES_DIR = path.resolve(BASE_DIR, 'packages');
|
||||
|
||||
async function copyTSConfig(packageDir: string): Promise<void> {
|
||||
const relativeBaseDir = path.relative(packageDir, BASE_DIR);
|
||||
const tsconfig = await fs.readJson(path.resolve(BASE_DIR, 'tsconfig.json'));
|
||||
tsconfig.compilerOptions.typeRoots = [
|
||||
path.join(relativeBaseDir, 'node_modules', '@types'),
|
||||
path.join(relativeBaseDir, 'typings'),
|
||||
];
|
||||
await fs.writeJson(path.resolve(packageDir, 'tsconfig.json'), tsconfig, { spaces: 2 });
|
||||
}
|
||||
|
||||
(async () => {
|
||||
const dirsToLink = [];
|
||||
|
||||
|
@ -14,7 +24,7 @@ const PACKAGES_DIR = path.resolve(BASE_DIR, 'packages');
|
|||
}
|
||||
|
||||
for (const dir of dirsToLink) {
|
||||
await fs.copy(path.resolve(BASE_DIR, 'tsconfig.json'), path.resolve(dir, 'tsconfig.json'));
|
||||
await copyTSConfig(dir);
|
||||
await fs.copy(path.resolve(BASE_DIR, '.npmignore'), path.resolve(dir, '.npmignore'));
|
||||
const pj = await fs.readJson(path.resolve(dir, 'package.json'));
|
||||
if (pj.main) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче