unjs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.unjs.io
MIT License
5.58k stars 481 forks source link

missing `static` option in docs #1524

Open Barbapapazes opened 11 months ago

Barbapapazes commented 11 months ago

Environment

/

Reproduction

/

Describe the bug

Hello,

In the configuration of the documentation, https://nitro.unjs.io/config, there is nothing related to a static option.

But as I can see here, https://github.com/unjs/nitro/blob/451d314657f0181bf065c413039509440df39c2b/src/options.ts#L187, or in this comment, https://github.com/nuxt/nuxt/pull/22471#discussion_r1283205835, this option is mapped to the static preset, https://github.com/unjs/nitro/blob/main/src/presets/static.ts.

We are mentioning it in the Nuxt documentation so having a link in the Nitro documentation would be appreciated!

Thanks

Additional context

No response

Logs

No response

pi0 commented 11 months ago

Thanks for notice. Since we introduce it as an internal flag, initially didn't document. Feel free to make a PR to add docs 👍🏼 (also there might be more of this missing API docs)

Barbapapazes commented 11 months ago

I was documenting but I found that the static option does not have the same behavior as the preset: 'static'.

I set up static: true in my config.

esteban@DESKTOP-HHLH0C1:~/dev/unjs/nitro$ nr dev:build

> nitropack@2.5.2 dev:build /home/esteban/dev/unjs/nitro
> pnpm nitro build playground

> nitropack@2.5.2 nitro /home/esteban/dev/unjs/nitro
> jiti ./src/cli/cli.ts "build" "playground"

undefined node-server true
static
static
✔ Generated public playground/.output/public                                                                                                                                                                                                            nitro 7:35:15 AM
✔ You can preview this build using node playground/.output/server/index.mjs                                                                                                                                                                             nitro 7:35:15 AM
esteban@DESKTOP-HHLH0C1:~/dev/unjs/nitro$ NITRO_PRESET=static nr dev:build

> nitropack@2.5.2 dev:build /home/esteban/dev/unjs/nitro
> pnpm nitro build playground

> nitropack@2.5.2 nitro /home/esteban/dev/unjs/nitro
> jiti ./src/cli/cli.ts "build" "playground"

undefined node-server true
static
static
✔ Generated public playground/.output/public                                                                                                                                                                                                            nitro 7:35:21 AM
ℹ Initializing prerenderer                                                                                                                                                                                                                              nitro 7:35:21 AM
false node-server false
nitro-prerender
nitro-prerender
ℹ Prerendering 1 initial routes with crawler                                                                                                                                                                                                            nitro 7:35:22 AM
  ├─ / (8ms)                                                                                                                                                                                                                                             nitro 7:35:22 AM
✔ You can preview this build using npx serve playground/.output/public     
Barbapapazes commented 11 months ago

It's like the static preset was not apply on config. Maybe it's the intended behavior but it looks strange.

esteban@DESKTOP-HHLH0C1:~/dev/unjs/nitro$ nr dev:build

> nitropack@2.5.2 dev:build /home/esteban/dev/unjs/nitro
> pnpm nitro build playground

> nitropack@2.5.2 nitro /home/esteban/dev/unjs/nitro
> jiti ./src/cli/cli.ts "build" "playground"

undefined node-server true
static
static
✔ Generated public playground/.output/public                                                                                                                                                                                                            nitro 7:39:34 AM
{
  concurrency: 1,
  interval: 0,
  failOnError: false,
  crawlLinks: false,
  ignore: [],
  routes: []
}
✔ You can preview this build using node playground/.output/server/index.mjs                                                                                                                                                                             nitro 7:39:34 AM
esteban@DESKTOP-HHLH0C1:~/dev/unjs/nitro$ NITRO_PRESET=static nr dev:build

> nitropack@2.5.2 dev:build /home/esteban/dev/unjs/nitro
> pnpm nitro build playground

> nitropack@2.5.2 nitro /home/esteban/dev/unjs/nitro
> jiti ./src/cli/cli.ts "build" "playground"

undefined node-server true
static
static
✔ Generated public playground/.output/public                                                                                                                                                                                                            nitro 7:39:38 AM
{
  concurrency: 1,
  interval: 0,
  failOnError: false,
  crawlLinks: true,
  ignore: [],
  routes: []
}
ℹ Initializing prerenderer                                                                                                                                                                                                                              nitro 7:39:38 AM
false node-server false
nitro-prerender
nitro-prerender
ℹ Prerendering 1 initial routes with crawler                                                                                                                                                                                                            nitro 7:39:39 AM
  ├─ / (8ms)                                                                                                                                                                                                                                             nitro 7:39:39 AM
✔ You can preview this build using npx serve playground/.output/public