Skip to content

Commit 9cc2559

Browse files
committed
fix: Refactor repositories object in newConfig to only include necessary keys
This code change modifies the `newConfig.repositories` object to only include specific keys (`path`, `repo`, `exclude`) and remove all other keys through a filter process in a nested for loop. The `url` and `broadcast` keys in the `newConfig` object were also deleted.
1 parent 08dd309 commit 9cc2559

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/server.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,14 @@ module.exports = async function file(CoCreateConfig) {
410410

411411
newConfig.sources = sources
412412

413+
newConfig.repositories.forEach(obj => {
414+
for (const key in obj) {
415+
if (!["path", "repo", "exclude"].includes(key)) {
416+
delete obj[key];
417+
}
418+
}
419+
});
420+
413421
delete newConfig.url
414422
delete newConfig.broadcast
415423
const write_str = `module.exports = ${JSON.stringify(newConfig, null, 4)};`;

0 commit comments

Comments
 (0)