Skip to content

Commit

Permalink
fix: patch semantic-release/npm
Browse files Browse the repository at this point in the history
  • Loading branch information
hongaar committed Nov 24, 2022
1 parent 37282b2 commit 3479aa5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"repository": "https://github.com/hongaar/moker",
"author": "[email protected]",
"license": "MIT",
"type": "module",
"workspaces": [
"packages/*"
],
Expand All @@ -22,7 +23,7 @@
"test": "yarn workspaces foreach --topological --verbose run test",
"watch:build": "yarn workspaces foreach --parallel --interlaced run watch:build",
"watch:test": "yarn workspaces foreach --parallel --interlaced run watch:test",
"postinstall": "husky install",
"postinstall": "husky install && node scripts/postinstall.js",
"format": "prettier --write --ignore-unknown .",
"doctoc": "doctoc README.md",
"leasot": "leasot --exit-nicely --reporter markdown --ignore \"**/node_modules\" \"**/*.ts\" > TODO.md",
Expand Down
19 changes: 19 additions & 0 deletions scripts/patch-semantic-commit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import fs from "node:fs";
import { join } from "node:path";

const path = join(
"node_modules",
"@semantic-release",
"npm",
"lib",
"verify-auth.js"
);

export function patchSemanticCommit() {
const contents = fs.readFileSync(path, "utf8");
const patched = contents.replace(
`execa('npm', ['whoami', '--userconfig', npmrc, '--registry', registry]`,
`execa('npm', ['whoami', '--userconfig', npmrc, '--registry', registry, '--no-workspaces']`
);
fs.writeFileSync(path, patched, "utf8");
}
3 changes: 3 additions & 0 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { patchSemanticCommit } from "./patch-semantic-commit.js";

patchSemanticCommit();

0 comments on commit 3479aa5

Please sign in to comment.