diff options
Diffstat (limited to 'packages/monorepo-scripts/src')
-rw-r--r-- | packages/monorepo-scripts/src/postpublish_utils.ts | 47 | ||||
-rw-r--r-- | packages/monorepo-scripts/src/publish.ts | 17 |
2 files changed, 36 insertions, 28 deletions
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 }); } |