feat: put airgap client build in a separate folder (#22413)

## Description

- Adds a new build output dir `build_airgap` for airgap client builds. 


Fixes #22414
This commit is contained in:
Sangeeth Sivan 2023-04-18 14:10:11 +05:30 committed by GitHub
parent 8635c251f5
commit da847b48d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 4 deletions

View File

@ -12,6 +12,7 @@
# production
/build
/build_airgap
# misc
.DS_Store

View File

@ -6,13 +6,21 @@ GIT_SHA=$(eval git rev-parse HEAD)
echo $GIT_SHA
echo "Sentry Auth Token: $SENTRY_AUTH_TOKEN"
if [ "$REACT_APP_AIRGAP_ENABLED" == "true" ]; then
echo "Building for airgapped Appsmith instances"
OUTPUT_PATH=build_airgap
else
echo "Building for non-airgapped Appsmith instances"
OUTPUT_PATH=build
fi
# build cra app
REACT_APP_SENTRY_RELEASE=$GIT_SHA REACT_APP_CLIENT_LOG_LEVEL=ERROR EXTEND_ESLINT=true craco --max-old-space-size=4096 build --config craco.build.config.js
if [ "$GITHUB_REPOSITORY" == "appsmithorg/appsmith-ee" ]; then
echo "Deleting sourcemaps for EE"
rm ./build/static/js/*.js.map
rm ./build/static/js/*.js.map.gz
rm ./$OUTPUT_PATH/static/js/*.js.map
rm ./$OUTPUT_PATH/static/js/*.js.map.gz
fi
echo "build finished"

View File

@ -5,9 +5,9 @@ const common = require("./craco.common.config.js");
const WorkboxPlugin = require("workbox-webpack-plugin");
const CompressionPlugin = require("compression-webpack-plugin");
const { RetryChunkLoadPlugin } = require("webpack-retry-chunk-load-plugin");
const path = require("path");
const env = process.env.REACT_APP_ENVIRONMENT;
const isAirgap = process.env.REACT_APP_AIRGAP_ENABLED;
const plugins = [];
plugins.push(
@ -66,6 +66,25 @@ plugins.push(
module.exports = merge(common, {
webpack: {
configure: (webpackConfig, { env, paths }) => {
if (env.REACT_APP_AIRGAP_ENABLED === "true" || isAirgap === "true") {
paths.appBuild = webpackConfig.output.path =
path.resolve("build_airgap");
}
webpackConfig.resolve.fallback = {
assert: false,
stream: false,
util: false,
fs: false,
os: false,
path: false,
};
webpackConfig.module.rules.push({
test: /\.m?js/,
resolve: { fullySpecified: false },
});
return webpackConfig;
},
plugins: plugins,
},
jest: {