Skip to content

Commit 011552c

Browse files
committed
refactor: update cli-config.schema
1 parent bd58fe4 commit 011552c

1 file changed

Lines changed: 26 additions & 37 deletions

File tree

lib/package.js

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,30 +1451,24 @@ export default class Package {
14511451

14521452
// docker
14531453
if ( this.cliConfig?.meta.dependabot.docker?.enabled && this.hasDockerfile ) {
1454-
const schedule = {
1455-
"interval": this.cliConfig.meta.dependabot.docker.interval,
1456-
};
1454+
const config = mergeObjects(
1455+
{
1456+
"package-ecosystem": "docker",
1457+
"registries": "*",
1458+
"directories": [ "/" ],
1459+
},
1460+
this.cliConfig.meta.dependabot.docker.config
1461+
);
14571462

1458-
if ( schedule.interval === "cron" ) {
1459-
schedule.cronjob = this.cliConfig.meta.dependabot.docker.cronjob;
1463+
if ( config.schedule.day ) {
1464+
config.schedule.day = config.schedule.day?.toLowerCase();
14601465
}
1461-
else {
1462-
schedule.day = this.cliConfig.meta.dependabot.docker.day?.toLowerCase();
14631466

1464-
if ( this.cliConfig.meta.dependabot.docker.time ) {
1465-
schedule.time = new Locale().formatDate( Temporal.PlainTime.from( this.cliConfig.meta.dependabot.docker.time ), "timeStyle:short" );
1466-
}
1467+
if ( config.schedule.time ) {
1468+
config.schedule.time = new Locale().formatDate( Temporal.PlainTime.from( config.schedule.time ), "timeStyle:short" );
14671469
}
14681470

1469-
schedule.timezone = this.cliConfig.meta.dependabot.docker.timezone;
1470-
1471-
updates.set( "docker", {
1472-
"package-ecosystem": "docker",
1473-
"registries": "*",
1474-
"directories": [ "/" ],
1475-
schedule,
1476-
"open-pull-requests-limit": this.cliConfig.meta.dependabot.docker[ "open-pull-requests-limit" ],
1477-
} );
1471+
updates.set( "docker", config );
14781472

14791473
registries.set( "ghcr.io", {
14801474
"type": "docker-registry",
@@ -1505,29 +1499,24 @@ export default class Package {
15051499
}
15061500

15071501
if ( directories.size ) {
1508-
const schedule = {
1509-
"interval": this.cliConfig.meta.dependabot[ "github-actions" ].interval,
1510-
};
1502+
const config = mergeObjects(
1503+
{
1504+
"package-ecosystem": "github-actions",
1505+
"registries": "*",
1506+
"directories": [ ...directories ].sort(),
1507+
},
1508+
this.cliConfig.meta.dependabot[ "github-actions" ].config
1509+
);
15111510

1512-
if ( schedule.interval === "cron" ) {
1513-
schedule.cronjob = this.cliConfig.meta.dependabot[ "github-actions" ].cronjob;
1511+
if ( config.schedule.day ) {
1512+
config.schedule.day = config.schedule.day?.toLowerCase();
15141513
}
1515-
else {
1516-
schedule.day = this.cliConfig.meta.dependabot[ "github-actions" ].day?.toLowerCase();
15171514

1518-
if ( this.cliConfig.meta.dependabot[ "github-actions" ].time ) {
1519-
schedule.time = new Locale().formatDate( Temporal.PlainTime.from( this.cliConfig.meta.dependabot[ "github-actions" ].time ), "timeStyle:short" );
1520-
}
1515+
if ( config.schedule.time ) {
1516+
config.schedule.time = new Locale().formatDate( Temporal.PlainTime.from( config.schedule.time ), "timeStyle:short" );
15211517
}
15221518

1523-
schedule.timezone = this.cliConfig.meta.dependabot[ "github-actions" ].timezone;
1524-
1525-
updates.set( "github-actions", {
1526-
"package-ecosystem": "github-actions",
1527-
"directories": [ ...directories ].sort(),
1528-
schedule,
1529-
"open-pull-requests-limit": this.cliConfig.meta.dependabot[ "github-actions" ][ "open-pull-requests-limit" ],
1530-
} );
1519+
updates.set( "github-actions", config );
15311520
}
15321521
}
15331522

0 commit comments

Comments
 (0)