aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-22 02:35:53 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-22 02:35:53 +0800
commit95a80a0e757647f84515e7bc7208f18b875d4111 (patch)
tree88c3a523a5166177e1f79b3b1aa1f9e74b8de3de /packages
parente2a16f3f336c6787501c6a2366e7793a135009f8 (diff)
downloaddexon-sol-tools-95a80a0e757647f84515e7bc7208f18b875d4111.tar
dexon-sol-tools-95a80a0e757647f84515e7bc7208f18b875d4111.tar.gz
dexon-sol-tools-95a80a0e757647f84515e7bc7208f18b875d4111.tar.bz2
dexon-sol-tools-95a80a0e757647f84515e7bc7208f18b875d4111.tar.lz
dexon-sol-tools-95a80a0e757647f84515e7bc7208f18b875d4111.tar.xz
dexon-sol-tools-95a80a0e757647f84515e7bc7208f18b875d4111.tar.zst
dexon-sol-tools-95a80a0e757647f84515e7bc7208f18b875d4111.zip
Shorter validateRollbarPresence logic
Diffstat (limited to 'packages')
-rw-r--r--packages/instant/webpack.config.js15
1 files changed, 4 insertions, 11 deletions
diff --git a/packages/instant/webpack.config.js b/packages/instant/webpack.config.js
index defdde250..adc1cb000 100644
--- a/packages/instant/webpack.config.js
+++ b/packages/instant/webpack.config.js
@@ -66,21 +66,14 @@ const getRollbarPlugin = environmentName => {
};
return new RollbarSourceMapPlugin(rollbarPluginOptions);
};
-
-const validateRollbarPresence = (environmentName, rollbarPlugin) => {
+const validateRollbarPresence = (environmentName, rollbarEnabled, rollbarSourceMapPlugin) => {
const requiresRollbar = environmentName === 'dogfood' || environmentName === 'staging';
-
if (!requiresRollbar) {
return;
}
-
- if (!process.env[ROLLBAR_CLIENT_TOKEN_ENV_NAME]) {
- throw new Error(`${ROLLBAR_CLIENT_TOKEN_ENV_NAME} must be set for ${environmentName}`);
- }
-
- if (!rollbarPlugin) {
+ if (!rollbarEnabled || !rollbarSourceMapPlugin) {
throw new Error(
- `Please set rollbar env var ${ROLLBAR_PUBLISH_TOKEN_ENV_NAME} to a Rollbar project access token with post_server_item permissions to deploy source maps to ${environmentName}`,
+ `Rollbar env vars must be set to build for ${environmentName}. Please set ${ROLLBAR_CLIENT_TOKEN_ENV_NAME} to a rollbar access token with post_client_item permissions, and ${ROLLBAR_PUBLISH_TOKEN_ENV_NAME} to a rollbar access token with post_server_item permissions.`,
);
}
};
@@ -115,7 +108,7 @@ module.exports = (env, argv) => {
} else {
console.log('Not using rollbar source map plugin');
}
- validateRollbarPresence(environmentName, rollbarPlugin);
+ validateRollbarPresence(environmentName, envVars['ROLLBAR_ENABLED'], rollbarPlugin);
const config = {
entry: {