Skip to content

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

Merged

Conversation

marco-ippolito
Copy link
Member

@marco-ippolito marco-ippolito commented Feb 21, 2025

This PR changes the current behavior:

node --experimental-default-config-file foo.js

Will automatically look for a node.config.json file (I dont have strong opinion on the default)

If a --experimental-config-file is provided it will use that:

node --experimental-config-file=foo.json foo.js

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Feb 21, 2025
@marco-ippolito marco-ippolito added the semver-minor PRs that contain new features and should be released in the next minor version. label Feb 21, 2025
@jasnell
Copy link
Member

jasnell commented Feb 21, 2025

Hmm, I'm a bit concerned about naming collisions with existing uses of node.json such as this https://github.com/kubeedge/kubeedge/blob/master/build/node.json.

@marco-ippolito
Copy link
Member Author

Maybe noderc.json? That should not have collisions (I HOPE 😆)

@targos
Copy link
Member

targos commented Feb 21, 2025

In any case, I don't think it should be unflagged from the first release.

@marco-ippolito
Copy link
Member Author

In any case, I don't think it should be unflagged from the first release.

it's not unflagged, I'm not sure what are you referring to

@targos
Copy link
Member

targos commented Feb 21, 2025

Okay then, I guess I didn't read the commit message correctly

Copy link

codecov bot commented Feb 21, 2025

Codecov Report

Attention: Patch coverage is 73.33333% with 4 lines in your changes missing coverage. Please review.

Project coverage is 90.26%. Comparing base (044d69a) to head (e38690d).
Report is 542 commits behind head on main.

Files with missing lines Patch % Lines
src/node_config_file.cc 63.63% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #57171      +/-   ##
==========================================
- Coverage   90.35%   90.26%   -0.09%     
==========================================
  Files         629      630       +1     
  Lines      184424   184643     +219     
  Branches    36034    36135     +101     
==========================================
+ Hits       166633   166673      +40     
- Misses      10913    11024     +111     
- Partials     6878     6946      +68     
Files with missing lines Coverage Δ
lib/internal/process/pre_execution.js 93.03% <100.00%> (-0.28%) ⬇️
src/node_options.cc 85.34% <100.00%> (+0.01%) ⬆️
src/node_options.h 98.33% <100.00%> (+<0.01%) ⬆️
src/node_config_file.cc 73.18% <63.63%> (+1.21%) ⬆️

... and 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jasnell
Copy link
Member

jasnell commented Feb 21, 2025

When searching I was only able to find examples of node.json in common use. Even nodejs.json might work (despite the ugly double js in there). Or .node.json (making it a dot prefixed file). The other possibility is that we look for a .nodejs directory in cwd and load .nodejs/config.json. Every option is likely equally unfortunate in their own special ways tho.

@marco-ippolito
Copy link
Member Author

Best options are
.node.json or
noderc.json imho, I'll try a survey on social media so see what people think

Copy link
Member

@anonrig anonrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this play with file permissions?

@marco-ippolito
Copy link
Member Author

How does this play with file permissions?

I added a test, also will need a rebase after #57170 lands.

There are 6k results for node.json on github:
https://github.com/search?q=path:**/node.json+language:JSON&type=code&l=JSON

I wish we could just take it 🥺

Otherwise:

  • node.config.json

  • nodejs.json

@darcyrush
Copy link

darcyrush commented Feb 24, 2025

Modern versions of eslint and prettier both support a version of .config naming notion such as eslint.config.cjs, so node.config.json would align nicely, and having .config in the name makes it pretty obvious and explicit.

@bricss
Copy link
Contributor

bricss commented Feb 24, 2025

IMO, node.config.json to de moon 🚀🌔

@marco-ippolito marco-ippolito marked this pull request as draft February 24, 2025 11:40
@marco-ippolito marco-ippolito force-pushed the default-value-node-json branch from f1b6d67 to 70b3289 Compare February 24, 2025 12:02
@marco-ippolito marco-ippolito changed the title src: set default config as node.json src: set default config as node.config.json Feb 24, 2025
@marco-ippolito marco-ippolito force-pushed the default-value-node-json branch from 70b3289 to e00ade9 Compare February 24, 2025 12:03
@marco-ippolito
Copy link
Member Author

node.config.json it is

