diff --git a/doc/api/cli.md b/doc/api/cli.md index 6e0b337a2a39b7..ac5b1107ac9fde 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1040,7 +1040,7 @@ added: > 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 +`package.json` file in the current working directory and load it as a as configuration file. ### `--experimental-eventsource` diff --git a/doc/node-config-schema.json b/doc/node-config-schema.json index bffae1fc617917..64a4e387642ba7 100644 --- a/doc/node-config-schema.json +++ b/doc/node-config-schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "additionalProperties": false, + "additionalProperties": true, "properties": { "$schema": { "type": "string" diff --git a/doc/node.1 b/doc/node.1 index 691a5c914859b2..62086b36f23dd5 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -173,7 +173,7 @@ Enable experimental addon module support. Specifies the configuration file to load. . .It Fl -experimental-default-config-file -Enable support for automatically loading node.config.json. +Enable support for automatically loading configuration from package.json. . .It Fl -experimental-import-meta-resolve Enable experimental ES modules support for import.meta.resolve(). diff --git a/lib/internal/options.js b/lib/internal/options.js index be1dc6a842c526..9b363a34eb770f 100644 --- a/lib/internal/options.js +++ b/lib/internal/options.js @@ -65,7 +65,7 @@ function generateConfigJsonSchema() { const schema = { __proto__: null, $schema: 'https://json-schema.org/draft/2020-12/schema', - additionalProperties: false, + additionalProperties: true, properties: { $schema: { __proto__: null, diff --git a/src/node_config_file.cc b/src/node_config_file.cc index e6c049b4d14f10..98033874516479 100644 --- a/src/node_config_file.cc +++ b/src/node_config_file.cc @@ -31,7 +31,7 @@ std::optional ConfigReader::GetDataFromArgs( } if (has_default_config_file) { - return "node.config.json"; + return "package.json"; } return std::nullopt; diff --git a/test/fixtures/rc/default/node.config.json b/test/fixtures/rc/default/package.json similarity index 100% rename from test/fixtures/rc/default/node.config.json rename to test/fixtures/rc/default/package.json diff --git a/test/fixtures/test-runner/flag-propagation/node.config.json b/test/fixtures/test-runner/flag-propagation/package.json similarity index 100% rename from test/fixtures/test-runner/flag-propagation/node.config.json rename to test/fixtures/test-runner/flag-propagation/package.json diff --git a/test/parallel/test-config-file.js b/test/parallel/test-config-file.js index cc235bfadae146..a411b31f242aaa 100644 --- a/test/parallel/test-config-file.js +++ b/test/parallel/test-config-file.js @@ -350,7 +350,7 @@ test('broken value in node_options', async () => { strictEqual(result.code, 9); }); -test('should use node.config.json as default', async () => { +test('should use package.json as default', async () => { const result = await spawnPromisified(process.execPath, [ '--no-warnings', '--experimental-default-config-file', @@ -363,7 +363,7 @@ test('should use node.config.json as default', async () => { strictEqual(result.code, 0); }); -test('should override node.config.json when specificied', async () => { +test('should override package.json when specificied', async () => { const result = await spawnPromisified(process.execPath, [ '--no-warnings', '--experimental-default-config-file', @@ -383,7 +383,7 @@ test('should throw an error when the file is non readable', { skip: isWindows || process.getuid() === 0, }, async () => { tmpdir.refresh(); - const dest = join(tmpdir.path, 'node.config.json'); + const dest = join(tmpdir.path, 'package.json'); writeFileSync(dest, JSON.stringify({ nodeOptions: { 'max-http-header-size': 10 } })); @@ -395,7 +395,7 @@ test('should throw an error when the file is non readable', { ], { cwd: tmpdir.path, }); - match(result.stderr, /Cannot read configuration from node\.config\.json: permission denied/); + match(result.stderr, /Cannot read configuration from package\.json: permission denied/); strictEqual(result.stdout, ''); strictEqual(result.code, 9); }); diff --git a/test/parallel/test-runner-flag-propagation.js b/test/parallel/test-runner-flag-propagation.js index d5190251ef8db7..d89d896bd4e128 100644 --- a/test/parallel/test-runner-flag-propagation.js +++ b/test/parallel/test-runner-flag-propagation.js @@ -15,7 +15,7 @@ const runner = path.join(fixtureDir, 'runner.mjs'); describe('test runner flag propagation', () => { describe('via command line', () => { const flagPropagationTests = [ - ['--experimental-config-file', 'node.config.json', ''], + ['--experimental-config-file', 'package.json', ''], ['--experimental-default-config-file', '', false], ['--env-file', '.env', '.env'], ['--env-file-if-exists', '.env', '.env'],