Skip to content

Commit

Permalink
Update: Remove config key if set
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnitto committed Oct 17, 2023
1 parent f0c1630 commit 14d24a0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion setPackageManager.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
const { scripts } = require("../../package.json");
const { scripts, config } = require("../../package.json");
const { execSync } = require("child_process");

const newPackageManager = process.argv[2];
const packageManagers = ["pnpm", "npm", "yarn"];

if (config?.packageManager) {
const isAlone = Object.keys(config).length == 1;
if (isAlone) {
execSync("npm pkg delete config");
} else {
execSync("npm pkg delete config.packageManager");
}
}

if (!newPackageManager) {
errorMessage("Please specify a package manager as an argument.");
}
Expand Down

0 comments on commit 14d24a0

Please sign in to comment.