-
Notifications
You must be signed in to change notification settings - Fork 368
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: add --prod
flag to dev
command
#5338
Merged
Merged
Changes from 23 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
087f7dd
feat: add `--serve` flag to `dev` command
eduardoboucas b3f582d
refactor: simplify internal directory clean up
eduardoboucas 90402fd
refactor: load built functions
eduardoboucas d5652e7
refactor: make things nicer
eduardoboucas ac6a845
refactor: add const
eduardoboucas 134bf3f
feat: show debug message
eduardoboucas d782283
refactor: rename variable
eduardoboucas 7a0d578
Merge branch 'main' into feat/serve-command
eduardoboucas 5411c3c
chore: add `extract-zip` dependency
eduardoboucas 05e9dc3
chore: update snapshots
eduardoboucas 3ec828b
refactor: conditionally set `quiet` flag
eduardoboucas 1a89050
refactor: simplify code
eduardoboucas 2d8d2d0
chore: update docs
eduardoboucas 78c35b6
refactor: rename flag to `prod`
eduardoboucas 0bcc9a2
refactor: update message
eduardoboucas 4090013
feat: do not set `NETLIFY_DEV` when `prod` is set
eduardoboucas 9be736b
chore: remove lint exceptions
eduardoboucas e3eea4a
Apply suggestions from code review
eduardoboucas 2934233
refactor: treat `NETLIFY_DEV` consistently across function types
eduardoboucas ebb2334
refactor: add `internal` source for env vars
eduardoboucas 01df8a3
fix: handle internal vars correctly
eduardoboucas 59297c1
chore: update docs
eduardoboucas 917fc13
refactor: remove unused variable
eduardoboucas ae74853
feat: set `context=production` when `prod` is used
eduardoboucas f3cc600
refactor: add beta label
eduardoboucas f4a2dfd
Merge branch 'main' into feat/serve-command
eduardoboucas dbd9dcc
chore: remove ESLint directive
eduardoboucas bc5c59d
fix: fix imports
eduardoboucas 496783a
refactor: always start functions server
eduardoboucas a92f755
refactor: ensure internal functions directory
eduardoboucas af00758
refactor: reinstate functions server check
eduardoboucas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,5 +98,11 @@ module.exports = { | |
], | ||
}, | ||
}, | ||
{ | ||
files: ['tests/**/*'], | ||
rules: { | ||
'require-await': 'off', | ||
}, | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just creeping on your PR 😄 How does this work with or in contrast to the context flag (documented above), that you can also set to
production
?ie
netlify dev --context production
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 CLI doc above mentions only environment variables, but our docs site makes it sound like using the context flag builds your site for production - so this would need to be updated if that's not correct)
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.
Your creeping is very much welcome and that's a great point! The CLI docs are correct: the
context
flag only affects environment variables. This makes me wonder whether we should repurposecontext
and introduce this new behaviour (i.e. actually building the site for production) whencontext
isproduction
. And we could make--prod
an alias for--context=production
.I think that would make things more consistency, with just two concerns worth considering:
context
triggers this behaviour, rather than an entirely new flag.But if we decide not to reuse
context
, it'll be a bit difficult to explain why you have--prod
and--context=production
.@ascorbic What are your thoughts on this one?
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 thought about this a bit more and I feel that a more manageable step would be to keep
context
as is (i.e. just about environment variables) and makeprod
automatically set--context=production
, so that you're building the production site and using the production env vars.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.
Now that we have named the flag
prod
, I agree that making it automatically set--context=production
feels most intuitiveThere 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 why I sugegsted having it as a separate command. Using
ntl dev
when it's building for production is a little unintuitiveThere 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.
Building a separate command is a bigger lift (if done properly) that unfortunately I don't have the capacity for right now. I've pushed ae74853 which sets
--context=production
when--prod
is set, and in f3cc600 added a "beta" label to the flag in the help menu. We do this for other commands.I suggest that we ship this as is and then iterate on it. If we come to the conclusion that this makes more sense as a separate command, we can break it out and deprecate
--prod
.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, that is a good compromise. Does our CLI lib support aliases? If so, that would probably be the simplest solution.
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.
#5351 turns the flag into a separate command. We can get it merged after this one.