ensure that productionPack uses posix paths in package.json on all OSes

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2023-03-28 14:56:30 +02:00
parent 12f1a5feac
commit b588ab7397
4 changed files with 14 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
ensure that `productionPack` uses posix paths in `package.json` on all OSes
+1
View File
@@ -267,6 +267,7 @@ permissioning
plantuml
Platformize
Podman
posix
postgres
postpack
pre
+1 -1
View File
@@ -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",
@@ -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 },
);