@marco-ippolito marco-ippolito marked this pull request as ready for review February 24, 2025 12:05
@marco-ippolito marco-ippolito force-pushed the default-value-node-json branch 3 times, most recently from c0373f2 to 6456729 Compare February 24, 2025 12:16
@marco-ippolito marco-ippolito force-pushed the default-value-node-json branch 2 times, most recently from 434360e to 54b272c Compare February 25, 2025 06:03
aduh95 pushed a commit that referenced this pull request May 16, 2025
PR-URL: #57171
Backport-PR-URL: #57958
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
aduh95 pushed a commit that referenced this pull request May 17, 2025
PR-URL: #57171
Backport-PR-URL: #57958
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
aduh95 pushed a commit that referenced this pull request May 17, 2025
PR-URL: #57171
Backport-PR-URL: #57958
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
aduh95 pushed a commit that referenced this pull request May 17, 2025
PR-URL: #57171
Backport-PR-URL: #57958
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
aduh95 pushed a commit that referenced this pull request May 18, 2025
PR-URL: #57171
Backport-PR-URL: #57958
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
nodejs-github-bot added a commit that referenced this pull request May 19, 2025
Notable changes:

deps:
  * update timezone to 2025b (Node.js GitHub Bot) #57857
doc:
  * add dario-piotrowicz to collaborators (Dario Piotrowicz) #58102
  * (SEMVER-MINOR) graduate multiple experimental apis (James M Snell) #57765
esm:
  * (SEMVER-MINOR) graduate import.meta properties (James M Snell) #58011
  * (SEMVER-MINOR) support top-level Wasm without package type (Guy Bedford) #57610
sqlite:
  * (SEMVER-MINOR) add StatementSync.prototype.columns() (Colin Ihrig) #57490
src:
  * (SEMVER-MINOR) set default config as `node.config.json` (Marco Ippolito) #57171
  * (SEMVER-MINOR) create `THROW_ERR_OPTIONS_BEFORE_BOOTSTRAPPING` (Marco Ippolito) #57016
  * (SEMVER-MINOR) add config file support (Marco Ippolito) #57016
  * (SEMVER-MINOR) add ExecutionAsyncId getter for any Context (Attila Szegedi) #57820
stream:
  * (SEMVER-MINOR) preserve AsyncLocalStorage context in finished() (Gürgün Dayıoğlu) #57865
util:
  * (SEMVER-MINOR) add `types.isFloat16Array()` (Livia Medeiros) #57879
worker:
  * (SEMVER-MINOR) add worker.getHeapStatistics() (Matteo Collina) #57888

PR-URL: #58388
aduh95 pushed a commit that referenced this pull request May 19, 2025
PR-URL: #57171
Backport-PR-URL: #57958
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
aduh95 added a commit that referenced this pull request May 19, 2025
Notable changes:

deps:
  * update timezone to 2025b (Node.js GitHub Bot) #57857
doc:
  * add dario-piotrowicz to collaborators (Dario Piotrowicz) #58102
  * (SEMVER-MINOR) graduate multiple experimental apis (James M Snell) #57765
esm:
  * (SEMVER-MINOR) graduate import.meta properties (James M Snell) #58011
  * (SEMVER-MINOR) support top-level Wasm without package type (Guy Bedford) #57610
sqlite:
  * (SEMVER-MINOR) add StatementSync.prototype.columns() (Colin Ihrig) #57490
src:
  * (SEMVER-MINOR) set default config as `node.config.json` (Marco Ippolito) #57171
  * (SEMVER-MINOR) create `THROW_ERR_OPTIONS_BEFORE_BOOTSTRAPPING` (Marco Ippolito) #57016
  * (SEMVER-MINOR) add config file support (Marco Ippolito) #57016
  * (SEMVER-MINOR) add ExecutionAsyncId getter for any Context (Attila Szegedi) #57820
stream:
  * (SEMVER-MINOR) preserve AsyncLocalStorage context in finished() (Gürgün Dayıoğlu) #57865
util:
  * (SEMVER-MINOR) add `types.isFloat16Array()` (Livia Medeiros) #57879
worker:
  * (SEMVER-MINOR) add worker.getHeapStatistics() (Matteo Collina) #57888

PR-URL: TODO
aduh95 added a commit that referenced this pull request May 19, 2025
Notable changes:

deps:
  * update timezone to 2025b (Node.js GitHub Bot) #57857
doc:
  * add dario-piotrowicz to collaborators (Dario Piotrowicz) #58102
  * (SEMVER-MINOR) graduate multiple experimental apis (James M Snell) #57765
esm:
  * (SEMVER-MINOR) graduate import.meta properties (James M Snell) #58011
  * (SEMVER-MINOR) support top-level Wasm without package type (Guy Bedford) #57610
sqlite:
  * (SEMVER-MINOR) add StatementSync.prototype.columns() (Colin Ihrig) #57490
