Skip to content
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

CLI: fix support for env vars when running dev/build commands #21152

Merged
merged 4 commits into from
Mar 22, 2023

Conversation

joshbolduc
Copy link
Contributor

Closes #21055

What I did

Fixed the target of the getEnvConfig call to reference an object that is subsequently passed to the dev/build helper functions. getEnvConfig was previously updating program, which appears to be a carryover from the old implementation where options were actually being read from program. Since options are now being passed to the dev/build functions directly, any options derived from environment variables were effectively being ignored.

(It also appears the logic to convert a string port value to a number was also effectively going unused, but as far as I can tell, it didn't matter.)

How to test

  1. Create any sandbox
  2. Within the sandbox, run yarn storybook with env vars. e.g.,
    • CI=true yarn storybook should not open a browser or prompt if there is a port conflict
    • SBCONFIG_PORT=8888 yarn storybook should start storybook on port 8888

Not sure a good way to add a test for this behavior?

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@joshbolduc joshbolduc marked this pull request as ready for review February 18, 2023 19:28
@ndelangen ndelangen self-assigned this Feb 20, 2023
Copy link
Contributor

@sheriffMoose sheriffMoose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested & Verified, I just removed the appliedOptions variable as it is not actually needed. I will push another commit to fix the same issue for angular apps

@sheriffMoose sheriffMoose changed the title Fix support for env vars when running dev/build commands CLI: fix support for env vars when running dev/build commands Mar 16, 2023
@valentinpalkovic
Copy link
Contributor

@ndelangen

Can we merge this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: sb dev no longer honors environment variables like CI and SBCONFIG_CONFIG_DIR
4 participants