Skip to content

Commit a9326d7

Browse files
Better npm publish config
1 parent 257be83 commit a9326d7

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

scripts/publish-npm.mjs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,18 @@ const publishPackage = ({ path, name }, shouldPublish) => {
128128
}
129129

130130
console.log(`Publishing ${name}@${targetVersion} with dist-tag ${distTag}`);
131+
const npmEnv = {
132+
...process.env,
133+
npm_config_workspaces: "false",
134+
npm_config_legacy_peer_deps: "true",
135+
npm_config_ignore_workspace_root_check: "true",
136+
};
131137
execSync(`npm version --no-git-tag-version ${targetVersion}`, { cwd: path });
132-
execSync(
133-
`npm publish --access public --tag ${distTag} --workspaces=false --legacy-peer-deps`,
134-
{
135-
cwd: path,
136-
stdio: "inherit",
137-
}
138-
);
138+
execSync(`npm publish --access public --tag ${distTag}`, {
139+
cwd: path,
140+
stdio: "inherit",
141+
env: npmEnv,
142+
});
139143
execSync(`git checkout -- package.json`, { cwd: path });
140144
};
141145

0 commit comments

Comments
 (0)