-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure that the build has min.js files before generating the .zip file #2149
Merged
+43
−2
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,40 @@ | ||
#!/bin/bash | ||
|
||
# Initialize the error flag | ||
error_flag=0 | ||
|
||
# Define the base directory to check | ||
base_dir="./assets" | ||
|
||
# Check if the base directory exists | ||
if [ ! -d "$base_dir" ]; then | ||
echo "Error: The directory $base_dir does not exist." | ||
exit 1 | ||
fi | ||
|
||
# Function to check for corresponding .min.js file | ||
check_for_min_js() { | ||
local js_file="$1" | ||
local min_js_file="${js_file%.js}.min.js" | ||
if [ ! -f "$min_js_file" ]; then | ||
echo "Error: No corresponding .min.js file found for $js_file" | ||
return 1 | ||
fi | ||
return 0 | ||
} | ||
|
||
# Find all .js files within the base directory (excluding .min.js files) | ||
while IFS= read -r -d '' js_file; do | ||
if ! check_for_min_js "$js_file"; then | ||
error_flag=1 | ||
fi | ||
done < <(find "$base_dir" -type f -name "*.js" ! -name "*.min.js" -print0) | ||
|
||
# Exit with an error code if any .js file is missing its corresponding .min.js file | ||
if [ "$error_flag" -ne 0 ]; then | ||
echo "Error: the ZIP could not be built because minified scripts are missing. Please ensure you are using the correct versions of NPM and Node.js." | ||
exit 1 | ||
else | ||
echo "All .js files within $base_dir have corresponding .min.js files." | ||
exit 0 | ||
fi |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding a troubleshooting message here, something like:
"Error: the ZIP could not be built because minified scripts are missing. Please ensure you are using the correct versions of NPM and Node.js."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added with 9aba910