diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-25 03:39:31 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-25 03:57:47 +0800 |
commit | c40b3dea6cefc9a192136d66311839bd7c5d5169 (patch) | |
tree | f2bca973ab6e03afa9870ff6bdb9e0ef18c9efe8 /packages/monorepo-scripts/src/postpublish_utils.ts | |
parent | dbc798596b052d3e28cf5772c94789d37ee5a4c7 (diff) | |
download | dexon-0x-contracts-c40b3dea6cefc9a192136d66311839bd7c5d5169.tar dexon-0x-contracts-c40b3dea6cefc9a192136d66311839bd7c5d5169.tar.gz dexon-0x-contracts-c40b3dea6cefc9a192136d66311839bd7c5d5169.tar.bz2 dexon-0x-contracts-c40b3dea6cefc9a192136d66311839bd7c5d5169.tar.lz dexon-0x-contracts-c40b3dea6cefc9a192136d66311839bd7c5d5169.tar.xz dexon-0x-contracts-c40b3dea6cefc9a192136d66311839bd7c5d5169.tar.zst dexon-0x-contracts-c40b3dea6cefc9a192136d66311839bd7c5d5169.zip |
Specify registry url only if local publish attempted
Diffstat (limited to 'packages/monorepo-scripts/src/postpublish_utils.ts')
-rw-r--r-- | packages/monorepo-scripts/src/postpublish_utils.ts | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts index 229bb9031..37861f0dd 100644 --- a/packages/monorepo-scripts/src/postpublish_utils.ts +++ b/packages/monorepo-scripts/src/postpublish_utils.ts @@ -6,6 +6,7 @@ import * as path from 'path'; import * as publishRelease from 'publish-release'; import { constants } from './constants'; +import { configs } from './utils/configs'; import { utils } from './utils/utils'; const publishReleaseAsync = promisify(publishRelease); @@ -25,8 +26,6 @@ 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)) { @@ -36,7 +35,7 @@ export const postpublishUtils = { throw new Error('version field required in package.json. Cannot publish release notes to Github.'); } const postpublishConfig = _.get(packageJSON, 'config.postpublish', {}); - const configs: PostpublishConfigs = { + const postpublishConfigs: PostpublishConfigs = { cwd, packageName: packageJSON.name, version: packageJSON.version, @@ -50,47 +49,47 @@ export const postpublishUtils = { s3StagingBucketPath: _.get(postpublishConfig, 'docPublishConfigs.s3StagingBucketPath'), }, }; - return configs; + return postpublishConfigs; }, async runAsync(packageJSON: any, tsConfigJSON: any, cwd: string): Promise<void> { - if (IS_LOCAL_PUBLISH) { + if (configs.IS_LOCAL_PUBLISH) { return; } - const configs = postpublishUtils.generateConfig(packageJSON, tsConfigJSON, cwd); + const postpublishConfigs = postpublishUtils.generateConfig(packageJSON, tsConfigJSON, cwd); await postpublishUtils.publishReleaseNotesAsync( - configs.cwd, - configs.packageName, - configs.version, - configs.assets, + postpublishConfigs.cwd, + postpublishConfigs.packageName, + postpublishConfigs.version, + postpublishConfigs.assets, ); if ( - !_.isUndefined(configs.docPublishConfigs.s3BucketPath) || - !_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath) + !_.isUndefined(postpublishConfigs.docPublishConfigs.s3BucketPath) || + !_.isUndefined(postpublishConfigs.docPublishConfigs.s3StagingBucketPath) ) { utils.log('POSTPUBLISH: Release successful, generating docs...'); await postpublishUtils.generateAndUploadDocsAsync( - configs.cwd, - configs.docPublishConfigs.fileIncludes, - configs.version, - configs.docPublishConfigs.s3BucketPath, + postpublishConfigs.cwd, + postpublishConfigs.docPublishConfigs.fileIncludes, + postpublishConfigs.version, + postpublishConfigs.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); - if (_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath)) { + const postpublishConfigs = postpublishUtils.generateConfig(packageJSON, tsConfigJSON, cwd); + if (_.isUndefined(postpublishConfigs.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, + postpublishConfigs.cwd, + postpublishConfigs.docPublishConfigs.fileIncludes, + postpublishConfigs.version, + postpublishConfigs.docPublishConfigs.s3StagingBucketPath, ); }, async publishReleaseNotesAsync(cwd: string, packageName: string, version: string, assets: string[]): Promise<void> { |