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

src: set default config as node.json #57171

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

marco-ippolito
Copy link
Member

This PR changes the current behavior:

node --experimental-config-file foo.js

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

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

node --experimental-config-file-path=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 71.42857% with 4 lines in your changes missing coverage. Please review.

Project coverage is 90.36%. Comparing base (8fc919d) to head (f1b6d67).
Report is 4 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.36%   +0.01%     
==========================================
  Files         629      629              
  Lines      184308   184382      +74     
  Branches    36015    36025      +10     
==========================================
+ Hits       166532   166619      +87     
- Misses      10909    10911       +2     
+ Partials     6867     6852      -15     
Files with missing lines Coverage Δ
src/node_options.cc 85.23% <100.00%> (-0.10%) ⬇️
src/node_options.h 98.33% <100.00%> (+<0.01%) ⬆️
src/node_config_file.cc 64.80% <63.63%> (+1.77%) ⬆️

... and 27 files with indirect coverage changes

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. 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.

5 participants