diff --git a/package.json b/package.json index 1b5cefd5..01cfd68a 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "move:integrations": "bash scripts/move-all-to-nango-integration-directories.bash $npm_config_integration", "undo:move:integrations": "bash scripts/undo-move-to-nango-directories.bash", "lint-moved-integrations": "npm run move:integrations && npm run lint && npm run undo:move:integrations", + "dryrun": "bash scripts/run-integration-template.bash --dryrun", "generate:zod": "bash scripts/generate-integration-template-zod.bash $npm_config_integration && npm run undo:move:integrations", "compile": "bash scripts/compile-all-templates.bash $npm_config_integration && npm run undo:move:integrations", "prettier-format": "prettier --config .prettierrc \"./**/*.{ts,tsx}\" --write", diff --git a/scripts/run-integration-template.bash b/scripts/run-integration-template.bash index 77353634..bdcea654 100755 --- a/scripts/run-integration-template.bash +++ b/scripts/run-integration-template.bash @@ -8,6 +8,10 @@ popd () { command popd "$@" > /dev/null } +if [ -f .env ]; then + export $(cat .env | xargs) +fi + TEMP_DIRECTORY=tmp-run-integration-template NANGO_HOSTPORT_DEFAULT=http://localhost:3003 @@ -16,6 +20,8 @@ ITERATIONS=1 INPUT_JSON="" USE_ITERATIONS=false +nango_command="" + # optional arguments for arg in "$@"; do case $arg in @@ -27,6 +33,10 @@ for arg in "$@"; do NANGO_HOSTPORT="${arg#*=}" shift ;; + --dryrun) + nango_command="dryrun" + shift + ;; --iterations=*) ITERATIONS="${arg#*=}" USE_ITERATIONS=true @@ -35,6 +45,7 @@ for arg in "$@"; do esac done + if [ -z "$NANGO_SECRET_KEY_DEV" ]; then echo "NANGO_SECRET_KEY_DEV must be set" exit 1 @@ -72,7 +83,7 @@ for ((i=1; i<=ITERATIONS; i++)); do sed -i '' -e "s/\${iteration}/$i/g" "$INPUT_JSON" fi - NANGO_MOCKS_RESPONSE_DIRECTORY="../../integrations/" NANGO_SECRET_KEY_DEV=$NANGO_SECRET_KEY_DEV NANGO_HOSTPORT=$NANGO_HOSTPORT npx nango "$@" + NANGO_MOCKS_RESPONSE_DIRECTORY="../../integrations/" NANGO_SECRET_KEY_DEV=$NANGO_SECRET_KEY_DEV NANGO_HOSTPORT=$NANGO_HOSTPORT npx nango $nango_command "$@" if $USE_ITERATIONS && [ -n "$INPUT_JSON" ] && [[ "$INPUT_JSON" == *.json ]]; then echo "$PRE_REPLACE_CONTENTS" > $INPUT_JSON