src:
  * (SEMVER-MINOR) set default config as `node.config.json` (Marco Ippolito) #57171
  * (SEMVER-MINOR) create `THROW_ERR_OPTIONS_BEFORE_BOOTSTRAPPING` (Marco Ippolito) #57016
  * (SEMVER-MINOR) add config file support (Marco Ippolito) #57016
  * (SEMVER-MINOR) add ExecutionAsyncId getter for any Context (Attila Szegedi) #57820
stream:
  * (SEMVER-MINOR) preserve AsyncLocalStorage context in finished() (Gürgün Dayıoğlu) #57865
util:
  * (SEMVER-MINOR) add `types.isFloat16Array()` (Livia Medeiros) #57879
worker:
  * (SEMVER-MINOR) add worker.getHeapStatistics() (Matteo Collina) #57888

PR-URL: #58388
aduh95 added a commit that referenced this pull request May 19, 2025
Notable changes:

deps:
  * update timezone to 2025b (Node.js GitHub Bot) #57857
doc:
  * add dario-piotrowicz to collaborators (Dario Piotrowicz) #58102
  * (SEMVER-MINOR) graduate multiple experimental apis (James M Snell) #57765
esm:
  * (SEMVER-MINOR) graduate import.meta properties (James M Snell) #58011
  * (SEMVER-MINOR) support top-level Wasm without package type (Guy Bedford) #57610
sqlite:
  * (SEMVER-MINOR) add StatementSync.prototype.columns() (Colin Ihrig) #57490
src:
  * (SEMVER-MINOR) set default config as `node.config.json` (Marco Ippolito) #57171
  * (SEMVER-MINOR) create `THROW_ERR_OPTIONS_BEFORE_BOOTSTRAPPING` (Marco Ippolito) #57016
  * (SEMVER-MINOR) add config file support (Marco Ippolito) #57016
  * (SEMVER-MINOR) add ExecutionAsyncId getter for any Context (Attila Szegedi) #57820
stream:
  * (SEMVER-MINOR) preserve AsyncLocalStorage context in finished() (Gürgün Dayıoğlu) #57865
util:
  * (SEMVER-MINOR) add `types.isFloat16Array()` (Livia Medeiros) #57879
worker:
  * (SEMVER-MINOR) add worker.getHeapStatistics() (Matteo Collina) #57888

PR-URL: #58388
aduh95 added a commit to aduh95/node that referenced this pull request May 20, 2025
Notable changes:

deps:
  * update timezone to 2025b (Node.js GitHub Bot) nodejs#57857
doc:
  * add dario-piotrowicz to collaborators (Dario Piotrowicz) nodejs#58102
  * (SEMVER-MINOR) graduate multiple experimental apis (James M Snell) nodejs#57765
esm:
  * (SEMVER-MINOR) graduate import.meta properties (James M Snell) nodejs#58011
  * (SEMVER-MINOR) support top-level Wasm without package type (Guy Bedford) nodejs#57610
sqlite:
  * (SEMVER-MINOR) add StatementSync.prototype.columns() (Colin Ihrig) nodejs#57490
src:
  * (SEMVER-MINOR) set default config as `node.config.json` (Marco Ippolito) nodejs#57171
  * (SEMVER-MINOR) create `THROW_ERR_OPTIONS_BEFORE_BOOTSTRAPPING` (Marco Ippolito) nodejs#57016
  * (SEMVER-MINOR) add config file support (Marco Ippolito) nodejs#57016
  * (SEMVER-MINOR) add ExecutionAsyncId getter for any Context (Attila Szegedi) nodejs#57820
stream:
  * (SEMVER-MINOR) preserve AsyncLocalStorage context in finished() (Gürgün Dayıoğlu) nodejs#57865
util:
  * (SEMVER-MINOR) add `types.isFloat16Array()` (Livia Medeiros) nodejs#57879
worker:
  * (SEMVER-MINOR) add worker.getHeapStatistics() (Matteo Collina) nodejs#57888

PR-URL: nodejs#58388
aduh95 added a commit that referenced this pull request May 21, 2025
Notable changes:

deps:
  * update timezone to 2025b (Node.js GitHub Bot) #57857
doc:
  * add dario-piotrowicz to collaborators (Dario Piotrowicz) #58102
  * (SEMVER-MINOR) graduate multiple experimental apis (James M Snell) #57765
esm:
  * (SEMVER-MINOR) graduate import.meta properties (James M Snell) #58011
  * (SEMVER-MINOR) support top-level Wasm without package type (Guy Bedford) #57610
sqlite:
  * (SEMVER-MINOR) add StatementSync.prototype.columns() (Colin Ihrig) #57490
src:
  * (SEMVER-MINOR) set default config as `node.config.json` (Marco Ippolito) #57171
  * (SEMVER-MINOR) create `THROW_ERR_OPTIONS_BEFORE_BOOTSTRAPPING` (Marco Ippolito) #57016
  * (SEMVER-MINOR) add config file support (Marco Ippolito) #57016
  * (SEMVER-MINOR) add ExecutionAsyncId getter for any Context (Attila Szegedi) #57820
stream:
  * (SEMVER-MINOR) preserve AsyncLocalStorage context in finished() (Gürgün Dayıoğlu) #57865
util:
  * (SEMVER-MINOR) add `types.isFloat16Array()` (Livia Medeiros) #57879
worker:
  * (SEMVER-MINOR) add worker.getHeapStatistics() (Matteo Collina) #57888

PR-URL: #58388
codebytere added a commit to electron/electron that referenced this pull request May 23, 2025
codebytere added a commit to electron/electron that referenced this pull request May 26, 2025
codebytere added a commit to electron/electron that referenced this pull request May 29, 2025
codebytere added a commit to electron/electron that referenced this pull request Jun 2, 2025
jkleinsc pushed a commit to electron/electron that referenced this pull request Jun 2, 2025
* chore: bump node in DEPS to v22.16.0

* crypto: remove BoringSSL dh-primes addition

nodejs/node#57023

* tools: enable linter in test/fixtures/test\-runner/output

nodejs/node#57698

* src: improve thread safety of TaskQueue

nodejs/node#57910

* buffer: define global v8::CFunction objects as const

nodejs/node#57676

* src: disable abseil deadlock detection

nodejs/node#57582

* zlib: fix pointer alignment

nodejs/node#57727

* chore: fixup patch indices

* src: set default config as node.config.json

nodejs/node#57171

* src: update std::vector<v8::Local<T>> to use v8::LocalVector<T>

nodejs/node#57578

* test: disable chmod tests failing in Docker

nodejs/node#58326

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <[email protected]>
codebytere added a commit to electron/electron that referenced this pull request Jun 3, 2025
codebytere added a commit to electron/electron that referenced this pull request Jun 3, 2025
codebytere added a commit to electron/electron that referenced this pull request Jun 3, 2025
codebytere added a commit to electron/electron that referenced this pull request Jun 3, 2025
codebytere added a commit to electron/electron that referenced this pull request Jun 3, 2025
codebytere added a commit to electron/electron that referenced this pull request Jun 3, 2025
codebytere added a commit to electron/electron that referenced this pull request Jun 4, 2025
* chore: bump node in DEPS to v22.16.0

* crypto: remove BoringSSL dh-primes addition

nodejs/node#57023

* tools: enable linter in test/fixtures/test\-runner/output

nodejs/node#57698

* src: improve thread safety of TaskQueue

nodejs/node#57910

* buffer: define global v8::CFunction objects as const

nodejs/node#57676

* src: disable abseil deadlock detection

nodejs/node#57582

* zlib: fix pointer alignment

nodejs/node#57727

* chore: fixup patch indices

* src: set default config as node.config.json

nodejs/node#57171

* src: update std::vector<v8::Local<T>> to use v8::LocalVector<T>

nodejs/node#57578

* test: disable chmod tests failing in Docker

nodejs/node#58326

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <[email protected]>
codebytere added a commit to electron/electron that referenced this pull request Jun 6, 2025
codebytere added a commit to electron/electron that referenced this pull request Jun 18, 2025
codebytere added a commit to electron/electron that referenced this pull request Jun 30, 2025
* chore: bump node in DEPS to v22.16.0

* crypto: remove BoringSSL dh-primes addition

nodejs/node#57023

* tools: enable linter in test/fixtures/test\-runner/output

nodejs/node#57698

* src: improve thread safety of TaskQueue

nodejs/node#57910

* buffer: define global v8::CFunction objects as const

nodejs/node#57676

* zlib: fix pointer alignment

nodejs/node#57727

* chore: fixup patch indices

* src: set default config as node.config.json

nodejs/node#57171

* src: update std::vector<v8::Local<T>> to use v8::LocalVector<T>

nodejs/node#57578

* test: disable chmod tests failing in Docker

nodejs/node#58326

* chore: fix out of date patch

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported-to-v22.x PRs backported to the v22.x-staging branch. c++ Issues and PRs that require attention from people who are familiar with C++. config Issues or PRs related to the config subsystem dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.