aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-14 21:07:24 +0800
committerFabio Berger <me@fabioberger.com>2018-03-14 21:07:24 +0800
commitf7c1e10b5ac112866ee55e7fededdb37c890d30f (patch)
tree7ac70e30993ad4294cc080fd8f4316cee1e5e98c
parentdba1b8a7e92ebd18132e0e714d5109f87b9ab7a9 (diff)
downloaddexon-0x-contracts-f7c1e10b5ac112866ee55e7fededdb37c890d30f.tar
dexon-0x-contracts-f7c1e10b5ac112866ee55e7fededdb37c890d30f.tar.gz
dexon-0x-contracts-f7c1e10b5ac112866ee55e7fededdb37c890d30f.tar.bz2
dexon-0x-contracts-f7c1e10b5ac112866ee55e7fededdb37c890d30f.tar.lz
dexon-0x-contracts-f7c1e10b5ac112866ee55e7fededdb37c890d30f.tar.xz
dexon-0x-contracts-f7c1e10b5ac112866ee55e7fededdb37c890d30f.tar.zst
dexon-0x-contracts-f7c1e10b5ac112866ee55e7fededdb37c890d30f.zip
Move configuration into package.json configs section
-rw-r--r--packages/0x.js/package.json11
-rw-r--r--packages/0x.js/src/globals.d.ts1
-rw-r--r--packages/0x.js/src/monorepo_scripts/postpublish.ts27
-rw-r--r--packages/0x.js/src/monorepo_scripts/stagedocs.ts21
-rw-r--r--packages/abi-gen/src/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/assert/src/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/base-contract/src/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/chai-typescript-typings/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/connect/package.json9
-rw-r--r--packages/connect/src/monorepo_scripts/postpublish.ts26
-rw-r--r--packages/connect/src/monorepo_scripts/stagedocs.ts21
-rw-r--r--packages/deployer/src/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/dev-utils/src/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/json-schemas/src/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/monorepo-scripts/src/postpublish_utils.ts141
-rw-r--r--packages/react-docs/src/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/react-shared/src/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/sra-report/src/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/subproviders/src/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/tslint-config/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/types/src/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/utils/src/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/web3-typescript-typings/monorepo_scripts/postpublish.ts5
-rw-r--r--packages/web3-wrapper/src/monorepo_scripts/postpublish.ts5
26 files changed, 185 insertions, 162 deletions
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index ec55bf1af..f99029b53 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -31,7 +31,15 @@
"run_mocha": "mocha lib/test/**/*_test.js --timeout 10000 --bail --exit"
},
"config": {
- "artifacts": "TokenTransferProxy Exchange TokenRegistry Token EtherToken"
+ "artifacts": "TokenTransferProxy Exchange TokenRegistry Token EtherToken",
+ "postpublish": {
+ "assets": ["_bundles/index.js", "_bundles/index.min.js"],
+ "docPublishConfigs": {
+ "extraFileIncludes": ["../types/src/index.ts"],
+ "s3BucketPath": "s3://0xjs-docs-jsons/",
+ "s3StagingBucketPath": "s3://staging-0xjs-docs-jsons/"
+ }
+ }
},
"repository": {
"type": "git",
@@ -53,7 +61,6 @@
"@types/node": "^8.0.53",
"@types/sinon": "^2.2.2",
"@types/uuid": "^3.4.2",
- "async-child-process": "^1.1.1",
"awesome-typescript-loader": "^3.1.3",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
diff --git a/packages/0x.js/src/globals.d.ts b/packages/0x.js/src/globals.d.ts
index f37ac7cb0..e2c321f38 100644
--- a/packages/0x.js/src/globals.d.ts
+++ b/packages/0x.js/src/globals.d.ts
@@ -4,7 +4,6 @@ declare module 'dirty-chai';
declare module 'request-promise-native';
declare module 'web3-provider-engine';
declare module 'web3-provider-engine/subproviders/rpc';
-declare module 'async-child-process';
declare module 'publish-release';
// semver-sort declarations
diff --git a/packages/0x.js/src/monorepo_scripts/postpublish.ts b/packages/0x.js/src/monorepo_scripts/postpublish.ts
index 88be6444f..dcb99d0f7 100644
--- a/packages/0x.js/src/monorepo_scripts/postpublish.ts
+++ b/packages/0x.js/src/monorepo_scripts/postpublish.ts
@@ -1,29 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
-import { execAsync } from 'async-child-process';
-import * as _ from 'lodash';
import * as packageJSON from '../package.json';
-import * as tsConfig from '../tsconfig.json';
+import * as tsConfigJSON from '../tsconfig.json';
const cwd = `${__dirname}/..`;
-const subPackageName = (packageJSON as any).name;
-// Include any external packages that are part of the 0x.js public interface
-// to this array so that TypeDoc picks it up and adds it to the Docs JSON
-// So far, we only have @0xproject/types as part of 0x.js's public interface.
-const fileIncludes = [...(tsConfig as any).include, '../types/src/index.ts'];
-const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname);
-const S3BucketPath = 's3://0xjs-docs-jsons/';
-
-(async () => {
- const tagAndVersion = await postpublishUtils.getLatestTagAndVersionAsync(subPackageName);
- const tag = tagAndVersion.tag;
- const version = tagAndVersion.version;
-
- const releaseName = postpublishUtils.getReleaseName(subPackageName, version);
- const assets = [`${__dirname}/../_bundles/index.js`, `${__dirname}/../_bundles/index.min.js`];
- const release = await postpublishUtils.publishReleaseNotesAsync(tag, releaseName, assets);
-
- // tslint:disable-next-line:no-console
- console.log('POSTPUBLISH: Release successful, generating docs...');
- await postpublishUtils.generateAndUploadDocsAsync(__dirname, cwd, fileIncludesAdjusted, version, S3BucketPath);
-})().catch(console.error);
+// tslint:disable-next-line:no-floating-promises
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/0x.js/src/monorepo_scripts/stagedocs.ts b/packages/0x.js/src/monorepo_scripts/stagedocs.ts
index 525d6a96f..e732ac8eb 100644
--- a/packages/0x.js/src/monorepo_scripts/stagedocs.ts
+++ b/packages/0x.js/src/monorepo_scripts/stagedocs.ts
@@ -1,19 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
-import { execAsync } from 'async-child-process';
-import * as _ from 'lodash';
-import * as tsConfig from '../tsconfig.json';
+import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const cwd = __dirname + '/..';
-const S3BucketPath = 's3://staging-0xjs-docs-jsons/';
-// Include any external packages that are part of the 0x.js public interface
-// to this array so that TypeDoc picks it up and adds it to the Docs JSON
-// So far, we only have @0xproject/types as part of 0x.js's public interface.
-const fileIncludes = [...(tsConfig as any).include, '../types/src/index.ts'];
-const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname);
-const jsonFilePath = `${__dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`;
-const version = process.env.DOCS_VERSION || '0.0.0';
-
-(async () => {
- await postpublishUtils.generateAndUploadDocsAsync(__dirname, cwd, fileIncludesAdjusted, version, S3BucketPath);
-})().catch(console.error);
+const cwd = `${__dirname}/..`;
+// tslint:disable-next-line:no-floating-promises
+postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/abi-gen/src/monorepo_scripts/postpublish.ts b/packages/abi-gen/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/abi-gen/src/monorepo_scripts/postpublish.ts
+++ b/packages/abi-gen/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/assert/src/monorepo_scripts/postpublish.ts b/packages/assert/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/assert/src/monorepo_scripts/postpublish.ts
+++ b/packages/assert/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/base-contract/src/monorepo_scripts/postpublish.ts b/packages/base-contract/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/base-contract/src/monorepo_scripts/postpublish.ts
+++ b/packages/base-contract/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts b/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts
+++ b/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts b/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts
+++ b/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/connect/package.json b/packages/connect/package.json
index 0c4db7f60..8b3b24fcd 100644
--- a/packages/connect/package.json
+++ b/packages/connect/package.json
@@ -23,6 +23,15 @@
"test": "run-s clean build copy_test_fixtures run_mocha",
"test:circleci": "yarn test"
},
+ "config": {
+ "postpublish": {
+ "assets": ["_bundles/index.js", "_bundles/index.min.js"],
+ "docPublishConfigs": {
+ "s3BucketPath": "s3://connect-docs-jsons/",
+ "s3StagingBucketPath": "s3://staging-connect-docs-jsons/"
+ }
+ }
+ },
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
diff --git a/packages/connect/src/monorepo_scripts/postpublish.ts b/packages/connect/src/monorepo_scripts/postpublish.ts
index ecbd26872..dcb99d0f7 100644
--- a/packages/connect/src/monorepo_scripts/postpublish.ts
+++ b/packages/connect/src/monorepo_scripts/postpublish.ts
@@ -1,28 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
-import { execAsync } from 'async-child-process';
-import * as _ from 'lodash';
import * as packageJSON from '../package.json';
-import * as tsConfig from '../tsconfig.json';
+import * as tsConfigJSON from '../tsconfig.json';
const cwd = `${__dirname}/..`;
-const subPackageName = (packageJSON as any).name;
-// Include any external packages that are part of the @0xproject/connect public interface
-// to this array so that TypeDoc picks it up and adds it to the Docs JSON
-const fileIncludes = [...(tsConfig as any).include];
-const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname);
-const S3BucketPath = 's3://connect-docs-jsons/';
-
-(async () => {
- const tagAndVersion = await postpublishUtils.getLatestTagAndVersionAsync(subPackageName);
- const tag = tagAndVersion.tag;
- const version = tagAndVersion.version;
-
- const releaseName = postpublishUtils.getReleaseName(subPackageName, version);
- const assets = [`${__dirname}/../_bundles/index.js`, `${__dirname}/../_bundles/index.min.js`];
- const release = await postpublishUtils.publishReleaseNotesAsync(tag, releaseName, assets);
-
- // tslint:disable-next-line:no-console
- console.log('POSTPUBLISH: Release successful, generating docs...');
- await postpublishUtils.generateAndUploadDocsAsync(__dirname, cwd, fileIncludesAdjusted, version, S3BucketPath);
-})().catch(console.error);
+// tslint:disable-next-line:no-floating-promises
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/connect/src/monorepo_scripts/stagedocs.ts b/packages/connect/src/monorepo_scripts/stagedocs.ts
index efd3ad62d..e732ac8eb 100644
--- a/packages/connect/src/monorepo_scripts/stagedocs.ts
+++ b/packages/connect/src/monorepo_scripts/stagedocs.ts
@@ -1,19 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
-import { execAsync } from 'async-child-process';
-import * as _ from 'lodash';
-import * as tsConfig from '../tsconfig.json';
+import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const cwd = __dirname + '/..';
-const S3BucketPath = 's3://staging-connect-docs-jsons/';
-// Include any external packages that are part of the @0xproject/connect public interface
-// to this array so that TypeDoc picks it up and adds it to the Docs JSON
-const fileIncludes = [...(tsConfig as any).include];
-const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname);
-const projectFiles = fileIncludesAdjusted.join(' ');
-const jsonFilePath = `${__dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`;
-const version = process.env.DOCS_VERSION || '0.0.0';
-
-(async () => {
- await postpublishUtils.generateAndUploadDocsAsync(__dirname, cwd, fileIncludesAdjusted, version, S3BucketPath);
-})().catch(console.error);
+const cwd = `${__dirname}/..`;
+// tslint:disable-next-line:no-floating-promises
+postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/deployer/src/monorepo_scripts/postpublish.ts b/packages/deployer/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/deployer/src/monorepo_scripts/postpublish.ts
+++ b/packages/deployer/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/dev-utils/src/monorepo_scripts/postpublish.ts b/packages/dev-utils/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/dev-utils/src/monorepo_scripts/postpublish.ts
+++ b/packages/dev-utils/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts b/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts
+++ b/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/json-schemas/src/monorepo_scripts/postpublish.ts b/packages/json-schemas/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/json-schemas/src/monorepo_scripts/postpublish.ts
+++ b/packages/json-schemas/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts
index a36408ccd..55c44ca63 100644
--- a/packages/monorepo-scripts/src/postpublish_utils.ts
+++ b/packages/monorepo-scripts/src/postpublish_utils.ts
@@ -10,37 +10,95 @@ const publishReleaseAsync = promisify(publishRelease);
const githubPersonalAccessToken = process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS;
const generatedDocsDirectoryName = 'generated_docs';
-export interface TagAndVersion {
- tag: string;
+export interface PostpublishConfigs {
+ cwd: string;
+ packageName: string;
version: string;
+ assets: string[];
+ docPublishConfigs: DocPublishConfigs;
+}
+
+export interface DocPublishConfigs {
+ fileIncludes: string[];
+ s3BucketPath: string;
+ s3StagingBucketPath: string;
}
export const postpublishUtils = {
- async getLatestTagAndVersionAsync(subPackageName: string): Promise<TagAndVersion> {
- const subPackagePrefix = `${subPackageName}@`;
- const gitTagsCommand = `git tag -l "${subPackagePrefix}*"`;
- const result = await execAsync(gitTagsCommand);
- if (!_.isEmpty(result.stderr)) {
- throw new Error(result.stderr);
+ generateConfig(packageJSON: any, tsConfigJSON: any, cwd: string): PostpublishConfigs {
+ if (_.isUndefined(packageJSON.name)) {
+ throw new Error('name field required in package.json. Cannot publish release notes to Github.');
}
- const tags = result.stdout.trim().split('\n');
- const versions = tags.map((tag: string) => {
- return tag.slice(subPackagePrefix.length);
- });
- const sortedVersions = semverSort.desc(versions);
- const latestVersion = sortedVersions[0];
- const latestTag = subPackagePrefix + latestVersion;
- return {
- tag: latestTag,
- version: latestVersion,
+ if (_.isUndefined(packageJSON.version)) {
+ throw new Error('version field required in package.json. Cannot publish release notes to Github.');
+ }
+ const postpublishConfig = _.get(packageJSON, 'config.postpublish', {});
+ const configs: PostpublishConfigs = {
+ cwd,
+ packageName: packageJSON.name,
+ version: packageJSON.version,
+ assets: _.get(postpublishConfig, 'assets', []),
+ docPublishConfigs: {
+ // Include any external packages that are part of the 0x.js public interface
+ // to this array so that TypeDoc picks it up and adds it to the Docs JSON
+ // So far, we only have @0xproject/types as part of 0x.js's public interface.
+ fileIncludes: [
+ ...(tsConfigJSON as any).include,
+ ..._.get(postpublishConfig, 'docPublishConfigs.extraFileIncludes', []),
+ ],
+ s3BucketPath: _.get(postpublishConfig, 'docPublishConfigs.s3BucketPath'),
+ s3StagingBucketPath: _.get(postpublishConfig, 'docPublishConfigs.s3StagingBucketPath'),
+ },
};
+ return configs;
+ },
+ async runAsync(packageJSON: any, tsConfigJSON: any, cwd: string): Promise<void> {
+ const configs = this.generateConfig(packageJSON, tsConfigJSON, cwd);
+ const release = await this.publishReleaseNotesAsync(
+ configs.cwd,
+ configs.packageName,
+ configs.version,
+ configs.assets,
+ );
+ if (
+ !_.isUndefined(configs.docPublishConfigs.s3BucketPath) ||
+ !_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath)
+ ) {
+ utils.log('POSTPUBLISH: Release successful, generating docs...');
+ await postpublishUtils.generateAndUploadDocsAsync(
+ configs.cwd,
+ configs.docPublishConfigs.fileIncludes,
+ configs.version,
+ configs.docPublishConfigs.s3BucketPath,
+ );
+ } else {
+ utils.log(`POSTPUBLISH: No S3Bucket config found for ${packageJSON.name}. Skipping doc JSON generation.`);
+ }
+ },
+ async publishDocsToStagingAsync(packageJSON: any, tsConfigJSON: any, cwd: string) {
+ const configs = this.generateConfig(packageJSON, tsConfigJSON, cwd);
+ if (_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath)) {
+ utils.log('config.postpublish.docPublishConfigs.s3StagingBucketPath entry in package.json not found!');
+ return;
+ }
+
+ utils.log('POSTPUBLISH: Generating docs...');
+ await postpublishUtils.generateAndUploadDocsAsync(
+ configs.cwd,
+ configs.docPublishConfigs.fileIncludes,
+ configs.version,
+ configs.docPublishConfigs.s3StagingBucketPath,
+ );
},
- async publishReleaseNotesAsync(tag: string, releaseName: string, assets: string[]) {
+ async publishReleaseNotesAsync(cwd: string, packageName: string, version: string, assets: string[]): Promise<void> {
+ const releaseName = this.getReleaseName(packageName, version);
+ const tag = this.getTag(packageName, version);
utils.log('POSTPUBLISH: Releasing ', releaseName, '...');
- return publishReleaseAsync({
+ const finalAssets = this.adjustAssetPaths(cwd, assets);
+ const result = await publishReleaseAsync({
token: githubPersonalAccessToken,
owner: '0xProject',
- repo: '0x.js',
+ repo: '0x-monorepo',
tag,
name: releaseName,
notes: 'N/A',
@@ -51,26 +109,23 @@ export const postpublishUtils = {
assets,
});
},
+ getTag(packageName: string, version: string) {
+ return `${packageName}@${version}`;
+ },
getReleaseName(subPackageName: string, version: string): string {
const releaseName = `${subPackageName} v${version}`;
return releaseName;
},
- async standardPostPublishAsync(subPackageName: string): Promise<void> {
- const result: TagAndVersion = await this.getLatestTagAndVersionAsync(subPackageName);
- const releaseName = this.getReleaseName(subPackageName, result.version);
- const assets: string[] = [];
- await this.publishReleaseNotesAsync(result.tag, releaseName, assets);
+ adjustAssetPaths(cwd: string, assets: string[]) {
+ const finalAssets: string[] = [];
+ _.each(assets, (asset: string) => {
+ finalAssets.push(`${cwd}/${asset}`);
+ });
+ return finalAssets;
},
adjustFileIncludePaths(fileIncludes: string[], cwd: string): string[] {
const fileIncludesAdjusted = _.map(fileIncludes, fileInclude => {
- let path;
- if (_.startsWith(fileInclude, '../')) {
- path = `${cwd}/../${fileInclude}`;
- } else if (_.startsWith(fileInclude, './')) {
- path = `${cwd}/../${fileInclude.substr(2)}`;
- } else {
- path = `${cwd}/${fileInclude}`;
- }
+ let path = _.startsWith(fileInclude, './') ? `${cwd}/${fileInclude.substr(2)}` : `${cwd}/${fileInclude}`;
// HACK: tsconfig.json needs wildcard directory endings as `/**/*`
// but TypeDoc needs it as `/**` in order to pick up files at the root
@@ -81,15 +136,10 @@ export const postpublishUtils = {
});
return fileIncludesAdjusted;
},
- async generateAndUploadDocsAsync(
- dirname: string,
- cwd: string,
- includedFiles: string[],
- version: string,
- S3BucketPath: string,
- ) {
- const jsonFilePath = `${dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`;
- const projectFiles = includedFiles.join(' ');
+ async generateAndUploadDocsAsync(cwd: string, fileIncludes: string[], version: string, S3BucketPath: string) {
+ const fileIncludesAdjusted = this.adjustFileIncludePaths(fileIncludes, cwd);
+ const projectFiles = fileIncludesAdjusted.join(' ');
+ const jsonFilePath = `${cwd}/${generatedDocsDirectoryName}/index.json`;
const result = await execAsync(
`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`,
{
@@ -105,7 +155,10 @@ export const postpublishUtils = {
await execAsync(`S3_URL=${s3Url} yarn upload_docs_json`, {
cwd,
});
+ // Remove the generated docs directory
+ await execAsync(`rm -rf ${generatedDocsDirectoryName}`, {
+ cwd,
+ });
utils.log(`POSTPUBLISH: Docs uploaded to S3 bucket: ${S3BucketPath}`);
},
- generatedDocsDirectoryName,
};
diff --git a/packages/react-docs/src/monorepo_scripts/postpublish.ts b/packages/react-docs/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/react-docs/src/monorepo_scripts/postpublish.ts
+++ b/packages/react-docs/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/react-shared/src/monorepo_scripts/postpublish.ts b/packages/react-shared/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/react-shared/src/monorepo_scripts/postpublish.ts
+++ b/packages/react-shared/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/sra-report/src/monorepo_scripts/postpublish.ts b/packages/sra-report/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/sra-report/src/monorepo_scripts/postpublish.ts
+++ b/packages/sra-report/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/subproviders/src/monorepo_scripts/postpublish.ts b/packages/subproviders/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/subproviders/src/monorepo_scripts/postpublish.ts
+++ b/packages/subproviders/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/tslint-config/monorepo_scripts/postpublish.ts b/packages/tslint-config/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/tslint-config/monorepo_scripts/postpublish.ts
+++ b/packages/tslint-config/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/types/src/monorepo_scripts/postpublish.ts b/packages/types/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/types/src/monorepo_scripts/postpublish.ts
+++ b/packages/types/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/utils/src/monorepo_scripts/postpublish.ts b/packages/utils/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/utils/src/monorepo_scripts/postpublish.ts
+++ b/packages/utils/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts b/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts
+++ b/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts b/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts
index 6e5aa050a..dcb99d0f7 100644
--- a/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts
+++ b/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts
@@ -1,7 +1,8 @@
import { postpublishUtils } from '@0xproject/monorepo-scripts';
import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
-const subPackageName = (packageJSON as any).name;
+const cwd = `${__dirname}/..`;
// tslint:disable-next-line:no-floating-promises
-postpublishUtils.standardPostPublishAsync(subPackageName);
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);