(packageJson)
| 71 | } |
| 72 | |
| 73 | const applyPublishConfig = (packageJson) => { |
| 74 | const { publishConfig, ...manifest } = packageJson |
| 75 | const versions = workspaceVersions() |
| 76 | |
| 77 | const staged = publishConfig === undefined |
| 78 | ? manifest |
| 79 | : { |
| 80 | ...manifest, |
| 81 | ...publishConfig |
| 82 | } |
| 83 | |
| 84 | delete staged.publishConfig |
| 85 | delete staged.directory |
| 86 | delete staged.executableFiles |
| 87 | delete staged.linkDirectory |
| 88 | |
| 89 | if (staged.scripts !== undefined) { |
| 90 | const { prepack: _, postpack: __, postpublish: ___, ...scripts } = staged.scripts |
| 91 | if (scripts.pub === "pnpm publish --access public") { |
| 92 | scripts.pub = "npm publish --access public" |
| 93 | } |
| 94 | staged.scripts = scripts |
| 95 | } |
| 96 | |
| 97 | for (const field of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) { |
| 98 | const dependencies = staged[field] |
| 99 | if (dependencies === undefined) continue |
| 100 | |
| 101 | for (const [name, specifier] of Object.entries(dependencies)) { |
| 102 | if (typeof specifier !== "string" || !specifier.startsWith("workspace:")) continue |
| 103 | |
| 104 | const version = versions.get(name) |
| 105 | if (version === undefined) { |
| 106 | throw new Error(`Cannot resolve workspace dependency ${name}`) |
| 107 | } |
| 108 | |
| 109 | const range = specifier.slice("workspace:".length) |
| 110 | delete dependencies[name] |
| 111 | dependencies[name] = range === "^" || range === "~" ? `${range}${version}` : version |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | return staged |
| 116 | } |
| 117 | |
| 118 | if (command === "prepack") { |
| 119 | const packageJson = JSON.parse(_fs.readFileSync(packageJsonPath, "utf8")) |
no test coverage detected
searching dependent graphs…