2022-07-02 12:40:22 +08:00
|
|
|
set -eo pipefail
|
|
|
|
|
2022-12-15 01:24:32 +08:00
|
|
|
# Enable globstar (**) feature
|
|
|
|
shopt -s globstar
|
|
|
|
|
2022-04-22 18:02:54 +08:00
|
|
|
echo Prune dependencies
|
2022-12-14 13:23:59 +08:00
|
|
|
rm -rf node_modules packages/**/node_modules
|
2022-04-22 18:02:54 +08:00
|
|
|
|
|
|
|
echo Install production dependencies
|
2022-08-02 18:10:01 +08:00
|
|
|
NODE_ENV=production pnpm i
|
2022-04-22 18:02:54 +08:00
|
|
|
|
|
|
|
echo Prune files
|
2023-03-06 00:48:50 +08:00
|
|
|
|
|
|
|
if [[ "${IS_CLOUD}" != @(1|true|y|yes|yep|yeah) ]]; then
|
|
|
|
# Remove cloud in OSS distributions
|
|
|
|
rm -rf packages/cloud
|
|
|
|
fi
|
|
|
|
|
2022-12-15 01:24:32 +08:00
|
|
|
# Some node packages use `src` as their dist folder, so ignore them from the rm list in the end
|
|
|
|
find \
|
2023-03-30 19:28:08 +08:00
|
|
|
.git .changeset .devcontainer .github .husky .parcel-cache .scripts .vscode pnpm-*.yaml *.js \
|
2022-12-14 13:23:59 +08:00
|
|
|
packages/**/src \
|
2022-12-15 01:24:32 +08:00
|
|
|
packages/**/*.config.js packages/**/*.config.ts packages/**/tsconfig*.json \
|
|
|
|
! -path '**/node_modules/**' \
|
|
|
|
-prune -exec rm -rf {} +
|
2022-04-22 18:02:54 +08:00
|
|
|
|
2022-12-30 10:42:34 +08:00
|
|
|
# Add official connectors
|
2023-03-15 15:24:31 +08:00
|
|
|
cloud_option=$( [[ "$IS_CLOUD" =~ ^(1|true|y|yes|yep|yeah)$ ]] && echo "--cloud" || echo "" )
|
2023-04-02 14:12:30 +08:00
|
|
|
pnpm cli connector link $cloud_option -p .
|
2022-12-30 10:42:34 +08:00
|
|
|
|
2022-04-22 18:02:54 +08:00
|
|
|
echo Tar
|
|
|
|
cd ..
|
|
|
|
tar -czf /tmp/logto.tar.gz logto
|