2023-10-31 15:38:28 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source /.env
|
|
|
|
|
|
|
|
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
|
|
|
|
npm config set registry $CONTAINER_PACKAGE_URL
|
|
|
|
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
|
|
|
|
yarn config set registry $CONTAINER_PACKAGE_URL
|
2024-05-30 17:39:17 +08:00
|
|
|
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
|
|
|
pnpm config set registry $CONTAINER_PACKAGE_URL
|
2023-10-31 15:38:28 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$RUN_INSTALL" -eq "1" ]]; then
|
|
|
|
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
|
|
|
|
npm install
|
|
|
|
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
|
|
|
|
yarn install
|
2024-05-30 17:39:17 +08:00
|
|
|
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
|
|
|
pnpm install
|
2023-10-31 15:38:28 +08:00
|
|
|
else
|
|
|
|
echo "未知的 PACKAGE_MANAGER: $PACKAGE_MANAGER"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "$CUSTOM_SCRIPT" -eq "1" ]]; then
|
|
|
|
$EXEC_SCRIPT
|
|
|
|
else
|
|
|
|
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
|
|
|
|
npm run $EXEC_SCRIPT
|
|
|
|
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
|
|
|
|
yarn run $EXEC_SCRIPT
|
2024-05-30 17:39:17 +08:00
|
|
|
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
|
|
|
pnpm run $EXEC_SCRIPT
|
2023-10-31 15:38:28 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|