diff --git a/.changeset/sour-buttons-collect.md b/.changeset/sour-buttons-collect.md new file mode 100644 index 0000000000..09c7cfd167 --- /dev/null +++ b/.changeset/sour-buttons-collect.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +ensure that `productionPack` uses posix paths in `package.json` on all OSes diff --git a/.github/vale/Vocab/Backstage/accept.txt b/.github/vale/Vocab/Backstage/accept.txt index f058475367..83fba8aa56 100644 --- a/.github/vale/Vocab/Backstage/accept.txt +++ b/.github/vale/Vocab/Backstage/accept.txt @@ -267,6 +267,7 @@ permissioning plantuml Platformize Podman +posix postgres postpack pre diff --git a/package.json b/package.json index 8550a72a97..3825b2e64c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "dev": "concurrently \"yarn start\" \"yarn start-backend\"", "start": "yarn workspace example-app start", "start-backend": "yarn workspace example-backend start", - "build:backend": "yarn workspace backend build", + "build:backend": "yarn workspace example-backend build", "build:all": "backstage-cli repo build --all", "build:api-reports": "yarn build:api-reports:only --tsc", "build:api-reports:only": "backstage-repo-tools api-reports --allow-warnings 'packages/core-components,plugins/+(catalog|catalog-import|git-release-manager|jenkins|kubernetes)' -o ae-wrong-input-file-type --validate-release-tags", diff --git a/packages/cli/src/lib/packager/productionPack.ts b/packages/cli/src/lib/packager/productionPack.ts index a26f4893d0..30f4545b24 100644 --- a/packages/cli/src/lib/packager/productionPack.ts +++ b/packages/cli/src/lib/packager/productionPack.ts @@ -16,7 +16,7 @@ import fs from 'fs-extra'; import npmPackList from 'npm-packlist'; -import { join as joinPath, resolve as resolvePath } from 'path'; +import { resolve as resolvePath, posix as posixPath } from 'path'; import { ExtendedPackageJSON } from '../monorepo'; import { readEntryPoints } from '../monorepo/entryPoints'; @@ -142,7 +142,7 @@ export async function revertProductionPack(packageDir: string) { function resolveEntrypoint(pkg: any, name: string) { const targetEntry = pkg.publishConfig[name] || pkg[name]; - return targetEntry && joinPath('..', targetEntry); + return targetEntry && posixPath.join('..', targetEntry); } // Writes e.g. alpha/package.json @@ -160,7 +160,7 @@ async function writeReleaseStageEntrypoint( main: resolveEntrypoint(pkg, 'main'), module: resolveEntrypoint(pkg, 'module'), browser: resolveEntrypoint(pkg, 'browser'), - types: joinPath('..', pkg.publishConfig![`${stage}Types`]!), + types: posixPath.join('..', pkg.publishConfig![`${stage}Types`]!), }, { encoding: 'utf8', spaces: 2 }, ); @@ -202,7 +202,7 @@ async function prepareExportsEntryPoints( for (const [key, ext] of Object.entries(EXPORT_MAP)) { const name = `${entryPoint.name}${ext}`; if (distFiles.includes(name)) { - exp[key] = `./${joinPath(`dist`, name)}`; + exp[key] = `./${posixPath.join(`dist`, name)}`; } } exp.default = exp.require ?? exp.import; @@ -228,9 +228,9 @@ async function prepareExportsEntryPoints( { name: pkg.name, version: pkg.version, - ...(exp.default ? { main: joinPath('..', exp.default) } : {}), - ...(exp.import ? { module: joinPath('..', exp.import) } : {}), - ...(exp.types ? { types: joinPath('..', exp.types) } : {}), + ...(exp.default ? { main: posixPath.join('..', exp.default) } : {}), + ...(exp.import ? { module: posixPath.join('..', exp.import) } : {}), + ...(exp.types ? { types: posixPath.join('..', exp.types) } : {}), }, { encoding: 'utf8', spaces: 2 }, );