Skip to content

Commit

Permalink
0.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
aruniverse committed Jun 18, 2022
1 parent d051ca5 commit c6d374b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"cospace"
]
}
14 changes: 9 additions & 5 deletions cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const help = `
Commands:
${Commands.INIT} <dir> Initialize a new CoSpace
If <dir> is not provided, will default to current dir
If <dir> is not provided, will default to the current directory
${Commands.OVERRIDE} Override the CoSpace's pnpm config
${Commands.PURGE} Purge all node_modules from the CoSpace
Expand All @@ -42,7 +42,7 @@ const checkPnpmInstalled = () => {

const init = async (cospaceDir = ".") => {
const relativeDir = path.relative(process.cwd(), cospaceDir);
if (relativeDir !== "") {
if (!relativeDir) {
if (fs.existsSync(cospaceDir)) {
console.log(
`️Oops, "${relativeDir}" already exists. Please try again with a different directory.`
Expand Down Expand Up @@ -90,9 +90,13 @@ const overridePnpm = async () => {
}, {});

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

if (!pkgJsonData.pnpm) {
pkgJsonData.pnpm = {};
}

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

Expand All @@ -112,7 +116,7 @@ const overridePnpm = async () => {
}
if (added.length) {
console.log(
`\nYou added the following packages to your CoSpace:\n- ${added.join(
`\nYou added the following packages to your CoSpace:\n+ ${added.join(
"\n+ "
)}`
);
Expand Down Expand Up @@ -160,7 +164,7 @@ const run = async () => {
return await purge();
default:
console.error(
`Unrecognized command, ${input[0]}, please try again with --help for more info.`
`Unrecognized command, "${input[0]}", please try again with --help for more info.`
);
}
};
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.4",
"version": "0.4.5",
"description": "Setup a `CoSpace` to link multiple (mono)repos together!",
"author": "https://github.com/aruniverse",
"homepage": "https://aruniverse.github.io/cospace/",
Expand Down

0 comments on commit c6d374b

Please sign in to comment.