Skip to content

Commit 6bcaec7

Browse files
Better npm publish config #4
1 parent 294eee5 commit 6bcaec7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

scripts/publish-npm.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,14 @@ const publishPackage = ({ path, name }, shouldPublish) => {
136136

137137
console.log(`Publishing ${name}@${targetVersion} with dist-tag ${distTag}`);
138138
const npmEnv = { ...process.env };
139-
delete npmEnv.npm_config_workspace;
140-
delete npmEnv.npm_config_workspaces;
141-
delete npmEnv.npm_config_workspaces_enabled;
139+
for (const key of Object.keys(npmEnv)) {
140+
if (key.startsWith("npm_config_workspace") || key.startsWith("npm_config_workspaces")) {
141+
delete npmEnv[key];
142+
}
143+
}
144+
console.log(
145+
`npm_config_workspace=${process.env.npm_config_workspace || ""} npm_config_workspaces=${process.env.npm_config_workspaces || ""}`
146+
);
142147
pkgJson.version = targetVersion;
143148
writePackageJson(path, pkgJson);
144149
try {

0 commit comments

Comments
 (0)