Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(createPackage): sort label files #8892

Merged
merged 2 commits into from Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/labeler.yml
Expand Up @@ -4,7 +4,6 @@ apps:guide:
apps:website:
- apps/website/*
- apps/website/**/*

packages:brokers:
- packages/brokers/*
- packages/brokers/**/*
Expand Down Expand Up @@ -32,9 +31,9 @@ packages:proxy-container:
packages:rest:
- packages/rest/*
- packages/rest/**/*
packages/ui:
- packages:ui/*
- packages:ui/**/*
packages:ui:
- packages/ui/*
- packages/ui/**/*
packages:util:
- packages/util/*
- packages/util/**/*
Expand Down
8 changes: 4 additions & 4 deletions .github/labels.yml
Expand Up @@ -20,10 +20,10 @@
color: 0075ca
- name: dependencies
color: 276bd1
- name: discussion
color: b6b1f9
- name: discord
color: '5663e9'
- name: discussion
color: b6b1f9
- name: documentation
color: 0075ca
- name: duplicate
Expand All @@ -40,12 +40,12 @@
color: 4b1f8e
- name: help wanted
color: '008672'
- name: interactions
color: 80c042
- name: in progress
color: ffccd7
- name: in review
color: aed5fc
- name: interactions
color: 80c042
- name: invalid
color: e4e669
- name: need repro
Expand Down
9 changes: 8 additions & 1 deletion packages/scripts/src/createPackage.ts
Expand Up @@ -58,12 +58,19 @@ export async function createPackage(packageName: string, packageDescription?: st
const labelsYAML = parseYAML(await readFile('labels.yml', 'utf8')) as LabelerData[];
labelsYAML.push({ name: `packages:${packageName}`, color: 'fbca04' });

labelsYAML.sort((a, b) => a.name.localeCompare(b.name));

await writeFile('labels.yml', stringifyYAML(labelsYAML));

const labelerYAML = parseYAML(await readFile('labeler.yml', 'utf8')) as Record<string, string[]>;
labelerYAML[`packages/${packageName}`] = [`packages:${packageName}/*`, `packages:${packageName}/**/*`];

await writeFile('labeler.yml', stringifyYAML(labelerYAML));
const sortedLabelerYAML: Record<string, string[]> = {};
for (const key of Object.keys(labelerYAML).sort((a, b) => a.localeCompare(b))) {
sortedLabelerYAML[key] = labelerYAML[key]!;
}

await writeFile('labeler.yml', stringifyYAML(sortedLabelerYAML));

// Move back to root
chdir('..');
Expand Down