cli: fix incorrect target package for app and backend build

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-02-14 22:51:47 +01:00
parent d9aa726fe1
commit 51ce07f0fe
3 changed files with 9 additions and 6 deletions
+2
View File
@@ -9,3 +9,5 @@ Renamed the `backstage-cli migrate package-role` command to `backstage-cli migra
Updated the package role definitions by renaming `plugin-frontend` to `frontend-plugin`, as well as the same reshuffle to `frontend-plugin-module`, `backend-plugin`, and `backend-plugin-module`.
The `backstage-cli migrate package-scripts` received several tweaks to make it more accurate. It now tries to maintain existing script arguments, like `--config` parameters for `build` and `start` scripts.
The `backstage-cli script build` command set an incorrect target directory for `app` and `backend` packages, which has been fixed.
@@ -49,19 +49,20 @@ export async function buildBackend(options: BuildBackendOptions) {
// We built the target backend package using the regular build process, but the result of
// that has now been packed into the dist workspace, so clean up the dist dir.
await fs.remove(targetDir);
await fs.mkdir(targetDir);
const distDir = resolvePath(targetDir, 'dist');
await fs.remove(distDir);
await fs.mkdir(distDir);
// Move out skeleton.tar.gz before we create the main bundle, no point having that included up twice.
await fs.move(
resolvePath(tmpDir, SKELETON_FILE),
resolvePath(targetDir, SKELETON_FILE),
resolvePath(distDir, SKELETON_FILE),
);
// Create main bundle.tar.gz, with some tweaks to make it more likely hit Docker build cache.
await tar.create(
{
file: resolvePath(targetDir, BUNDLE_FILE),
file: resolvePath(distDir, BUNDLE_FILE),
cwd: tmpDir,
portable: true,
noMtime: true,
+2 -2
View File
@@ -26,14 +26,14 @@ export async function command(cmd: Command): Promise<void> {
if (role === 'app') {
return buildApp({
targetDir: paths.resolveTarget('dist'),
targetDir: paths.targetDir,
configPaths: cmd.config as string[],
writeStats: Boolean(cmd.stats),
});
}
if (role === 'backend') {
return buildBackend({
targetDir: paths.resolveTarget('dist'),
targetDir: paths.targetDir,
skipBuildDependencies: Boolean(cmd.skipBuildDependencies),
});
}