Skip to content

Commit bd58fe4

Browse files
committed
refactor: update cli-config.schema
1 parent 916b470 commit bd58fe4

1 file changed

Lines changed: 14 additions & 20 deletions

File tree

lib/package.js

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import GlobPatterns from "#core/glob/patterns";
1414
import Locale from "#core/locale";
1515
import SemanticVersion from "#core/semantic-version";
1616
import Table from "#core/text/table";
17-
import { confirm, objectIsEmpty, repeatAction, shellQuote } from "#core/utils";
17+
import { confirm, mergeObjects, objectIsEmpty, repeatAction, shellQuote } from "#core/utils";
1818
import * as yaml from "#core/yaml";
1919
import Git from "#lib/git";
2020
import lintFile from "#lib/lint/file";
@@ -1422,30 +1422,24 @@ export default class Package {
14221422
}
14231423

14241424
if ( directories.size ) {
1425-
const schedule = {
1426-
"interval": this.cliConfig.meta.dependabot.npm.interval,
1427-
};
1425+
const config = mergeObjects(
1426+
{
1427+
"package-ecosystem": "npm",
1428+
"registries": "*",
1429+
"directories": [ ...directories ].sort(),
1430+
},
1431+
this.cliConfig.meta.dependabot.npm.config
1432+
);
14281433

1429-
if ( schedule.interval === "cron" ) {
1430-
schedule.cronjob = this.cliConfig.meta.dependabot.npm.cronjob;
1434+
if ( config.schedule.day ) {
1435+
config.schedule.day = config.schedule.day?.toLowerCase();
14311436
}
1432-
else {
1433-
schedule.day = this.cliConfig.meta.dependabot.npm.day?.toLowerCase();
14341437

1435-
if ( this.cliConfig.meta.dependabot.npm.time ) {
1436-
schedule.time = new Locale().formatDate( Temporal.PlainTime.from( this.cliConfig.meta.dependabot.npm.time ), "timeStyle:short" );
1437-
}
1438+
if ( config.schedule.time ) {
1439+
config.schedule.time = new Locale().formatDate( Temporal.PlainTime.from( config.schedule.time ), "timeStyle:short" );
14381440
}
14391441

1440-
schedule.timezone = this.cliConfig.meta.dependabot.npm.timezone;
1441-
1442-
updates.set( "npm", {
1443-
"package-ecosystem": "npm",
1444-
"registries": "*",
1445-
"directories": [ ...directories ].sort(),
1446-
schedule,
1447-
"open-pull-requests-limit": this.cliConfig.meta.dependabot.npm[ "open-pull-requests-limit" ],
1448-
} );
1442+
updates.set( "npm", config );
14491443

14501444
registries.set( "npm.pkg.github.com", {
14511445
"type": "npm-registry",

0 commit comments

Comments
 (0)