Skip to content

Commit ccb353e

Browse files
committed
Don't automatically recommend creating an issue on DT, because it'll basically just be ignored
1 parent 5c2c92b commit ccb353e

File tree

3 files changed

+43
-5
lines changed

3 files changed

+43
-5
lines changed

integration-tests/nested-scoped-packages/__snapshots__/nested-scoped-packages.test.ts.snap

-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ patch-package 0.0.0
88
• Diffing your files with clean files
99
✔ Created file patches/@microsoft+mezzurite-core++@types+angular+1.6.53.patch
1010
11-
💡 @types/angular is on GitHub! To draft an issue based on your patch run
12-
13-
yarn patch-package @microsoft/mezzurite-core/@types/angular --create-issue
14-
1511
END SNAPSHOT"
1612
`;
1713

src/createIssue.test.ts

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { shouldRecommendIssue } from "./createIssue"
2+
3+
describe(shouldRecommendIssue, () => {
4+
it("Allows most repos", () => {
5+
const eigen = shouldRecommendIssue({
6+
org: "artsy",
7+
repo: "eigen",
8+
provider: "GitHub",
9+
})
10+
expect(eigen).toBeTruthy()
11+
12+
const typescript = shouldRecommendIssue({
13+
org: "Microsoft",
14+
repo: "TypeScript",
15+
provider: "GitHub",
16+
})
17+
expect(typescript).toBeTruthy()
18+
})
19+
20+
it("does not recommend DefinitelyTyped", () => {
21+
const typescript = shouldRecommendIssue({
22+
org: "DefinitelyTyped",
23+
repo: "DefinitelyTyped",
24+
provider: "GitHub",
25+
})
26+
expect(typescript).toBeFalsy()
27+
})
28+
})

src/createIssue.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,26 @@ function getPackageVCSDetails(packageDetails: PackageDetails) {
4646
}
4747
}
4848

49+
export function shouldRecommendIssue(
50+
vcsDetails: ReturnType<typeof getPackageVCSDetails>,
51+
) {
52+
if (!vcsDetails) {
53+
return true
54+
}
55+
56+
const { repo, org } = vcsDetails
57+
if (repo === "DefinitelyTyped" && org === "DefinitelyTyped") {
58+
return false
59+
}
60+
return true
61+
}
62+
4963
export function maybePrintIssueCreationPrompt(
5064
packageDetails: PackageDetails,
5165
packageManager: PackageManager,
5266
) {
5367
const vcs = getPackageVCSDetails(packageDetails)
54-
if (vcs) {
68+
if (vcs && shouldRecommendIssue(vcs)) {
5569
console.log(`💡 ${chalk.bold(packageDetails.name)} is on ${
5670
vcs.provider
5771
}! To draft an issue based on your patch run

0 commit comments

Comments
 (0)