|
1 | 1 | import { execSync } from "node:child_process"; |
2 | | -import { readFileSync, writeFileSync } from "node:fs"; |
| 2 | +import { mkdtempSync, readFileSync, writeFileSync } from "node:fs"; |
| 3 | +import { tmpdir } from "node:os"; |
3 | 4 | import { join } from "node:path"; |
4 | 5 |
|
5 | 6 | const ref = process.env.GITHUB_REF || ""; |
@@ -134,17 +135,18 @@ const publishPackage = ({ path, name }, shouldPublish) => { |
134 | 135 | } |
135 | 136 |
|
136 | 137 | console.log(`Publishing ${name}@${targetVersion} with dist-tag ${distTag}`); |
137 | | - const npmEnv = { |
138 | | - ...process.env, |
139 | | - npm_config_workspaces: "false", |
140 | | - npm_config_legacy_peer_deps: "true", |
141 | | - npm_config_ignore_workspace_root_check: "true", |
142 | | - }; |
| 138 | + const npmEnv = { ...process.env }; |
| 139 | + delete npmEnv.npm_config_workspace; |
| 140 | + delete npmEnv.npm_config_workspaces; |
| 141 | + delete npmEnv.npm_config_workspaces_enabled; |
143 | 142 | pkgJson.version = targetVersion; |
144 | 143 | writePackageJson(path, pkgJson); |
145 | 144 | try { |
146 | | - execSync(`npm publish --access public --tag ${distTag}`, { |
147 | | - cwd: path, |
| 145 | + const tgzName = run("npm pack --quiet", { cwd: path, env: npmEnv }); |
| 146 | + const tgzPath = join(path, tgzName); |
| 147 | + const publishCwd = mkdtempSync(join(tmpdir(), "rescript-mui-publish-")); |
| 148 | + execSync(`npm publish ${tgzPath} --access public --tag ${distTag}`, { |
| 149 | + cwd: publishCwd, |
148 | 150 | stdio: "inherit", |
149 | 151 | env: npmEnv, |
150 | 152 | }); |
|
0 commit comments