-
Notifications
You must be signed in to change notification settings - Fork 54
feat(config): auto-detect doc-kit.config.mjs in the working directory #901
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@node-core/doc-kit': patch | ||
| --- | ||
|
|
||
| Automatically load `doc-kit.config.mjs` from the current working directory. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| import { existsSync } from 'node:fs'; | ||
| import { cpus } from 'node:os'; | ||
| import { join } from 'node:path'; | ||
| import { isMainThread } from 'node:worker_threads'; | ||
|
|
||
| import { coerce } from 'semver'; | ||
|
|
@@ -123,15 +125,20 @@ export const assertRunnableOptions = config => { | |
| }; | ||
|
|
||
| /** | ||
| * Creates a complete run configuration by merging config file, user options, and defaults. | ||
| * Creates a complete run configuration by merging an explicit or auto-detected | ||
| * config file, user options, and defaults. | ||
| * Processes and validates configuration values including version coercion, changelog parsing, | ||
| * and constraint enforcement for threads and chunk size. | ||
| * | ||
| * @param {import('../../../bin/commands/generate.mjs').CLIOptions} options - User-provided configuration options | ||
| * @returns {Promise<import('./types').Configuration>} The configuration | ||
| */ | ||
| export const createRunConfiguration = async options => { | ||
| const config = await loadConfigFile(options.configFile); | ||
| const defaultConfigFile = join(process.cwd(), 'doc-kit.config.mjs'); | ||
| const configFile = | ||
| options.configFile ?? | ||
| (existsSync(defaultConfigFile) ? defaultConfigFile : undefined); | ||
| const config = await loadConfigFile(configFile); | ||
|
Comment on lines
135
to
+141
Member
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. the logic here is wrong you should do something like this:
Author
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. Thanks — understood. I will replace the single |
||
| config.target &&= enforceArray(config.target); | ||
|
|
||
| // Merge with defaults | ||
|
|
||
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.
What about:
.config.js.config.cjs.config.json?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.
their aren't supported by the code.
IMO we should also support
ts,cts,mtsas types strippable code