aboutsummaryrefslogtreecommitdiffstats
path: root/packages/monorepo-scripts/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-30 18:28:48 +0800
committerFabio Berger <me@fabioberger.com>2018-03-30 18:28:48 +0800
commitc9df3887316bdc0f7b19c87df21d566047445728 (patch)
tree7a4a08d7d811d22918caa552f8eaeb2863c53cfc /packages/monorepo-scripts/src
parent84b820abc62c0aabea974ab8ed22f3ada05240fb (diff)
downloaddexon-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')
-rw-r--r--packages/monorepo-scripts/src/custom_prepublish.ts19
-rw-r--r--packages/monorepo-scripts/src/globals.d.ts1
2 files changed, 14 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;
diff --git a/packages/monorepo-scripts/src/globals.d.ts b/packages/monorepo-scripts/src/globals.d.ts
index 90adc0b78..c5898d0f5 100644
--- a/packages/monorepo-scripts/src/globals.d.ts
+++ b/packages/monorepo-scripts/src/globals.d.ts
@@ -1,6 +1,7 @@
declare module 'async-child-process';
declare module 'publish-release';
declare module 'es6-promisify';
+declare module 'semver-diff';
// semver-sort declarations
declare module 'semver-sort' {