support .config directory
This commit is contained in:
parent
7ea27c7a14
commit
cd48e520b4
11
README.md
11
README.md
@ -32,7 +32,7 @@ All `pkg` options support glob matching via [picomatch](https://github.com/micro
|
||||
|
||||
## Config File
|
||||
|
||||
Put a `updates.config.js` or `updates.config.mjs` in the root of your project, usually besides `package.json` to configure certain options of the module. CLI arguments have precedence over options in the config file, except for `include` and `exclude` options which are merged.
|
||||
The config file is used to configure certain options of the module. CLI arguments have precedence over options in the config file, except for `include` and `exclude` options which are merged.
|
||||
|
||||
```js
|
||||
export default {
|
||||
@ -44,6 +44,15 @@ export default {
|
||||
};
|
||||
```
|
||||
|
||||
### Config File Locations
|
||||
|
||||
The config file can be placed in these locations, relative to `package.json` is:
|
||||
|
||||
- `updates.config.js`
|
||||
- `updates.config.mjs`
|
||||
- `.config/updates.js`
|
||||
- `.config/updates.mjs`
|
||||
|
||||
### Config File Options
|
||||
|
||||
- `include` *Array[String|Regexp]*: Array of dependencies to include
|
||||
|
11
updates.js
11
updates.js
@ -776,12 +776,13 @@ async function main() {
|
||||
|
||||
let config = {};
|
||||
try {
|
||||
config = (await import(join(projectDir, "updates.config.js"))).default;
|
||||
} catch {
|
||||
try {
|
||||
config = (await import(join(projectDir, "updates.config.mjs"))).default;
|
||||
({default: config} = await Promise.any([
|
||||
"updates.config.js",
|
||||
"updates.config.mjs",
|
||||
".config/updates.js",
|
||||
".config/updates.mjs",
|
||||
].map(str => import(join(projectDir, ...str.split("/"))))));
|
||||
} catch {}
|
||||
}
|
||||
|
||||
let includeCli, excludeCli;
|
||||
if (args.include && args.include !== true) { // cli
|
||||
|
Loading…
Reference in New Issue
Block a user