-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Make yarn splash optional #2372
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
Conversation
💦 Potential splash zone of changes introduced to No significant changes to This comment automatically updates as changes are made to this pull request. |
scripts/splash/index.tsx
Outdated
<Box> | ||
Tip: disable <Text bold>yarn splash</Text> by running{' '} | ||
<Text bold>yarn dev-no-splash</Text> or setting an environment | ||
variable <Text bold>DISABLE_SPLASH=1</Text> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it a bit strange to have this message here when the responsibility for this condition is handled by the caller? This means that running yarn splash
will show this message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People need to learn about it somehow or we're always going to get messages from people like "hey how do I turn off yarn splash". Even if we let people on Slack know, there's outside contributors and new people joining all the time.
I see what you mean about this showing up when people run the standalone command. I can make it show up when storybook is running, but not when it's run by itself. How about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree that showing a message is good for awareness 👍
My question was around whether it's appropriate to have the message living in scripts/splash/
, when the code that handles what's advertised by the message lives elsewhere (in the webpack config).
Alternatively, would it make more sense to handle the conditional for DISABLE_SPLASH
in scripts/splash/index.ts
, so both the message and the condition live under the same roof?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried doing it in the webpack config but webpack overrides stdout so I can't just echo.
I could create a separate script for it but I think that would be adding too much complexity for very little gain
package.json
Outdated
"prepublish": "in-publish && yarn run build || :", | ||
"postpublish": "in-publish && npm-run-all new-version-pr-generator", | ||
"dev": "npm-run-all copy-polaris-tokens storybook", | ||
"dev-no-splash": "DISABLE_SPLASH=1 yarn run dev", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this warrants adding a new script – it might be okay to tell people to run DISABLE_SPLASH=1 yarn run dev
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same reason as above, I wanted to document it so that people can find the option easily.
If we don't add a command, how many people are going to dig into the code to figure out they can set an environment variable? Probably not a lot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The console message and Splash's README do a great job telling people about the DISABLE_SPLASH
trick.
I see your point about adding even more discoverability, however having 2 ways of achieving the same thing means we have to document and provide support/answer questions about both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the support we need to provide for a yarn command? Seems fairly straightforward to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the support we need to provide for a yarn command?
When yarn splash fails or needs to be disabled for any reason, we'd be giving people 3 ways of disabling it:
DISABLE_SPLASH=1 yarn dev
DISABLE_SPLASH=1
environment variable +yarn dev
yarn dev-no-splash
(probably doesn't work in Windows, btw)
It's not a lot of overhead, but it adds to the overall cognitive load for contributors.
Also, if people start using yarn dev-no-splash
and we want to remove it later, we'll be disrupting their developer experience (and I really don't want us to have to think about a deprecation path for custom yarn scripts).
Plus, that's less documentation for us to write and keep up to date 🎉
PS: I agree with the intent behind having it more discoverable, but I'm not sure it's appropriate to do it that way, especially since the console message & README doc are great ways to advertise this feature.
.storybook/webpack.config.js
Outdated
shell: true, | ||
stdio: 'inherit', | ||
}); | ||
process.env.DISABLE_SPLASH || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variable is a great idea 👍
UNRELEASED.md
Outdated
### Development workflow | ||
|
||
- Removed the need to upload assets with each release ([#2346](https://github.com/Shopify/polaris-react/pull/2346)) | ||
- Made running yarn splash along with the storybook optional ([#2372](https://github.com/Shopify/polaris-react/pull/2372)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could save people a click by telling them a bit more about this.
Here's a suggestion:
- Made running yarn splash along with the storybook optional ([#2372](https://github.com/Shopify/polaris-react/pull/2372)) | |
- Made it possible to prevent [“splash”](https://github.com/Shopify/polaris-react/tree/master/scripts/splash) from automatically running alongside `yarn dev`: `DISABLE_SPLASH=1 yarn dev` ([#2372](https://github.com/Shopify/polaris-react/pull/2372)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions and suggestions – will 🎩 as a second pass when those are answered.
The reason I made it this way is discoverability. I think we should keep the message in there for sure. I'd prefer to keep the command in there too, since the storybook output is very noisy and I think people might not find it, but this is redundant if we have the message in there so I'm ok with removing it if you want to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great, thanks for doing this @amrocha!
I do think the script inside the package json was a good idea. It's a natural place to look for that sort of thing. Not a blocker, just my 2 cents.
c644e4b
to
f5f4a78
Compare
1. Edit files in `src/`, such as components 🧩 and style sheets 🎨. | ||
2. As you run `yarn dev`, `yarn splash` will run in the background. Keep an eye on the terminal to see the splash zone of your changes in the working directory. | ||
|
||
💡 Tip: to disable these reports, run `DISABLE_SPLASH=1 yarn dev` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to indent this tip?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep 👍 (it's nested under the list item)
WHY are these changes introduced?
Yarn splash can be really noisy at times
WHAT is this pull request doing?
Enables maintainers running
yarn dev
to hideyarn splash
reports from the console by runningDISABLE_SPLASH=1 yarn dev
(#2372)