aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/instant/webpack.config.js5
-rw-r--r--packages/monorepo-scripts/src/prepublish_checks.ts11
2 files changed, 12 insertions, 4 deletions
diff --git a/packages/instant/webpack.config.js b/packages/instant/webpack.config.js
index 7139ced16..41276809c 100644
--- a/packages/instant/webpack.config.js
+++ b/packages/instant/webpack.config.js
@@ -15,10 +15,7 @@ const HEAP_PRODUCTION_ENV_VAR_NAME = 'INSTANT_HEAP_ANALYTICS_ID_PRODUCTION';
const HEAP_DEVELOPMENT_ENV_VAR_NAME = 'INSTANT_HEAP_ANALYTICS_ID_DEVELOPMENT';
const getHeapAnalyticsId = modeName => {
if (modeName === 'production') {
- if (process.env[HEAP_PRODUCTION_ENV_VAR_NAME]) {
- return process.env[HEAP_PRODUCTION_ENV_VAR_NAME];
- }
- throw new Error(`Must have ${HEAP_PRODUCTION_ENV_VAR_NAME} set`);
+ return process.env[HEAP_PRODUCTION_ENV_VAR_NAME];
}
if (modeName === 'development') {
diff --git a/packages/monorepo-scripts/src/prepublish_checks.ts b/packages/monorepo-scripts/src/prepublish_checks.ts
index 5f603ebc7..fc550cf3a 100644
--- a/packages/monorepo-scripts/src/prepublish_checks.ts
+++ b/packages/monorepo-scripts/src/prepublish_checks.ts
@@ -17,6 +17,7 @@ async function prepublishChecksAsync(): Promise<void> {
await checkChangelogFormatAsync(updatedPublicPackages);
await checkGitTagsForNextVersionAndDeleteIfExistAsync(updatedPublicPackages);
await checkPublishRequiredSetupAsync();
+ checkRequiredEnvVariables();
}
async function checkGitTagsForNextVersionAndDeleteIfExistAsync(updatedPublicPackages: Package[]): Promise<void> {
@@ -183,6 +184,16 @@ async function checkPublishRequiredSetupAsync(): Promise<void> {
}
}
+const checkRequiredEnvVariables = () => {
+ utils.log('Checking required environment variables...');
+ const requiredEnvVars = ['INSTANT_HEAP_ANALYTICS_ID_PRODUCTION'];
+ requiredEnvVars.forEach(requiredEnvVarName => {
+ if (_.isUndefined(process.env[requiredEnvVarName])) {
+ throw new Error(`Must have ${requiredEnvVarName} set`);
+ }
+ });
+};
+
prepublishChecksAsync().catch(err => {
utils.log(err.message);
process.exit(1);