aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-25 03:37:01 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-07-25 03:57:47 +0800
commitdbc798596b052d3e28cf5772c94789d37ee5a4c7 (patch)
tree9502dbee2b258c2f2053039925042172768fc8be
parentc5859b65a395f31c87a3d3fbd303ed17156be09f (diff)
downloaddexon-sol-tools-dbc798596b052d3e28cf5772c94789d37ee5a4c7.tar
dexon-sol-tools-dbc798596b052d3e28cf5772c94789d37ee5a4c7.tar.gz
dexon-sol-tools-dbc798596b052d3e28cf5772c94789d37ee5a4c7.tar.bz2
dexon-sol-tools-dbc798596b052d3e28cf5772c94789d37ee5a4c7.tar.lz
dexon-sol-tools-dbc798596b052d3e28cf5772c94789d37ee5a4c7.tar.xz
dexon-sol-tools-dbc798596b052d3e28cf5772c94789d37ee5a4c7.tar.zst
dexon-sol-tools-dbc798596b052d3e28cf5772c94789d37ee5a4c7.zip
Replace dry mode with local publishing mode
-rw-r--r--package.json4
-rw-r--r--packages/monorepo-scripts/src/postpublish_utils.ts47
-rw-r--r--packages/monorepo-scripts/src/publish.ts17
3 files changed, 38 insertions, 30 deletions
diff --git a/package.json b/package.json
index 1cea9ff61..0045ea6c8 100644
--- a/package.json
+++ b/package.json
@@ -14,10 +14,10 @@
"report_coverage": "lcov-result-merger 'packages/*/coverage/lcov.info' | coveralls",
"test:installation": "node ./packages/monorepo-scripts/lib/test_installation.js",
"run:publish": "run-s install:all build:monorepo_scripts script:prepublish_checks script:publish",
- "run:publish:dry": "run-s install:all build:monorepo_scripts script:prepublish_checks script:publish:dry",
+ "run:publish:local": "run-s install:all build:monorepo_scripts script:prepublish_checks script:publish:local",
"script:prepublish_checks": "node ./packages/monorepo-scripts/lib/prepublish_checks.js",
"script:publish": "node ./packages/monorepo-scripts/lib/publish.js",
- "script:publish:dry": "IS_DRY_RUN=true yarn script:publish",
+ "script:publish:local": "IS_LOCAL_PUBLISH=true yarn script:publish",
"install:all": "yarn install",
"wsrun": "wsrun",
"lerna:run": "lerna run",
diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts
index 8c9d95e44..229bb9031 100644
--- a/packages/monorepo-scripts/src/postpublish_utils.ts
+++ b/packages/monorepo-scripts/src/postpublish_utils.ts
@@ -25,6 +25,8 @@ export interface DocPublishConfigs {
s3StagingBucketPath: string;
}
+const IS_LOCAL_PUBLISH = process.env.IS_LOCAL_PUBLISH === 'true';
+
export const postpublishUtils = {
generateConfig(packageJSON: any, tsConfigJSON: any, cwd: string): PostpublishConfigs {
if (_.isUndefined(packageJSON.name)) {
@@ -51,27 +53,30 @@ export const postpublishUtils = {
return configs;
},
async runAsync(packageJSON: any, tsConfigJSON: any, cwd: string): Promise<void> {
- // const configs = postpublishUtils.generateConfig(packageJSON, tsConfigJSON, cwd);
- // await postpublishUtils.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.`);
- // }
+ if (IS_LOCAL_PUBLISH) {
+ return;
+ }
+ const configs = postpublishUtils.generateConfig(packageJSON, tsConfigJSON, cwd);
+ await postpublishUtils.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): Promise<void> {
const configs = postpublishUtils.generateConfig(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts
index f3c406eed..71eb16a98 100644
--- a/packages/monorepo-scripts/src/publish.ts
+++ b/packages/monorepo-scripts/src/publish.ts
@@ -16,7 +16,7 @@ import { utils } from './utils/utils';
const DOC_GEN_COMMAND = 'docs:json';
const NPM_NAMESPACE = '@0xproject/';
-const IS_DRY_RUN = process.env.IS_DRY_RUN === 'true';
+const IS_LOCAL_PUBLISH = process.env.IS_LOCAL_PUBLISH === 'true';
const TODAYS_TIMESTAMP = moment().unix();
const packageNameToWebsitePath: { [name: string]: string } = {
'0x.js': '0xjs',
@@ -36,7 +36,9 @@ const packageNameToWebsitePath: { [name: string]: string } = {
const shouldIncludePrivate = true;
const allUpdatedPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
- // await confirmDocPagesRenderAsync(updatedPublicPackages);
+ if (!IS_LOCAL_PUBLISH) {
+ await confirmDocPagesRenderAsync(allUpdatedPackages);
+ }
// Update CHANGELOGs
const updatedPublicPackages = _.filter(allUpdatedPackages, pkg => !pkg.packageJson.private);
@@ -57,8 +59,8 @@ const packageNameToWebsitePath: { [name: string]: string } = {
});
// Push changelog changes to Github
- if (!IS_DRY_RUN) {
- // await pushChangelogsToGithubAsync();
+ if (!IS_LOCAL_PUBLISH) {
+ await pushChangelogsToGithubAsync();
}
// Call LernaPublish
@@ -180,9 +182,10 @@ async function lernaPublishAsync(packageToNextVersion: { [name: string]: string
const packageVersionString = _.map(packageToNextVersion, (nextVersion: string, packageName: string) => {
return `${packageName}@${nextVersion}`;
}).join(',');
- const lernaPublishCmd = `node ${
- constants.lernaExecutable
- } publish --cdVersions=${packageVersionString} --skip-git --yes --force-publish *`;
+ let lernaPublishCmd = `node ${constants.lernaExecutable} publish --cdVersions=${packageVersionString}`;
+ if (IS_LOCAL_PUBLISH) {
+ lernaPublishCmd += ' --skip-git --yes --force-publish *';
+ }
utils.log('Lerna is publishing...');
await execAsync(lernaPublishCmd, { cwd: constants.monorepoRootPath });
}