-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (build): Add package size check in PR workflow (#878)
- Loading branch information
1 parent
4427e82
commit 38b893f
Showing
9 changed files
with
59 additions
and
1 deletion.
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
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,44 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
|
||
usage() { | ||
echo "Uber package Builder" | ||
echo "------------------------" | ||
echo "./package-bundler.sh NAME LOCAL_NPM_PACKAGE_LOCATION" | ||
echo "" | ||
} | ||
|
||
|
||
if [[ "$#" -lt 2 ]]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
name=$(basename ${1}) | ||
dist_folder="${2}" | ||
|
||
echo "Will bundle $(ls ${dist_folder}) into ${dist_folder}/${name}.tgz" | ||
|
||
output_folder="$(mktemp -d)" | ||
|
||
docker_image="public.ecr.aws/sam/build-nodejs14.x:latest" | ||
volume_params="-v $output_folder:/bundle" | ||
|
||
package_folder="nodejs/" | ||
mkdir -p "$output_folder/$package_folder" | ||
|
||
cp -r "${2}" "$output_folder/$package_folder/" | ||
|
||
install_command="pushd $package_folder; npm install --save ./*.tgz; popd" | ||
volume_params="$volume_params -v $HOME/.npmrc:/root/.npmrc" | ||
|
||
zip_command="zip -r bundle.zip * && rm -rf $package_folder" | ||
|
||
docker run --rm $volume_params -w "/bundle" "$docker_image" /bin/bash -c "$install_command && $zip_command" | ||
|
||
mv "$output_folder/bundle.zip" "$dist_folder/$name.zip" | ||
|
||
rm -rf $output_folder | ||
|
||
echo "All done" |
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
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
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