Skip to content

Commit

Permalink
ci: Refactor generateConventionalCommitsScopes script
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnAngela committed Mar 11, 2024
1 parent 935095a commit a9ff034
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scripts/generateConventionalCommitsScopes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ for (const dirent of dirents) {
const prefix = type[0].toUpperCase() + type.slice(1).replace(/s$/, "");
console.info(`[${type}]`, "prefix:", prefix);
const listSet = new Set();
if (type === "gadgets") {
if (["gadgets", "@types"].includes(type)) {
for (const item of await fs.promises.readdir(path.join("src", type))) {
listSet.add(item);
}
Expand All @@ -35,19 +35,18 @@ for (const dirent of dirents) {
const list = sortWithLowerFirstCharacter([...listSet]);
console.info(`[${type}]`, "list after sorting:", list);
const scopes = list.map((_name) => {
let name;
let name = _name;
switch (prefix) {
case "Gadget":
case "Group": {
name = _name;
break;
}
default: {
name = _name.replace(/^MediaWiki:|\.js(?=#|$)/g, "");
break;
}
}
return `${prefix}-${name}`;
return `${prefix}/${name}`;
});
console.info(`[${type}]`, "scopes:", scopes);
totalScopes.push(...scopes);
Expand Down

0 comments on commit a9ff034

Please sign in to comment.