-
Notifications
You must be signed in to change notification settings - Fork 392
feat!: run build by default before deploy #7195
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
feat!: run build by default before deploy #7195
Conversation
📊 Benchmark resultsComparing with 0d48c28
|
fa80263
to
5f44426
Compare
9dc32fe
to
24376c5
Compare
5f44426
to
6a799b0
Compare
6a799b0
to
a4ab697
Compare
a4ab697
to
433b1c4
Compare
This small change updates the `deploy` command to run the configured `build` command before deployment. Users who prefer the previous behavior can opt out by specifying `--no-build` when running `netlify deploy`.
433b1c4
to
db74b2a
Compare
@@ -109,7 +109,19 @@ Support for package.json's main field, and intrinsic index.js entrypoints are co | |||
'build', | |||
), | |||
) | |||
.option('--build', 'Run build command before deploying', false) | |||
.addOption( | |||
new Option('--build', 'Do not use - this is now the default. Will be removed in future versions.') |
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.
FWIW I don't think this string can ever be seen
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.
Yeah these only get added to generated cli.netlify.com docs
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.
Well, because we have hideHelp()
it isn't even included there
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.
😎
Summary
This updates the
deploy
command to run the configuredbuild
command before deployment by default. Previously, this was achieved by passing the--build
flag.To opt into the previous behavior, users can now specify
netlify deploy --no-build
.Why are we changing this?
This has long been one of the most common sources of confusion with the Netlify CLI. Developers expect a "deploy" command to deploy their project. We're making this change to follow the Principle of Least Surprise and streamline the experience for new users.
Upgrading
(most common) Build and deploy
Remove the
--build
flag:netlify deploy --build [...] # before
→
netlify deploy [...] # after
Separate build and deploy
Warning
Make sure your deploy command runs in your expected environment, e.g. if you were running
FOO=bar netlify build && netlify deploy
, make sureFOO
is visible to the deploy command, which is now running the build:FOO=bar netlify deploy
.Collapse into one command, if you can:
→
netlify deploy # after
Otherwise, add the
--no-build
flag:→
(rare) Deploy without build step
Add the
--no-build
flag:netlify deploy [...] # before (there was no `--build` here)
→