diff --git a/.changeset/polite-bulldogs-repeat.md b/.changeset/polite-bulldogs-repeat.md index 0b22398a55..32264b80c1 100644 --- a/.changeset/polite-bulldogs-repeat.md +++ b/.changeset/polite-bulldogs-repeat.md @@ -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. diff --git a/packages/cli/src/commands/build/buildBackend.ts b/packages/cli/src/commands/build/buildBackend.ts index e32b7956db..0768728f00 100644 --- a/packages/cli/src/commands/build/buildBackend.ts +++ b/packages/cli/src/commands/build/buildBackend.ts @@ -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, diff --git a/packages/cli/src/commands/build/command.ts b/packages/cli/src/commands/build/command.ts index 1189883b12..04b9893c31 100644 --- a/packages/cli/src/commands/build/command.ts +++ b/packages/cli/src/commands/build/command.ts @@ -26,14 +26,14 @@ export async function command(cmd: Command): Promise { 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), }); }