Skip to content

fix(nextjs): Use indexing to iterate in for-loops in vercel script #3818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

lobsterkatie
Copy link
Member

It turns out that bash and zsh handle for-loops differently. Consider the following code:

animals=("aardvark" "baboon" "coati")

echo -e "\nno indexing:"
for animal in $animals; do
  echo $animal
done

echo -e "\nwith indexing:"
for animal in ${animals[@]}; do
  echo $animal
done

In zsh, you get two copies of the full list:

> source indexing-test.sh

no indexing:
aardvark
baboon
coati

with indexing:
aardvark
baboon
coati

In bash, however, if you don't index, you only get the first element:

> source indexing-test.sh 

no indexing:
aardvark

with indexing:
aardvark
baboon
coati

Since the install-sentry-from-branch.sh script runs under bash (on vercel), we need to index in order for our for-loops to work.

@github-actions
Copy link
Contributor

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 21.46 KB (0%)
@sentry/browser - Webpack 22.47 KB (0%)
@sentry/react - Webpack 22.5 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 28.97 KB (-0.01% 🔽)

@lobsterkatie lobsterkatie merged commit 61a22ec into master Jul 20, 2021
@lobsterkatie lobsterkatie deleted the kmclb-nextjs-vercel-script-indexing-in-for-loops branch July 20, 2021 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants