-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
src: set default config as node.config.json #57171
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -911,29 +911,30 @@ added: v23.6.0 | |
Enable experimental import support for `.node` addons. | ||
|
||
### `--experimental-config-file` | ||
### `--experimental-config-file=config` | ||
|
||
<!-- YAML | ||
added: REPLACEME | ||
--> | ||
|
||
> Stability: 1.0 - Early development | ||
Use this flag to specify a configuration file that will be loaded and parsed | ||
before the application starts. | ||
If present, Node.js will look for a | ||
configuration file at the specified path. | ||
Node.js will read the configuration file and apply the settings. | ||
The configuration file should be a JSON file | ||
with the following structure: | ||
|
||
> \[!NOTE] | ||
> Replace `vX.Y.Z` in the `$schema` with the version of Node.js you are using. | ||
```json | ||
{ | ||
"$schema": "https://nodejs.org/dist/REPLACEME/docs/node_config_json_schema.json", | ||
"$schema": "https://nodejs.org/dist/vX.Y.Z/docs/node-config-schema.json", | ||
"nodeOptions": { | ||
"experimental-transform-types": true, | ||
"import": [ | ||
"amaro/transform" | ||
"amaro/strip" | ||
], | ||
"disable-warning": "ExperimentalWarning", | ||
"watch-path": "src", | ||
"watch-preserve-output": true | ||
} | ||
|
@@ -944,7 +945,7 @@ In the `nodeOptions` field, only flags that are allowed in [`NODE_OPTIONS`][] ar | |
No-op flags are not supported. | ||
Not all V8 flags are currently supported. | ||
|
||
It is possible to use the [official JSON schema](../node_config_json_schema.json) | ||
It is possible to use the [official JSON schema](../node-config-schema.json) | ||
to validate the configuration file, which may vary depending on the Node.js version. | ||
Each key in the configuration file corresponds to a flag that can be passed | ||
as a command-line argument. The value of the key is the value that would be | ||
|
@@ -954,7 +955,7 @@ For example, the configuration file above is equivalent to | |
the following command-line arguments: | ||
|
||
```bash | ||
node --experimental-transform-types --import amaro/transform --disable-warning=ExperimentalWarning --watch-path=src --watch-preserve-output | ||
node --import amaro/strip --watch-path=src --watch-preserve-output | ||
``` | ||
|
||
The priority in configuration is as follows: | ||
|
@@ -976,6 +977,18 @@ unknown keys or keys that cannot used in `NODE_OPTIONS`. | |
Node.js will not sanitize or perform validation on the user-provided configuration, | ||
so **NEVER** use untrusted configuration files. | ||
|
||
### `--experimental-default-config-file` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When the day comes that we load Personally I think |
||
|
||
<!-- YAML | ||
added: REPLACEME | ||
--> | ||
|
||
> Stability: 1.0 - Early development | ||
If the `--experimental-default-config-file` flag is present, Node.js will look for a | ||
`node.config.json` file in the current working directory and load it as a | ||
as configuration file. | ||
|
||
### `--experimental-eventsource` | ||
|
||
<!-- YAML | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"nodeOptions": { | ||
"max-http-header-size": 10 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"nodeOptions": { | ||
"max-http-header-size": 20 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"nodeOptions": { | ||
"max-http-header-size": 10 | ||
} | ||
} |
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.
Re #57485 , the
../
points tohttps://nodejs.org/node-config-schema.json
when undernodejs.org/api/
, was this the intention?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.
yes https://nodejs.org/docs/latest/api/cli.html#--experimental-config-fileconfig you can check its working on the website
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.
But the link is broken when reading the docs under
nodejs.org/api
, was the intention to have a file at https://nodejs.org/node-config-schema.json that just returns the latest config schema?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.
yes feel free to send a pr
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.
Please ping web-infra for these types of changes in the future so we know to support it when its released