aboutsummaryrefslogtreecommitdiffstats
path: root/packages/monorepo-scripts/src/publish_release_notes.ts
blob: 297eb3d5046db33bc49b9660af369e3428dc0916 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import * as _ from 'lodash';
import * as yargs from 'yargs';

import { publishReleaseNotesAsync } from './utils/github_release_utils';
import { utils } from './utils/utils';

const args = yargs
    .option('isDryRun', {
        describe: 'Whether we wish to do a dry run, not committing anything to Github',
        type: 'boolean',
        demandOption: true,
    })
    .option('packages', {
        describe:
            'Space-separated list of packages to generated release notes for. If not supplied, it does all `Lerna updated` packages.',
        type: 'string',
    })
    .example('$0 --isDryRun true --packages "0x.js @0x/web3-wrapper"', 'Full usage example').argv;

(async () => {
    const isDryRun = args.isDryRun;
    let packages;
    if (_.isUndefined(args.packages)) {
        const shouldIncludePrivate = false;
        packages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
    } else {
        const packageNames = args.packages.split(' ');
        packages = await utils.getPackagesByNameAsync(packageNames);
    }

    await publishReleaseNotesAsync(packages, isDryRun);
    process.exit(0);
})().catch(err => {
    utils.log(err);
    process.exit(1);
});