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

feat: add serve command #5351

Merged
merged 48 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
087f7dd
feat: add `--serve` flag to `dev` command
eduardoboucas Dec 23, 2022
b3f582d
refactor: simplify internal directory clean up
eduardoboucas Dec 23, 2022
90402fd
refactor: load built functions
eduardoboucas Jan 2, 2023
d5652e7
refactor: make things nicer
eduardoboucas Jan 2, 2023
ac6a845
refactor: add const
eduardoboucas Jan 2, 2023
134bf3f
feat: show debug message
eduardoboucas Jan 3, 2023
d782283
refactor: rename variable
eduardoboucas Jan 3, 2023
7a0d578
Merge branch 'main' into feat/serve-command
eduardoboucas Jan 3, 2023
5411c3c
chore: add `extract-zip` dependency
eduardoboucas Jan 3, 2023
05e9dc3
chore: update snapshots
eduardoboucas Jan 3, 2023
3ec828b
refactor: conditionally set `quiet` flag
eduardoboucas Jan 3, 2023
1a89050
refactor: simplify code
eduardoboucas Jan 3, 2023
2d8d2d0
chore: update docs
eduardoboucas Jan 3, 2023
78c35b6
refactor: rename flag to `prod`
eduardoboucas Jan 3, 2023
0bcc9a2
refactor: update message
eduardoboucas Jan 3, 2023
4090013
feat: do not set `NETLIFY_DEV` when `prod` is set
eduardoboucas Jan 3, 2023
9be736b
chore: remove lint exceptions
eduardoboucas Jan 3, 2023
e3eea4a
Apply suggestions from code review
eduardoboucas Jan 3, 2023
2934233
refactor: treat `NETLIFY_DEV` consistently across function types
eduardoboucas Jan 3, 2023
ebb2334
refactor: add `internal` source for env vars
eduardoboucas Jan 3, 2023
01df8a3
fix: handle internal vars correctly
eduardoboucas Jan 3, 2023
59297c1
chore: update docs
eduardoboucas Jan 3, 2023
917fc13
refactor: remove unused variable
eduardoboucas Jan 3, 2023
ae74853
feat: set `context=production` when `prod` is used
eduardoboucas Jan 4, 2023
f3cc600
refactor: add beta label
eduardoboucas Jan 4, 2023
32cf4b5
feat: create separate `serve` command
eduardoboucas Jan 6, 2023
4739d22
Update src/commands/serve/serve.mjs
eduardoboucas Jan 6, 2023
42ae1bb
refactor: remove unused flags
eduardoboucas Jan 6, 2023
f4f31fb
refactor: abort server when build fails
eduardoboucas Jan 6, 2023
28bd294
refactor: always start functions server
eduardoboucas Jan 9, 2023
f4a2dfd
Merge branch 'main' into feat/serve-command
eduardoboucas Jan 9, 2023
dbd9dcc
chore: remove ESLint directive
eduardoboucas Jan 9, 2023
bc5c59d
fix: fix imports
eduardoboucas Jan 9, 2023
496783a
refactor: always start functions server
eduardoboucas Jan 9, 2023
a92f755
refactor: ensure internal functions directory
eduardoboucas Jan 9, 2023
af00758
refactor: reinstate functions server check
eduardoboucas Jan 9, 2023
48872f6
Merge branch 'feat/serve-command' into feat/serve-command-2
eduardoboucas Jan 9, 2023
e357598
refactor: add missing import
eduardoboucas Jan 9, 2023
66dc887
fix: fix imports
eduardoboucas Jan 9, 2023
b8f9666
Merge branch 'main' into feat/serve-command-2
eduardoboucas Jan 9, 2023
f28d164
refactor: move logic for ensuring internal functions directory
eduardoboucas Jan 9, 2023
7306853
chore: fix test
eduardoboucas Jan 9, 2023
4c55658
chore: update docs
eduardoboucas Jan 9, 2023
96e79a1
chore: update snapshot
eduardoboucas Jan 9, 2023
431e531
refactor: add log message
eduardoboucas Jan 9, 2023
c873f68
Update src/commands/serve/serve.mjs
eduardoboucas Jan 9, 2023
ad1dbf4
chore: update docs
eduardoboucas Jan 9, 2023
527efcf
Merge branch 'main' into feat/serve-command-2
eduardoboucas Jan 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ See the [CLI command line reference](https://cli.netlify.com/commands/) to get s
- [login](#login)
- [open](#open)
- [recipes](#recipes)
- [serve](#serve)
- [sites](#sites)
- [status](#status)
- [switch](#switch)
Expand Down Expand Up @@ -219,6 +220,10 @@ Open settings for the site linked to the current folder
| [`recipes:list`](/docs/commands/recipes.md#recipeslist) | (Beta) List the recipes available to create and modify files in a project |


### [serve](/docs/commands/serve.md)

(Beta) Build the site for production and serve locally. This does not watch the code for changes, so if you need to rebuild your site then you must exit and run `serve` again.

### [sites](/docs/commands/sites.md)

Handle various site operations
Expand Down
4 changes: 4 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ Open settings for the site linked to the current folder
| [`recipes:list`](/docs/commands/recipes.md#recipeslist) | (Beta) List the recipes available to create and modify files in a project |


### [serve](/docs/commands/serve.md)

(Beta) Build the site for production and serve locally. This does not watch the code for changes, so if you need to rebuild your site then you must exit and run `serve` again.

### [sites](/docs/commands/sites.md)

Handle various site operations
Expand Down
1 change: 0 additions & 1 deletion docs/commands/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ netlify dev
- `live` (*boolean*) - start a public live session
- `offline` (*boolean*) - disables any features that require network access
- `port` (*string*) - port of netlify dev
- `prod` (*boolean*) - (Beta) build the site for production and serve locally
- `sessionId` (*string*) - (Graph) connect to cloud session with ID [sessionId]
- `targetPort` (*string*) - port of target app server
- `debug` (*boolean*) - Print debugging information
Expand Down
4 changes: 4 additions & 0 deletions docs/commands/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ Open settings for the site linked to the current folder
| [`recipes:list`](/docs/commands/recipes.md#recipeslist) | (Beta) List the recipes available to create and modify files in a project |


### [serve](/docs/commands/serve.md)

(Beta) Build the site for production and serve locally. This does not watch the code for changes, so if you need to rebuild your site then you must exit and run `serve` again.

### [sites](/docs/commands/sites.md)

Handle various site operations
Expand Down
5 changes: 1 addition & 4 deletions src/commands/base-command.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,7 @@ export default class BaseCommand extends Command {
* @returns {string}
*/
getDefaultContext() {
const { prod } = this.opts()
const isDevCommand = ['dev', 'dev:exec'].includes(this.name())

if (isDevCommand && prod) {
if (this.name() === 'serve') {
return 'production'
}

Expand Down
Loading