-
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cache buffer + improve site build script
- Loading branch information
Showing
7 changed files
with
49 additions
and
15 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,18 +1,43 @@ | ||
#!/bin/bash | ||
|
||
echo "\n--- cleaning prev builds ---" | ||
if [ "$OTPLIB_BUILD_SITE_PACKAGE" == "true" ]; then | ||
echo "\n--- installing and build npm package ---" | ||
OTPLIB_SETUP_EXTRAS=skip \ | ||
OTPLIB_BUILD_REINSTALL=true \ | ||
OTPLIB_BUILD_CLEAN=true \ | ||
OTPLIB_BUILD_MODULE=false \ | ||
OTPLIB_BUILD_BUNDLE=true \ | ||
OTPLIB_BUILD_INCLUDE_BUFFER=true \ | ||
OTPLIB_BUILD_COPY_META=false \ | ||
npm run build | ||
fi | ||
|
||
echo "\n--- cleaning prev site builds ---" | ||
npx rimraf \ | ||
./builds/typedocs \ | ||
./website/static/otplib-browser \ | ||
./website/static/docs \ | ||
./website/static/api \ | ||
./website/public | ||
|
||
echo "\n--- building docs ---" | ||
echo "\n--- copying bundle to website ---" | ||
cp -r ./builds/otplib/preset-browser/. ./website/static/otplib-browser | ||
|
||
echo "\n--- building api docs ---" | ||
npx typedoc \ | ||
--hideGenerator \ | ||
--options ./configs/typedoc.json \ | ||
--out ./builds/typedocs | ||
|
||
echo "\n--- copying statics to website ---" | ||
cp -r ./builds/otplib/preset-browser/. ./website/static/otplib-browser | ||
echo "\n--- copying api docs to website ---" | ||
cp -r ./builds/typedocs/. ./website/static/api | ||
|
||
echo "\n--- changing to website folder ---" | ||
cd website | ||
|
||
if [ "$OTPLIB_BUILD_SITE_REINSTALL" == "true" ]; then | ||
echo "\n--- install website node_modules ---" | ||
npm ci; | ||
fi | ||
|
||
npm run build |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
#!/bin/bash | ||
|
||
if [ "$OTPLIB_BUILD_REINSTALL" == "true" ]; then | ||
echo "\n--- installing node_modules ---" | ||
npm run setup; | ||
fi | ||
|
||
if [ -z "$OTPLIB_BUILD_CLEAN" ] || [ "$OTPLIB_BUILD_CLEAN" == "true" ]; then | ||
echo "\n--- cleaning prev builds ---" | ||
npx rimraf \ | ||
|
@@ -18,21 +23,20 @@ if [ -z "$OTPLIB_BUILD_MODULE" ] || [ "$OTPLIB_BUILD_MODULE" == "true" ]; then | |
typedef \ | ||
./builds/otplib/**/*.d.ts | ||
|
||
echo "\n--- build modules ---" | ||
echo "\n--- building modules ---" | ||
NODE_ENV=production npx rollup \ | ||
-c ./configs/rollup.config.js | ||
fi | ||
|
||
if [ -z "$OTPLIB_BUILD_BUNDLE" ] || [ "$OTPLIB_BUILD_BUNDLE" == "true" ]; then | ||
echo "\n--- build bundles ---" | ||
echo "\n--- building bundles ---" | ||
NODE_ENV=production npx webpack \ | ||
--config ./configs/webpack.config.js | ||
fi | ||
|
||
if [ -z "$OTPLIB_BUILD_DOWNLOAD_BUFFER" ] || [ "$OTPLIB_BUILD_DOWNLOAD_BUFFER" == "true" ]; then | ||
echo "\n--- downloading buffer module ---" | ||
curl https://bundle.run/[email protected] \ | ||
--output ./builds/otplib/preset-browser/buffer.js | ||
if [ -z "$OTPLIB_BUILD_INCLUDE_BUFFER" ] || [ "$OTPLIB_BUILD_INCLUDE_BUFFER" == "true" ]; then | ||
echo "\n--- copying buffer module ---" | ||
cp ./packages/package-cache/buffer.js ./builds/otplib/preset-browser/buffer.js | ||
fi | ||
|
||
if [ -z "$OTPLIB_BUILD_COPY_META" ] || [ "$OTPLIB_BUILD_COPY_META" == "true" ]; then | ||
|
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