aboutsummaryrefslogtreecommitdiffstats
path: root/packages/monorepo-scripts/src/doc_generate_and_upload.ts
blob: 4c4a72701649f93e761c6d52106c7c5efd50ae36 (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
37
import * as yargs from 'yargs';

import { DocGenerateAndUploadUtils } from './utils/doc_generate_and_upload_utils';
import { utils } from './utils/utils';

const args = yargs
    .option('package', {
        describe: 'Monorepo sub-package for which to generate DocJSON',
        type: 'string',
        demandOption: true,
    })
    .option('isStaging', {
        describe: 'Whether we wish to publish docs to staging or production',
        type: 'boolean',
        demandOption: true,
    })
    .option('shouldUpload', {
        describe: 'Whether we wish to upload the docs to S3 or not',
        type: 'boolean',
        demandOption: false,
        default: true,
    })
    .example("$0 --package '0x.js' --isStaging true", 'Full usage example').argv;

(async () => {
    const packageName = args.package;
    const isStaging = args.isStaging;
    const shouldUploadDocs = args.shouldUpload;

    const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(packageName, isStaging, shouldUploadDocs);
    await docGenerateAndUploadUtils.generateAndUploadDocsAsync();

    process.exit(0);
})().catch(err => {
    utils.log(err);
    process.exit(1);
});