Skip to content

Commit

Permalink
chore: update ship config (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunjae Lee authored Sep 8, 2019
1 parent c228772 commit 292625e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions ship.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ const path = require("path");

module.exports = {
versionUpdated: ({ version, dir, exec }) => {
const updateVersion = (filePath, expression) => {
exec(`npx json -I -f ${filePath} -e '${expression} = "${version}"'`);
};

// update lerna.json
const lernaConfigPath = path.resolve(dir, "lerna.json");
const lerna = JSON.parse(fs.readFileSync(lernaConfigPath).toString());
lerna.version = version;
fs.writeFileSync(lernaConfigPath, JSON.stringify(lerna, null, 2));
updateVersion("lerna.json", "this.version");

// update dependency
exec(`cd packages/shipjs && yarn add shipjs-lib@${version}`);
updateVersion(
"packages/shipjs/package.json",
'this.dependencies["shipjs-lib"]'
);

// update `version.js`
fs.writeFileSync(
Expand Down

0 comments on commit 292625e

Please sign in to comment.