forked from cerc-io/stack-orchestrator
webpack based on app next version
This commit is contained in:
parent
333a3eea02
commit
fcf2584a3a
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user