Skip to content

Commit

Permalink
chore: update ship.config.js (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunjae Lee authored Sep 6, 2019
1 parent aa96ca9 commit bd3d6c9
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions ship.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
const fs = require("fs");
const path = require("path");

module.exports = {
versionUpdated: ({ version, dir, exec }) => {
exec(`npx json -I -f lerna.json -e 'this.version = "${version}"'`);
exec(
`npx json -I -f packages/shipjs/package.json -e 'this.dependencies["shipjs-lib"] = "${version}"'`
);
exec(
`echo "export default '${version}';" > packages/shipjs/src/version.js`
// 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));

// update dependency
exec(`cd packages/shipjs && yarn add shipjs-lib@${version}`);

// update `version.js`
fs.writeFileSync(
path.resolve(dir, "packages/shipjs/src/version.js"),
"export default '${version}';"
);
},
beforeCommitChanges: ({ exec }) => {
Expand Down

0 comments on commit bd3d6c9

Please sign in to comment.