create-typescript-app 1.29.27 → 1.29.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabels.d.ts +8 -0
- package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabels.js +14 -0
- package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabels.js.map +1 -0
- package/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.js +13 -7
- package/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.js.map +1 -1
- package/package.json +1 -1
- package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabel.d.ts +0 -8
- package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabel.js +0 -14
- package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabel.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const aliases = /* @__PURE__ */ new Map([
|
|
2
|
+
["enhancement", "type: feature"],
|
|
3
|
+
["help wanted", "status: accepting prs"]
|
|
4
|
+
]);
|
|
5
|
+
function getExistingEquivalentLabels(existingLabels, outcomeLabelName) {
|
|
6
|
+
const outcomeTrimmed = outcomeLabelName.replace(/\w+: (\w+)/, "$1");
|
|
7
|
+
return existingLabels.filter(({ name: existingName }) => {
|
|
8
|
+
return existingName === outcomeLabelName || existingName === outcomeTrimmed || aliases.get(existingName) === outcomeLabelName || existingName.replace(/\w+: (\w+)/, "$1") === outcomeLabelName;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
getExistingEquivalentLabels
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=getExistingEquivalentLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/steps/initializeGitHubRepository/labels/getExistingEquivalentLabels.ts"],"sourcesContent":["const aliases = new Map([\n\t[\"enhancement\", \"type: feature\"],\n\t[\"help wanted\", \"status: accepting prs\"],\n]);\n\nexport interface GhLabelData {\n\tcolor: string;\n\tdescription: string;\n\tname: string;\n}\n\nexport function getExistingEquivalentLabels(\n\texistingLabels: GhLabelData[],\n\toutcomeLabelName: string,\n) {\n\tconst outcomeTrimmed = outcomeLabelName.replace(/\\w+: (\\w+)/, \"$1\");\n\n\treturn existingLabels.filter(({ name: existingName }) => {\n\t\treturn (\n\t\t\texistingName === outcomeLabelName ||\n\t\t\texistingName === outcomeTrimmed ||\n\t\t\taliases.get(existingName) === outcomeLabelName ||\n\t\t\texistingName.replace(/\\w+: (\\w+)/, \"$1\") === outcomeLabelName\n\t\t);\n\t});\n}\n"],"mappings":"AAAA,MAAM,UAAU,oBAAI,IAAI;AAAA,EACvB,CAAC,eAAe,eAAe;AAAA,EAC/B,CAAC,eAAe,uBAAuB;AACxC,CAAC;AAQM,SAAS,4BACf,gBACA,kBACC;AACD,QAAM,iBAAiB,iBAAiB,QAAQ,cAAc,IAAI;AAElE,SAAO,eAAe,OAAO,CAAC,EAAE,MAAM,aAAa,MAAM;AACxD,WACC,iBAAiB,oBACjB,iBAAiB,kBACjB,QAAQ,IAAI,YAAY,MAAM,oBAC9B,aAAa,QAAQ,cAAc,IAAI,MAAM;AAAA,EAE/C,CAAC;AACF;","names":[]}
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import { $ } from "execa";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./
|
|
3
|
+
getExistingEquivalentLabels
|
|
4
|
+
} from "./getExistingEquivalentLabels.js";
|
|
5
5
|
import { outcomeLabels } from "./outcomeLabels.js";
|
|
6
6
|
async function initializeRepositoryLabels() {
|
|
7
7
|
const existingLabels = JSON.parse(
|
|
8
8
|
(await $`gh label list --json color,description,name`).stdout || "[]"
|
|
9
9
|
);
|
|
10
10
|
for (const outcome of outcomeLabels) {
|
|
11
|
-
const
|
|
11
|
+
const existingEquivalents = getExistingEquivalentLabels(
|
|
12
12
|
existingLabels,
|
|
13
13
|
outcome.name
|
|
14
14
|
);
|
|
15
|
-
if (
|
|
16
|
-
|
|
15
|
+
if (!existingEquivalents.length) {
|
|
16
|
+
await $`gh label create ${outcome.name} --color ${outcome.color} --description ${outcome.description}`;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
for (const existingEquivalent of existingEquivalents) {
|
|
20
|
+
if (existingEquivalent.name !== outcome.name && existingLabels.some((existing) => existing.name === outcome.name)) {
|
|
21
|
+
await $`gh label delete ${existingEquivalent.name} --yes`;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (outcome.color !== existingEquivalent.color || outcome.description !== existingEquivalent.description || outcome.name !== existingEquivalent.name) {
|
|
17
25
|
await $`gh label edit ${existingEquivalent.name} --color ${outcome.color} --description ${outcome.description} --name ${outcome.name}`;
|
|
18
26
|
}
|
|
19
|
-
} else {
|
|
20
|
-
await $`gh label create ${outcome.name} --color ${outcome.color} --description ${outcome.description}`;
|
|
21
27
|
}
|
|
22
28
|
}
|
|
23
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.ts"],"sourcesContent":["import { $ } from \"execa\";\n\nimport {\n\tGhLabelData,\n\
|
|
1
|
+
{"version":3,"sources":["../../../../src/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.ts"],"sourcesContent":["import { $ } from \"execa\";\n\nimport {\n\tGhLabelData,\n\tgetExistingEquivalentLabels,\n} from \"./getExistingEquivalentLabels.js\";\nimport { outcomeLabels } from \"./outcomeLabels.js\";\n\nexport async function initializeRepositoryLabels() {\n\tconst existingLabels = JSON.parse(\n\t\t(await $`gh label list --json color,description,name`).stdout || \"[]\",\n\t) as GhLabelData[];\n\n\tfor (const outcome of outcomeLabels) {\n\t\tconst existingEquivalents = getExistingEquivalentLabels(\n\t\t\texistingLabels,\n\t\t\toutcome.name,\n\t\t);\n\n\t\t// Case: the repo has neither of the two label types\n\t\tif (!existingEquivalents.length) {\n\t\t\tawait $`gh label create ${outcome.name} --color ${outcome.color} --description ${outcome.description}`;\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const existingEquivalent of existingEquivalents) {\n\t\t\t// Case: the repo already has both prefixed and non-prefixed label name types\n\t\t\t// E.g. both \"area: documentation\" and \"documentation\"\n\t\t\tif (\n\t\t\t\texistingEquivalent.name !== outcome.name &&\n\t\t\t\texistingLabels.some((existing) => existing.name === outcome.name)\n\t\t\t) {\n\t\t\t\tawait $`gh label delete ${existingEquivalent.name} --yes`;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Case: the repo has one of the two label types, with >=1 different property\n\t\t\t// E.g. \"documentation\" and the same color and description\n\t\t\t// E.g. \"area: documentation\" but with a different color\n\t\t\tif (\n\t\t\t\toutcome.color !== existingEquivalent.color ||\n\t\t\t\toutcome.description !== existingEquivalent.description ||\n\t\t\t\toutcome.name !== existingEquivalent.name\n\t\t\t) {\n\t\t\t\tawait $`gh label edit ${existingEquivalent.name} --color ${outcome.color} --description ${outcome.description} --name ${outcome.name}`;\n\t\t\t}\n\t\t}\n\t}\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAElB;AAAA,EAEC;AAAA,OACM;AACP,SAAS,qBAAqB;AAE9B,eAAsB,6BAA6B;AAClD,QAAM,iBAAiB,KAAK;AAAA,KAC1B,MAAM,gDAAgD,UAAU;AAAA,EAClE;AAEA,aAAW,WAAW,eAAe;AACpC,UAAM,sBAAsB;AAAA,MAC3B;AAAA,MACA,QAAQ;AAAA,IACT;AAGA,QAAI,CAAC,oBAAoB,QAAQ;AAChC,YAAM,oBAAoB,QAAQ,IAAI,YAAY,QAAQ,KAAK,kBAAkB,QAAQ,WAAW;AACpG;AAAA,IACD;AAEA,eAAW,sBAAsB,qBAAqB;AAGrD,UACC,mBAAmB,SAAS,QAAQ,QACpC,eAAe,KAAK,CAAC,aAAa,SAAS,SAAS,QAAQ,IAAI,GAC/D;AACD,cAAM,oBAAoB,mBAAmB,IAAI;AACjD;AAAA,MACD;AAKA,UACC,QAAQ,UAAU,mBAAmB,SACrC,QAAQ,gBAAgB,mBAAmB,eAC3C,QAAQ,SAAS,mBAAmB,MACnC;AACD,cAAM,kBAAkB,mBAAmB,IAAI,YAAY,QAAQ,KAAK,kBAAkB,QAAQ,WAAW,WAAW,QAAQ,IAAI;AAAA,MACrI;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-typescript-app",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.29",
|
|
4
4
|
"description": "Quickstart-friendly TypeScript template with comprehensive formatting, linting, releases, testing, and other great tooling built-in. ✨",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const aliases = /* @__PURE__ */ new Map([
|
|
2
|
-
["enhancement", "type: feature"],
|
|
3
|
-
["help wanted", "status: accepting prs"]
|
|
4
|
-
]);
|
|
5
|
-
function getExistingEquivalentLabel(existingLabels, outcomeLabel) {
|
|
6
|
-
const outcomeTrimmed = outcomeLabel.replace(/\w+: (\w+)/, "$1");
|
|
7
|
-
return existingLabels.find(({ name: existingName }) => {
|
|
8
|
-
return existingName === outcomeLabel || existingName === outcomeTrimmed || aliases.get(existingName) === outcomeLabel || existingName.replace(/\w+: (\w+)/, "$1") === outcomeLabel;
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
getExistingEquivalentLabel
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=getExistingEquivalentLabel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/steps/initializeGitHubRepository/labels/getExistingEquivalentLabel.ts"],"sourcesContent":["const aliases = new Map([\n\t[\"enhancement\", \"type: feature\"],\n\t[\"help wanted\", \"status: accepting prs\"],\n]);\n\nexport interface GhLabelData {\n\tcolor: string;\n\tdescription: string;\n\tname: string;\n}\n\nexport function getExistingEquivalentLabel(\n\texistingLabels: GhLabelData[],\n\toutcomeLabel: string,\n) {\n\tconst outcomeTrimmed = outcomeLabel.replace(/\\w+: (\\w+)/, \"$1\");\n\n\treturn existingLabels.find(({ name: existingName }) => {\n\t\treturn (\n\t\t\texistingName === outcomeLabel ||\n\t\t\texistingName === outcomeTrimmed ||\n\t\t\taliases.get(existingName) === outcomeLabel ||\n\t\t\texistingName.replace(/\\w+: (\\w+)/, \"$1\") === outcomeLabel\n\t\t);\n\t});\n}\n"],"mappings":"AAAA,MAAM,UAAU,oBAAI,IAAI;AAAA,EACvB,CAAC,eAAe,eAAe;AAAA,EAC/B,CAAC,eAAe,uBAAuB;AACxC,CAAC;AAQM,SAAS,2BACf,gBACA,cACC;AACD,QAAM,iBAAiB,aAAa,QAAQ,cAAc,IAAI;AAE9D,SAAO,eAAe,KAAK,CAAC,EAAE,MAAM,aAAa,MAAM;AACtD,WACC,iBAAiB,gBACjB,iBAAiB,kBACjB,QAAQ,IAAI,YAAY,MAAM,gBAC9B,aAAa,QAAQ,cAAc,IAAI,MAAM;AAAA,EAE/C,CAAC;AACF;","names":[]}
|