fix plugin template verification

This commit is contained in:
Fabian Chong
2020-09-16 14:06:14 +08:00
parent 39f77fc436
commit 903c9d9c63
4 changed files with 4 additions and 29 deletions
@@ -233,11 +233,11 @@ export default async (cmd: Command) => {
? `"${scopeName}:registry": "${cmd.npmRegistry}"`
: '';
const privatePackage = cmd.private === false ? false : true;
const isMonoRepo = await fs.pathExists(paths.resolveTargetRoot('lerna.json'));
const appPackage = paths.resolveTargetRoot('packages/app');
const templateDir = paths.resolveOwn('templates/default-plugin');
const tempDir = resolvePath(os.tmpdir(), answers.id);
const pluginDir = (await fs.pathExists(paths.resolveTargetRoot('lerna.json')))
const pluginDir = isMonoRepo
? paths.resolveTargetRoot('plugins', answers.id)
: paths.resolveTargetRoot(answers.id);
const ownerIds = parseOwnerIds(answers.owner);
-14
View File
@@ -19,7 +19,6 @@ import fs from 'fs-extra';
import handlebars from 'handlebars';
import ora from 'ora';
import { basename, dirname } from 'path';
import { paths } from './paths';
import recursive from 'recursive-readdir';
const TASK_NAME_MAX_LENGTH = 14;
@@ -74,8 +73,6 @@ export async function templatingTask(
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);
await fs.ensureDir(dirname(destinationFile));
@@ -94,17 +91,6 @@ export async function templatingTask(
);
});
});
} else {
if (isMonoRepo && basename(file) === 'tsconfig.json') continue;
await Task.forItem('copying', basename(file), async () => {
await fs.copyFile(file, destinationFile).catch(error => {
const destination = destinationFile;
throw new Error(
`Failed to copy file to ${destination} : ${error.message}`,
);
});
});
}
}
}
@@ -4,7 +4,8 @@
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"private": {{privatePackage}},
{{#if privatePackage}} "private": {{privatePackage}},
{{/if}}
"publishConfig": {
{{#if npmRegistry}} {{{npmRegistry}}},
{{/if}}
@@ -1,12 +0,0 @@
{
"extends": "@backstage/cli/config/tsconfig.json",
"include": [
"src",
"dev",
"migrations"
],
"compilerOptions": {
"outDir": "dist-types",
"rootDir": "."
}
}