Add tsconfig to non monorepo plugin.

This commit is contained in:
Fabian Chong
2020-10-26 13:35:25 +08:00
parent 03b21ff56f
commit f09e6eb4ce
3 changed files with 20 additions and 5 deletions
+1 -5
View File
@@ -40,17 +40,13 @@ const fileHandlers = [
patterns: ['package.json'],
handler: handlers.packageJson,
},
{
patterns: ['tsconfig.json'],
handler: handlers.exactMatch,
},
{
// make sure files in 1st level of src/ and dev/ exist
patterns: ['.eslintrc.js', /^(src|dev)\/[^/]+$/],
handler: handlers.exists,
},
{
patterns: ['README.md', /^src\//],
patterns: ['README.md', 'tsconfig.json', /^src\//],
handler: handlers.skip,
},
];
+6
View File
@@ -20,6 +20,7 @@ import handlebars from 'handlebars';
import ora from 'ora';
import { basename, dirname } from 'path';
import recursive from 'recursive-readdir';
import { paths } from './paths';
const TASK_NAME_MAX_LENGTH = 14;
@@ -72,6 +73,7 @@ export async function templatingTask(
const files = await recursive(templateDir).catch(error => {
throw new Error(`Failed to read template directory: ${error.message}`);
});
const isMonoRepo = await fs.pathExists(paths.resolveTargetRoot('lerna.json'));
for (const file of files) {
const destinationFile = file.replace(templateDir, destinationDir);
@@ -92,6 +94,10 @@ export async function templatingTask(
});
});
} else {
if (isMonoRepo && file.match('tsconfig.json')) {
continue;
}
await Task.forItem('copying', basename(file), async () => {
await fs.copyFile(file, destinationFile).catch(error => {
const destination = destinationFile;
@@ -0,0 +1,13 @@
{
"extends": "@backstage/cli/config/tsconfig.json",
"include": [
"src",
"dev",
"migrations"
],
"exclude": ["node_modules"],
"compilerOptions": {
"outDir": "dist-types",
"rootDir": "."
}
}