-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add script to install node_modules in mounted mfes
- Loading branch information
1 parent
a178535
commit 7b1f7e9
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{%- for app_name, app in iter_mfes() %} | ||
{%- set mounts = iter_mounts(MOUNTS, app_name)|list %} | ||
{%- if mounts %} | ||
{{ app_name }}-job: | ||
image: "{{ MFE_DOCKER_IMAGE_DEV_PREFIX }}-{{ app_name }}-dev:{{ MFE_VERSION }}" | ||
volumes: | ||
{%- for mount in mounts %} | ||
- {{ mount }} | ||
{%- endfor %} | ||
{%- endif %} | ||
{%- endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Paths for the fingerprint and package-lock.json | ||
FINGERPRINT_FILE="node_modules/.fingerprint" | ||
PACKAGE_LOCK="package-lock.json" | ||
|
||
# Function to generate the SHA1 hash of the package-lock.json file | ||
generate_fingerprint() { | ||
sha1sum "$PACKAGE_LOCK" | awk '{print $1}' | ||
} | ||
|
||
# Check if node_modules exists and fingerprint is valid | ||
if [ ! -d "node_modules" ]; then | ||
echo "⚠️ node_modules not found! Installing dependencies..." | ||
npm clean-install | ||
|
||
elif [ ! -f "$FINGERPRINT_FILE" ]; then | ||
echo "⚠️ Fingerprint file not found! Re-installing dependencies..." | ||
npm clean-install | ||
|
||
else | ||
CURRENT_FINGERPRINT=$(generate_fingerprint) | ||
STORED_FINGERPRINT=$(cat "$FINGERPRINT_FILE") | ||
|
||
if [ "$CURRENT_FINGERPRINT" != "$STORED_FINGERPRINT" ]; then | ||
echo "⚠️ package-lock.json changed! Re-installing dependencies..." | ||
npm clean-install | ||
else | ||
echo "✅ Dependencies are up to date." | ||
exit 0 | ||
fi | ||
fi | ||
|
||
# Store the new fingerprint after installation | ||
generate_fingerprint > "$FINGERPRINT_FILE" | ||
echo "✅ Dependencies installed and fingerprint updated." |