webpack based on app next version
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 32s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m18s
Webapp Test / Run webapp test suite (pull_request) Successful in 6m1s
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Successful in 7m18s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 9m13s
Smoke Test / Run basic test suite (pull_request) Successful in 4m17s

This commit is contained in:
VPhung24 2024-10-15 19:53:41 +00:00
parent 333a3eea02
commit fcf2584a3a

View File

@ -46,8 +46,22 @@ determine_webpack_version() {
esac esac
} }
# Check if webpack is already in package.json
if CERC_WEBPACK_VERSION=$(jq -r '.dependencies.webpack // .devDependencies.webpack // empty' package.json); then
if [ -n "$CERC_WEBPACK_VERSION" ]; then
echo "Using existing webpack version: $CERC_WEBPACK_VERSION"
else
CERC_WEBPACK_VERSION=$(determine_webpack_version "$CERC_NEXT_VERSION") CERC_WEBPACK_VERSION=$(determine_webpack_version "$CERC_NEXT_VERSION")
echo "Using webpack version: $CERC_WEBPACK_VERSION" echo "Determined webpack version based on Next.js: $CERC_WEBPACK_VERSION"
# Add webpack to devDependencies
jq ".devDependencies.webpack = \"$CERC_WEBPACK_VERSION\"" package.json > package.json.tmp && mv package.json.tmp package.json
fi
else
CERC_WEBPACK_VERSION=$(determine_webpack_version "$CERC_NEXT_VERSION")
echo "Determined webpack version based on Next.js: $CERC_WEBPACK_VERSION"
# Add webpack to devDependencies
jq ".devDependencies.webpack = \"$CERC_WEBPACK_VERSION\"" package.json > package.json.tmp && mv package.json.tmp package.json
fi
# Determine the Next.js config file # Determine the Next.js config file
if [ -f "next.config.mjs" ]; then if [ -f "next.config.mjs" ]; then
@ -151,23 +165,6 @@ mv "${NEXT_CONFIG_JS}.pretty" "$NEXT_CONFIG_JS"
# Update package.json # Update package.json
[ ! -f "package.dist" ] && cp package.json package.dist [ ! -f "package.dist" ] && cp package.json package.dist
# Check if webpack is already in package.json
if WEBPACK_VERSION=$(jq -r '.dependencies.webpack // .devDependencies.webpack // empty' package.json); then
if [ -n "$WEBPACK_VERSION" ]; then
echo "Using existing webpack version: $WEBPACK_VERSION"
else
WEBPACK_VERSION=$(determine_webpack_version "$CERC_NEXT_VERSION")
echo "Determined webpack version based on Next.js: $WEBPACK_VERSION"
# Add webpack to devDependencies
jq ".devDependencies.webpack = \"$WEBPACK_VERSION\"" package.json > package.json.tmp && mv package.json.tmp package.json
fi
else
WEBPACK_VERSION=$(determine_webpack_version "$CERC_NEXT_VERSION")
echo "Determined webpack version based on Next.js: $WEBPACK_VERSION"
# Add webpack to devDependencies
jq ".devDependencies.webpack = \"$WEBPACK_VERSION\"" package.json > package.json.tmp && mv package.json.tmp package.json
fi
# Install dependencies # Install dependencies
$CERC_BUILD_TOOL install || exit 1 $CERC_BUILD_TOOL install || exit 1