Skip to content

Commit

Permalink
Feature: disable obfuscation and domain's lock by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Khlopiachyi authored and Camille Meulien committed Jan 11, 2021
1 parent 3993722 commit fb6772a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ steps:
commands:
- export REACT_APP_GIT_SHA=$(git rev-parse --short HEAD)
- echo $REACT_APP_GIT_SHA > .tags
- export BUILD_DOMAIN=$(cat .domains)
- export BUILD_DOMAIN=$(test -e .domains && cat .domains)
- export BUILD_EXPIRE=$(date -d "+1 month" +%s000)
- npm -g install yarn
- yarn install
Expand Down
13 changes: 7 additions & 6 deletions config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ module.exports = function override(config, env) {
}
}

const domain = process.env.BUILD_DOMAIN ? process.env.BUILD_DOMAIN.split(',') : [];

config.plugins.push(
new JavaScriptObfuscator({ rotateUnicodeArray: true, domainLock: domain }, [commonJSFilename])
);
if (`${process.env.BUILD_DOMAIN}` != "") {
const domains = process.env.BUILD_DOMAIN.split(',');
config.plugins.push(
new JavaScriptObfuscator({ rotateUnicodeArray: true, domainLock: domains }, [commonJSFilename])
);
}

config.plugins.push(
new CompressionPlugin({
Expand All @@ -44,4 +45,4 @@ module.exports = function override(config, env) {
}

return config;
};
};
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

export REACT_APP_GIT_SHA=$(git rev-parse --short HEAD)
export BUILD_DOMAIN=${BUILD_DOMAIN:-$(cat .domains)}
export BUILD_DOMAIN=$(test -e .domains && cat .domains)
[ -n "$BUILD_EXPIRE" ] && export REACT_APP_BUILD_EXPIRE=$(date -d "+${BUILD_EXPIRE}" +%s000)

yarn build

0 comments on commit fb6772a

Please sign in to comment.