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
|
## 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
|
```js
|
||||||
export default {
|
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
|
### Config File Options
|
||||||
|
|
||||||
- `include` *Array[String|Regexp]*: Array of dependencies to include
|
- `include` *Array[String|Regexp]*: Array of dependencies to include
|
||||||
|
13
updates.js
13
updates.js
@ -776,12 +776,13 @@ async function main() {
|
|||||||
|
|
||||||
let config = {};
|
let config = {};
|
||||||
try {
|
try {
|
||||||
config = (await import(join(projectDir, "updates.config.js"))).default;
|
({default: config} = await Promise.any([
|
||||||
} catch {
|
"updates.config.js",
|
||||||
try {
|
"updates.config.mjs",
|
||||||
config = (await import(join(projectDir, "updates.config.mjs"))).default;
|
".config/updates.js",
|
||||||
} catch {}
|
".config/updates.mjs",
|
||||||
}
|
].map(str => import(join(projectDir, ...str.split("/"))))));
|
||||||
|
} catch {}
|
||||||
|
|
||||||
let includeCli, excludeCli;
|
let includeCli, excludeCli;
|
||||||
if (args.include && args.include !== true) { // cli
|
if (args.include && args.include !== true) { // cli
|
||||||
|
Loading…
Reference in New Issue
Block a user