-
Notifications
You must be signed in to change notification settings - Fork 27
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
To solve the npm package size issue #252
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
1974727
I am a bad js programer
TingDaoK f371350
Merge branch 'main' into npm-package
TingDaoK e477526
add one more todo
TingDaoK 83fb37d
Merge branch 'npm-package' of github.com:awslabs/aws-crt-nodejs into …
TingDaoK 4b001af
TODO checksum
TingDaoK a46bbaf
Checksum
TingDaoK 6b58845
remove test line
TingDaoK bdcb541
check the path is correct
TingDaoK d86f783
just for testing
TingDaoK 7a84ef3
Revert "just for testing"
TingDaoK fd26fb1
pro test
TingDaoK d37cc1e
you don't need typedoc
TingDaoK 8630a0c
use `^` to include any newer version
TingDaoK 0a294d3
sha 256 instead
TingDaoK 465e5ed
Still have the checksum at S3
TingDaoK 7e17e3e
introduce the env variable and README
TingDaoK e7acc86
markdown
TingDaoK 8f865de
get rid of the newline for the checksums
TingDaoK 338950e
Coments addressed, first round
TingDaoK 30f62db
our own copy folder and firendly change work directory
TingDaoK ebf6066
remove test code and be more like a JS developer
TingDaoK 2a4a334
more styling fix
TingDaoK 429486a
remove uuid as well
TingDaoK 0683a23
node build-in modules first
TingDaoK 3bca139
remove source code after build
TingDaoK 410ca2f
again, forgot to remove the test
TingDaoK 28bed15
also another one for test
TingDaoK 967aa2f
don't need to copy around
TingDaoK 5ed6f0c
remove the unused variable
TingDaoK f8240a2
tweak, return 0 at end
TingDaoK 58ba0b1
better error handling
TingDaoK 95714c8
check if it's a release
TingDaoK b63392c
comments addressed
TingDaoK 9391224
to fix npm warning?
TingDaoK 32a4c82
npm update
TingDaoK 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
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,55 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
# force a failure if there's no tag | ||
git describe --tags | ||
# now get the tag | ||
CURRENT_TAG=$(git describe --tags | cut -f2 -dv) | ||
# convert v0.2.12-2-g50254a9 to 0.2.12 | ||
CURRENT_TAG_VERSION=$(git describe --tags | cut -f1 -d'-' | cut -f2 -dv) | ||
# if there's a hash on the tag, then this is not a release tagged commit | ||
if [ "$CURRENT_TAG" != "$CURRENT_TAG_VERSION" ]; then | ||
echo "Current tag version is not a release tag, cut a new release if you want to publish." | ||
exit 1 | ||
fi | ||
|
||
# go to previous directory | ||
cd .. | ||
|
||
# native source code | ||
tar -cvzf aws-crt-$CURRENT_TAG_VERSION-source.tgz aws-crt-nodejs/crt | ||
# sha256 checksum | ||
SOURCE_SHA256=$(sha256sum aws-crt-$CURRENT_TAG_VERSION-source.tgz | awk '{print $1}') | ||
echo -n $SOURCE_SHA256 > aws-crt-$CURRENT_TAG_VERSION-source.sha256 | ||
|
||
# omnibus package | ||
tar -cvzf aws-crt-$CURRENT_TAG_VERSION-all.tgz aws-crt-nodejs/ | ||
# sha256 checksum | ||
SOURCE_SHA256=$(sha256sum aws-crt-$CURRENT_TAG_VERSION-all.tgz | awk '{print $1}') | ||
echo -n $SOURCE_SHA256 > aws-crt-$CURRENT_TAG_VERSION-all.sha256 | ||
|
||
# binaries | ||
tar -cvzf aws-crt-$CURRENT_TAG_VERSION-binary.tgz aws-crt-nodejs/dist/bin | ||
# sha256 checksum | ||
SOURCE_SHA256=$(sha256sum aws-crt-$CURRENT_TAG_VERSION-binary.tgz | awk '{print $1}') | ||
echo -n $SOURCE_SHA256 > aws-crt-$CURRENT_TAG_VERSION-binary.sha256 | ||
|
||
|
||
# npm pack | ||
cd aws-crt-nodejs | ||
npm install --unsafe-perm | ||
npm pack --unsafe-perm | ||
cp aws-crt-*.tgz .. | ||
|
||
# Check unzip npm package size | ||
cd .. | ||
UNZIP="unzip_pack" | ||
mkdir $UNZIP | ||
tar -xf aws-crt-$CURRENT_TAG_VERSION.tgz -C $UNZIP | ||
PACK_FILE_SIZE_KB=$(du -sk $UNZIP | awk '{print $1}') | ||
if expr $PACK_FILE_SIZE_KB \> 12000 ; then | ||
TingDaoK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# the package size is larger than 12 MB, return -1 | ||
echo "Package size is too large" | ||
exit -1 | ||
fi | ||
exit 0 |
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
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.
May be check if the tagged commit at current head? This can prevent updating binaries without bumping versions.
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.
I removed a check that was there for testing. Added it back to check if the tag is release. So, in that case, we can prevent updating binaries without proper release, which will also prevent the version is not updated, I think.