aboutsummaryrefslogtreecommitdiffstats
path: root/packages/monorepo-scripts/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-22 01:49:56 +0800
committerFabio Berger <me@fabioberger.com>2018-08-22 01:49:56 +0800
commit8bb7b5b543c4d914067b6bbb269be9cc2ac7f647 (patch)
tree8148028d1a7d621b27e54b948cdb8fa2d3dca708 /packages/monorepo-scripts/src
parent809d301d582a01ff70958f380a7f8c4afe898366 (diff)
downloaddexon-sol-tools-8bb7b5b543c4d914067b6bbb269be9cc2ac7f647.tar
dexon-sol-tools-8bb7b5b543c4d914067b6bbb269be9cc2ac7f647.tar.gz
dexon-sol-tools-8bb7b5b543c4d914067b6bbb269be9cc2ac7f647.tar.bz2
dexon-sol-tools-8bb7b5b543c4d914067b6bbb269be9cc2ac7f647.tar.lz
dexon-sol-tools-8bb7b5b543c4d914067b6bbb269be9cc2ac7f647.tar.xz
dexon-sol-tools-8bb7b5b543c4d914067b6bbb269be9cc2ac7f647.tar.zst
dexon-sol-tools-8bb7b5b543c4d914067b6bbb269be9cc2ac7f647.zip
Add shouldUpload flag to docGenAndUpload command
Diffstat (limited to 'packages/monorepo-scripts/src')
-rw-r--r--packages/monorepo-scripts/src/doc_generate_and_upload.ts9
-rw-r--r--packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts9
2 files changed, 16 insertions, 2 deletions
diff --git a/packages/monorepo-scripts/src/doc_generate_and_upload.ts b/packages/monorepo-scripts/src/doc_generate_and_upload.ts
index 602247972..77dc2f323 100644
--- a/packages/monorepo-scripts/src/doc_generate_and_upload.ts
+++ b/packages/monorepo-scripts/src/doc_generate_and_upload.ts
@@ -13,12 +13,19 @@ const args = yargs
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);
+ const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(packageName, isStaging, shouldUploadDocs);
await docGenerateAndUploadUtils.generateAndUploadDocsAsync();
})();
diff --git a/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts b/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts
index cc4d70d63..7e8bd07da 100644
--- a/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts
+++ b/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts
@@ -12,6 +12,7 @@ import { utils } from './utils';
export class DocGenerateAndUploadUtils {
private _isStaging: boolean;
+ private _shouldUploadDocs: boolean;
private _packageName: string;
private _omitExports: string[];
private _packagePath: string;
@@ -155,9 +156,10 @@ export class DocGenerateAndUploadUtils {
};
return exportInfo;
}
- constructor(packageName: string, isStaging: boolean) {
+ constructor(packageName: string, isStaging: boolean, shouldUploadDocs: boolean) {
this._isStaging = isStaging;
this._packageName = packageName;
+ this._shouldUploadDocs = shouldUploadDocs;
this._packagePath = `${constants.monorepoRootPath}/packages/${packageName}`;
this._monoRepoPkgNameToPath = {};
@@ -268,6 +270,11 @@ export class DocGenerateAndUploadUtils {
};
writeFileSync(jsonFilePath, JSON.stringify(docJson, null, 2));
+ if (this._shouldUploadDocs) {
+ await this._uploadDocsAsync(jsonFilePath, cwd);
+ }
+ }
+ private async _uploadDocsAsync(jsonFilePath: string, cwd: string) {
const fileName = `v${this._packageJson.version}.json`;
utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`);