Files
revanced-bots/patches/@semantic-release%2Fnpm@12.0.2.patch

61 lines
2.0 KiB
Diff

diff --git a/lib/prepare.js b/lib/prepare.js
index 3e76bec44cf595a1b4141728336bed904d4d518d..4b25ca64879bbee2a600f2b23b738c86136ad9c6 100644
--- a/lib/prepare.js
+++ b/lib/prepare.js
@@ -1,6 +1,7 @@
import path from "path";
-import { move } from "fs-extra";
+import { rename, readFile, writeFile } from "fs/promises";
import { execa } from "execa";
+import detectIndent from 'detect-indent';
export default async function (
npmrc,
@@ -11,19 +12,13 @@ export default async function (
logger.log("Write version %s to package.json in %s", version, basePath);
- const versionResult = execa(
- "npm",
- ["version", version, "--userconfig", npmrc, "--no-git-tag-version", "--allow-same-version"],
- {
- cwd: basePath,
- env,
- preferLocal: true,
- }
- );
- versionResult.stdout.pipe(stdout, { end: false });
- versionResult.stderr.pipe(stderr, { end: false });
+ const pkgJsonPath = path.join(basePath, 'package.json')
+ const pkgJsonRaw = (await readFile(pkgJsonPath)).toString()
+ const pkgJson = JSON.parse(pkgJsonRaw)
+ pkgJson.version = version
- await versionResult;
+ await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, detectIndent(pkgJsonRaw).indent))
+ await execa("bun", ["install"]);
if (tarballDir) {
logger.log("Creating npm package version %s", version);
@@ -38,7 +33,7 @@ export default async function (
// Only move the tarball if we need to
// Fixes: https://github.com/semantic-release/npm/issues/169
if (tarballSource !== tarballDestination) {
- await move(tarballSource, tarballDestination);
+ await rename(tarballSource, tarballDestination);
}
}
}
diff --git a/package.json b/package.json
index e716bf6b35130c168ab7c4babc89a0346aacc9ad..e372de1ca5967509a6769db88ff967e1039b03ac 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
"dependencies": {
"@semantic-release/error": "^4.0.0",
"aggregate-error": "^5.0.0",
+ "detect-indent": "^7.0.1",
"execa": "^9.0.0",
"fs-extra": "^11.0.0",
"lodash-es": "^4.17.21",