diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-30 18:28:48 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-30 18:28:48 +0800 |
commit | c9df3887316bdc0f7b19c87df21d566047445728 (patch) | |
tree | 7a4a08d7d811d22918caa552f8eaeb2863c53cfc /packages/monorepo-scripts/src/custom_prepublish.ts | |
parent | 84b820abc62c0aabea974ab8ed22f3ada05240fb (diff) | |
download | dexon-0x-contracts-c9df3887316bdc0f7b19c87df21d566047445728.tar dexon-0x-contracts-c9df3887316bdc0f7b19c87df21d566047445728.tar.gz dexon-0x-contracts-c9df3887316bdc0f7b19c87df21d566047445728.tar.bz2 dexon-0x-contracts-c9df3887316bdc0f7b19c87df21d566047445728.tar.lz dexon-0x-contracts-c9df3887316bdc0f7b19c87df21d566047445728.tar.xz dexon-0x-contracts-c9df3887316bdc0f7b19c87df21d566047445728.tar.zst dexon-0x-contracts-c9df3887316bdc0f7b19c87df21d566047445728.zip |
Add committing and pushing CHANGELOG changes to Github
Diffstat (limited to 'packages/monorepo-scripts/src/custom_prepublish.ts')
-rw-r--r-- | packages/monorepo-scripts/src/custom_prepublish.ts | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/packages/monorepo-scripts/src/custom_prepublish.ts b/packages/monorepo-scripts/src/custom_prepublish.ts index 98ed3e8d3..2e6b78a71 100644 --- a/packages/monorepo-scripts/src/custom_prepublish.ts +++ b/packages/monorepo-scripts/src/custom_prepublish.ts @@ -12,8 +12,10 @@ import semverSort = require('semver-sort'); import { Changelog, Changes, UpdatedPackage } from './types'; import { utils } from './utils'; +const IS_DRY_RUN = true; const MONOREPO_ROOT_PATH = path.join(__dirname, '../../..'); const TODAYS_TIMESTAMP = moment().unix(); +const LERNA_EXECUTABLE = './node_modules/lerna/bin/lerna.js'; (async () => { const updatedPublicPackages = await getPublicLernaUpdatedPackagesAsync(); @@ -73,18 +75,23 @@ const TODAYS_TIMESTAMP = moment().unix(); const changelogMdPath = path.join(lernaPackage.location, 'CHANGELOG.md'); fs.writeFileSync(changelogMdPath, changelogMd); }); - utils.log(`All CHANGELOGS successfully updated. Please commit and push these changes to development.`); - utils.log(`New package versions are:`); - _.each(packageToVersionChange, (versionChange: string, pkgName: string) => { - utils.log(`${pkgName}: ${versionChange}`); - }); + + if (!IS_DRY_RUN) { + await execAsync(`git add . --all`, { cwd: MONOREPO_ROOT_PATH }); + await execAsync(`git commit -m "Updated CHANGELOGS"`, { cwd: MONOREPO_ROOT_PATH }); + await execAsync(`git push`, { cwd: MONOREPO_ROOT_PATH }); + } + + // _.each(packageToVersionChange, (versionChange: string, pkgName: string) => { + // utils.log(`${pkgName}: ${versionChange}`); + // }); })().catch(err => { utils.log(err); process.exit(1); }); async function getPublicLernaUpdatedPackagesAsync(): Promise<UpdatedPackage[]> { - const result = await execAsync(`./node_modules/lerna/bin/lerna.js updated --json`, { cwd: MONOREPO_ROOT_PATH }); + const result = await execAsync(`${LERNA_EXECUTABLE} updated --json`, { cwd: MONOREPO_ROOT_PATH }); const updatedPackages = JSON.parse(result.stdout); const updatedPublicPackages = _.filter(updatedPackages, updatedPackage => !updatedPackage.private); return updatedPublicPackages; |