Skip to content

Commit 2210f52

Browse files
committed
add postversion script to patch changesets
1 parent adc6b20 commit 2210f52

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"size": "filesize",
3030
"test": "jest",
3131
"version": "changeset version",
32+
"postversion": "node scripts/postversion.mjs",
3233
"version:experimental": "node scripts ./scripts/version experimental",
3334
"watch": "rollup -c -w"
3435
},

scripts/postversion.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import * as path from "path";
2+
import { createRequire } from "node:module";
3+
4+
const require = createRequire(import.meta.url);
5+
const jsonfile = require("jsonfile");
6+
7+
let file = path.join(
8+
process.cwd(),
9+
"packages/react-router-dom-v5-compat/package.json"
10+
);
11+
let json = await jsonfile.readFile(file);
12+
json.peerDependencies["react-router-dom"] = "4 || 5";
13+
await jsonfile.writeFile(file, json, { spaces: 2 });
14+
15+
console.log("Patched peerDependencies for react-router-dom-v5-compat");

0 commit comments

Comments
 (0)