git clone "https://gist.github.com/371c1c782c2b885d2765ac2143670ecb.git" "./bun-compile-size"
sh ./bun-compile-size/exec.sh
less "./bun-compile-size/$(ls -1 "./bun-compile-size" | sort | grep -E "^_log-.*\.md$" | tail -n 1)"
Last active
May 1, 2024 23:30
-
-
Save mryhryki/371c1c782c2b885d2765ac2143670ecb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| dist/** |
$ bun --version
1.1.6 [20ms] bundle 1 modules
[5ms] compile ./dist/linux-x64 bun-linux-x64-v1.1.6
94,843,655 Bytes
[1ms] bundle 1 modules
[3ms] compile ./dist/linux-arm64 bun-linux-aarch64-v1.1.6
90,205,769 Bytes
[1ms] bundle 1 modules
[6ms] compile ./dist/windows-x64.exe bun-windows-x64-v1.1.6
101,636,897 Bytes
[1ms] bundle 1 modules
[148ms] compile ./dist/darwin-arm64
53,017,954 Bytes
This file contains hidden or 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_DIR="$(cd $(dirname $0); pwd)" | |
| cd "${THIS_DIR}" | |
| LOG_FILE="${THIS_DIR}/_log-$(date +"%Y%m%d-%H%M%S").md" | |
| export TZ="Asia/Tokyo" | |
| NOW="$(date +"%Y-%m-%dT%H:%M:%S+09:00")" | |
| printf "# Log: %s\n\n" "${NOW}" | tee -a "${LOG_FILE}" | |
| printf "## Bun Version\n\n\`\`\`shell\n$ bun --version\n%s\n\`\`\`\n\n" "$(bun --version)" | tee -a "${LOG_FILE}" | |
| TARGETS=("linux-x64" "linux-arm64" "windows-x64" "darwin-arm64") | |
| for target in "${TARGETS[@]}"; do | |
| printf "## %s\n\n" "${target}" | tee -a "${LOG_FILE}" | |
| printf "### Log\n\n\`\`\`\n" | tee -a "${LOG_FILE}" | |
| bun build --compile --outfile="./dist/${target}" --target="bun-${target}" ./sample.ts 2>&1 | tee -a "${LOG_FILE}" | |
| printf "\`\`\`\n\n" | tee -a "${LOG_FILE}" | |
| printf "### Binary Size\n\n" | tee -a "${LOG_FILE}" | |
| EXTENSION="$((echo "${target}" | grep "^windows" >/dev/null 2>&1) && printf ".exe" || printf "")" | |
| echo "./dist/${target}${EXTENSION}" | |
| printf "\`%'d\` Bytes\n\n" "$(wc -c < "./dist/${target}${EXTENSION}")" | tee -a "${LOG_FILE}" | |
| done |
This file contains hidden or 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
| const main = async (): Promise<void> => { | |
| console.log("Waiting 1 second"); | |
| await new Promise((resolve) => setTimeout(resolve, 1000)); | |
| console.log("Hello, World!"); | |
| }; | |
| main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment