Skip to content

Commit

Permalink
0.4.3: add pnpm override diff
Browse files Browse the repository at this point in the history
  • Loading branch information
aruniverse committed Mar 17, 2022
1 parent ff34381 commit 7ec3f94
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
22 changes: 21 additions & 1 deletion cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,34 @@ const overridePnpm = async () => {
}, {});

const pkgJsonData = await fs.readJSON(pkgJsonPath);
const prev = Object.keys(pkgJsonData.pnpm.overrides);
const next = Object.keys(overrides);

pkgJsonData.pnpm.overrides = overrides;

await fs.writeJSON(pkgJsonPath, pkgJsonData, { spaces: 2 });

console.log(
"Your CoSpace's workspace links have been overriden. Run `pnpm install`, `pnpm build` and you're good to go!"
);

const removed = prev.filter((name) => !next.includes(name));
const added = next.filter((name) => !prev.includes(name));

if (removed.length) {
console.log(
`\nYou removed the following packages from your CoSpace:\n- ${removed.join(
"\n- "
)}`
);
}
if (added.length) {
console.log(
`\nYou added the following packages to your CoSpace:\n- ${added.join(
"\n- "
)}`
);
}

};

const purge = async () => {
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cospace",
"version": "0.4.2",
"version": "0.4.3",
"description": "Setup a `CoSpace` to link multiple (mono)repos together!",
"author": "https://github.com/aruniverse",
"license": "MIT",
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
"init:test": "cospace init test",
"purge": "cospace purge",
"setOverrides": "cospace override",
"list-pkgs": "pnpm ls -r --depth -1"
},
"packageManager": "[email protected]",
Expand Down

0 comments on commit 7ec3f94

Please sign in to comment.