create-typescript-app 2.4.5 → 2.5.0

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.
Files changed (66) hide show
  1. package/lib/base.d.ts +13 -0
  2. package/lib/base.js +12 -0
  3. package/lib/blocks/blockAllContributors.d.ts +5 -0
  4. package/lib/blocks/blockAreTheTypesWrong.d.ts +5 -0
  5. package/lib/blocks/blockCSpell.d.ts +5 -0
  6. package/lib/blocks/blockCodecov.d.ts +5 -0
  7. package/lib/blocks/blockContributingDocs.d.ts +5 -0
  8. package/lib/blocks/blockContributorCovenant.d.ts +5 -0
  9. package/lib/blocks/blockDevelopmentDocs.d.ts +5 -0
  10. package/lib/blocks/blockESLint.d.ts +5 -0
  11. package/lib/blocks/blockESLintComments.d.ts +5 -0
  12. package/lib/blocks/blockESLintJSDoc.d.ts +5 -0
  13. package/lib/blocks/blockESLintJSONC.d.ts +5 -0
  14. package/lib/blocks/blockESLintMarkdown.d.ts +5 -0
  15. package/lib/blocks/blockESLintMoreStyling.d.ts +5 -0
  16. package/lib/blocks/blockESLintNode.d.ts +5 -0
  17. package/lib/blocks/blockESLintPackageJson.d.ts +5 -0
  18. package/lib/blocks/blockESLintPerfectionist.d.ts +5 -0
  19. package/lib/blocks/blockESLintRegexp.d.ts +5 -0
  20. package/lib/blocks/blockESLintYML.d.ts +5 -0
  21. package/lib/blocks/blockExampleFiles.d.ts +5 -0
  22. package/lib/blocks/blockFunding.d.ts +5 -0
  23. package/lib/blocks/blockGitHubActionsCI.d.ts +5 -0
  24. package/lib/blocks/blockGitHubApps.d.ts +5 -0
  25. package/lib/blocks/blockGitHubIssueTemplates.d.ts +5 -0
  26. package/lib/blocks/blockGitHubPRTemplate.d.ts +5 -0
  27. package/lib/blocks/blockGitignore.d.ts +5 -0
  28. package/lib/blocks/blockKnip.d.ts +5 -0
  29. package/lib/blocks/blockMITLicense.d.ts +5 -0
  30. package/lib/blocks/blockMarkdownlint.d.ts +5 -0
  31. package/lib/blocks/blockNvmrc.d.ts +5 -0
  32. package/lib/blocks/blockPRCompliance.d.ts +5 -0
  33. package/lib/blocks/blockPackageJson.d.ts +5 -0
  34. package/lib/blocks/blockPnpmDedupe.d.ts +5 -0
  35. package/lib/blocks/blockPrettier.d.ts +5 -0
  36. package/lib/blocks/blockPrettierPluginCurly.d.ts +5 -0
  37. package/lib/blocks/blockPrettierPluginPackageJson.d.ts +5 -0
  38. package/lib/blocks/blockPrettierPluginSh.d.ts +5 -0
  39. package/lib/blocks/blockREADME.d.ts +5 -0
  40. package/lib/blocks/blockReleaseIt.d.ts +5 -0
  41. package/lib/blocks/blockRenovate.d.ts +5 -0
  42. package/lib/blocks/blockRepositoryBranchRuleset.d.ts +6 -1
  43. package/lib/blocks/blockRepositoryBranchRuleset.js +25 -32
  44. package/lib/blocks/blockRepositoryLabels.d.ts +5 -0
  45. package/lib/blocks/blockRepositoryLabels.js +47 -12
  46. package/lib/blocks/blockRepositorySecrets.d.ts +5 -0
  47. package/lib/blocks/blockRepositorySettings.d.ts +5 -0
  48. package/lib/blocks/blockRepositorySettings.js +22 -23
  49. package/lib/blocks/blockSecurityDocs.d.ts +5 -0
  50. package/lib/blocks/blockTSup.d.ts +5 -0
  51. package/lib/blocks/blockTemplatedWith.d.ts +5 -0
  52. package/lib/blocks/blockTypeScript.d.ts +5 -0
  53. package/lib/blocks/blockVSCode.d.ts +5 -0
  54. package/lib/blocks/blockVitest.d.ts +5 -0
  55. package/lib/blocks/index.d.ts +215 -0
  56. package/lib/blocks/outcomeLabels.js +2 -2
  57. package/lib/data/packageData.d.ts +7 -5
  58. package/lib/index.d.ts +18 -0
  59. package/lib/options/getExistingLabels.d.ts +9 -0
  60. package/lib/options/getExistingLabels.js +22 -0
  61. package/lib/presets/common.d.ts +13 -0
  62. package/lib/presets/everything.d.ts +13 -0
  63. package/lib/presets/index.d.ts +39 -0
  64. package/lib/presets/minimal.d.ts +13 -0
  65. package/lib/template.d.ts +13 -0
  66. package/package.json +7 -5
@@ -5,19 +5,18 @@ const blockRepositoryBranchRuleset = base.createBlock({
5
5
  name: "Repository Branch Ruleset"
6
6
  },
7
7
  addons: {
8
- requiredStatusChecks: z.array(z.string()).default([])
8
+ requiredStatusChecks: z.array(z.string()).optional()
9
9
  },
10
10
  setup({ addons, options }) {
11
11
  return {
12
12
  requests: [
13
13
  {
14
- id: "branch-ruleset-create",
15
- async send({ octokit }) {
16
- await octokit.request(
17
- "POST /repos/{owner}/{repo}/rulesets",
18
- createInnerSend(addons.requiredStatusChecks, options)
19
- );
20
- }
14
+ endpoint: "POST /repos/{owner}/{repo}/rulesets",
15
+ parameters: createRulesetParameters(
16
+ addons.requiredStatusChecks,
17
+ options
18
+ ),
19
+ type: "octokit"
21
20
  }
22
21
  ]
23
22
  };
@@ -25,25 +24,21 @@ const blockRepositoryBranchRuleset = base.createBlock({
25
24
  transition({ addons, options }) {
26
25
  return {
27
26
  requests: [
28
- {
29
- id: "branch-ruleset-update",
30
- async send({ octokit }) {
31
- if (options.rulesetId) {
32
- await octokit.request(
33
- `PUT /repos/{owner}/{repo}/rulesets/{ruleset_id}`,
34
- createInnerSend(
35
- addons.requiredStatusChecks,
36
- options,
37
- options.rulesetId
38
- )
39
- );
40
- } else {
41
- await octokit.request(
42
- `POST /repos/{owner}/{repo}/rulesets/{ruleset_id}`,
43
- createInnerSend(addons.requiredStatusChecks, options)
44
- );
45
- }
46
- }
27
+ options.rulesetId ? {
28
+ endpoint: "PUT /repos/{owner}/{repo}/rulesets/{ruleset_id}",
29
+ parameters: createRulesetParameters(
30
+ addons.requiredStatusChecks,
31
+ options,
32
+ options.rulesetId
33
+ ),
34
+ type: "octokit"
35
+ } : {
36
+ endpoint: "POST /repos/{owner}/{repo}/rulesets",
37
+ parameters: createRulesetParameters(
38
+ addons.requiredStatusChecks,
39
+ options
40
+ ),
41
+ type: "octokit"
47
42
  }
48
43
  ]
49
44
  };
@@ -54,7 +49,7 @@ const blockRepositoryBranchRuleset = base.createBlock({
54
49
  return {};
55
50
  }
56
51
  });
57
- function createInnerSend(contexts, options, rulesetId) {
52
+ function createRulesetParameters(contexts, options, rulesetId) {
58
53
  return {
59
54
  bypass_actors: [
60
55
  {
@@ -90,16 +85,14 @@ function createInnerSend(contexts, options, rulesetId) {
90
85
  },
91
86
  {
92
87
  parameters: {
93
- required_status_checks: contexts.map((context) => ({
88
+ required_status_checks: contexts?.map((context) => ({
94
89
  context
95
- })),
90
+ })) ?? [],
96
91
  strict_required_status_checks_policy: false
97
92
  },
98
93
  type: "required_status_checks"
99
94
  }
100
95
  ],
101
- // Type fun because the GitHub Octokit APIs don't provide named types...
102
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
103
96
  ruleset_id: rulesetId === void 0 ? rulesetId : Number(rulesetId),
104
97
  target: "branch"
105
98
  };
@@ -21,6 +21,11 @@ declare const blockRepositoryLabels: bingo_stratum.BlockWithoutAddons<{
21
21
  profile: string;
22
22
  }[] | undefined;
23
23
  documentation?: string | undefined;
24
+ existingLabels?: {
25
+ name: string;
26
+ description: string;
27
+ color: string;
28
+ }[] | undefined;
24
29
  explainer?: string[] | undefined;
25
30
  funding?: string | undefined;
26
31
  guide?: {
@@ -1,4 +1,4 @@
1
- import { setGitHubRepositoryLabels } from "set-github-repository-labels";
1
+ import { determineLabelChanges } from "set-github-repository-labels";
2
2
  import { base } from "../base.js";
3
3
  import { outcomeLabels } from "./outcomeLabels.js";
4
4
  const blockRepositoryLabels = base.createBlock({
@@ -6,19 +6,54 @@ const blockRepositoryLabels = base.createBlock({
6
6
  name: "Repository Labels"
7
7
  },
8
8
  produce({ options }) {
9
+ const changes = determineLabelChanges(
10
+ options.existingLabels ?? [],
11
+ outcomeLabels
12
+ );
13
+ const requestData = {
14
+ owner: options.owner,
15
+ repo: options.repository
16
+ };
9
17
  return {
10
- requests: [
11
- {
12
- id: "repository-labels",
13
- async send() {
14
- await setGitHubRepositoryLabels({
15
- labels: outcomeLabels,
16
- owner: options.owner,
17
- repository: options.repository
18
- });
19
- }
18
+ requests: changes.map((change) => {
19
+ switch (change.type) {
20
+ case "delete":
21
+ return {
22
+ endpoint: "DELETE /repos/{owner}/{repo}/labels/{name}",
23
+ id: `delete label '${change.name}'`,
24
+ parameters: {
25
+ ...requestData,
26
+ name: change.name
27
+ },
28
+ type: "octokit"
29
+ };
30
+ case "patch":
31
+ return {
32
+ endpoint: "PATCH /repos/{owner}/{repo}/labels/{name}",
33
+ id: `patch label '${change.originalName}'`,
34
+ parameters: {
35
+ ...requestData,
36
+ color: change.color,
37
+ description: change.description,
38
+ name: change.originalName,
39
+ new_name: change.newName
40
+ },
41
+ type: "octokit"
42
+ };
43
+ case "post":
44
+ return {
45
+ endpoint: "POST /repos/{owner}/{repo}/labels",
46
+ id: `post label '${change.name}'`,
47
+ parameters: {
48
+ ...requestData,
49
+ color: change.color,
50
+ description: change.description,
51
+ name: change.name
52
+ },
53
+ type: "octokit"
54
+ };
20
55
  }
21
- ]
56
+ })
22
57
  };
23
58
  }
24
59
  });
@@ -26,6 +26,11 @@ declare const blockRepositorySecrets: bingo_stratum.BlockWithAddons<{
26
26
  profile: string;
27
27
  }[] | undefined;
28
28
  documentation?: string | undefined;
29
+ existingLabels?: {
30
+ name: string;
31
+ description: string;
32
+ color: string;
33
+ }[] | undefined;
29
34
  explainer?: string[] | undefined;
30
35
  funding?: string | undefined;
31
36
  guide?: {
@@ -21,6 +21,11 @@ declare const blockRepositorySettings: bingo_stratum.BlockWithoutAddons<{
21
21
  profile: string;
22
22
  }[] | undefined;
23
23
  documentation?: string | undefined;
24
+ existingLabels?: {
25
+ name: string;
26
+ description: string;
27
+ color: string;
28
+ }[] | undefined;
24
29
  explainer?: string[] | undefined;
25
30
  funding?: string | undefined;
26
31
  guide?: {
@@ -9,30 +9,29 @@ const blockRepositorySettings = base.createBlock({
9
9
  return {
10
10
  requests: [
11
11
  {
12
- id: "repository-settings",
13
- async send({ octokit }) {
14
- await octokit.rest.repos.update({
15
- allow_auto_merge: true,
16
- allow_merge_commit: false,
17
- allow_rebase_merge: false,
18
- allow_squash_merge: true,
19
- delete_branch_on_merge: true,
20
- description,
21
- has_wiki: false,
22
- owner: options.owner,
23
- repo: options.repository,
24
- security_and_analysis: {
25
- secret_scanning: {
26
- status: "enabled"
27
- },
28
- secret_scanning_push_protection: {
29
- status: "enabled"
30
- }
12
+ endpoint: "PATCH /repos/{owner}/{repo}",
13
+ parameters: {
14
+ allow_auto_merge: true,
15
+ allow_merge_commit: false,
16
+ allow_rebase_merge: false,
17
+ allow_squash_merge: true,
18
+ delete_branch_on_merge: true,
19
+ description,
20
+ has_wiki: false,
21
+ owner: options.owner,
22
+ repo: options.repository,
23
+ security_and_analysis: {
24
+ secret_scanning: {
25
+ status: "enabled"
31
26
  },
32
- squash_merge_commit_message: "PR_BODY",
33
- squash_merge_commit_title: "PR_TITLE"
34
- });
35
- }
27
+ secret_scanning_push_protection: {
28
+ status: "enabled"
29
+ }
30
+ },
31
+ squash_merge_commit_message: "PR_BODY",
32
+ squash_merge_commit_title: "PR_TITLE"
33
+ },
34
+ type: "octokit"
36
35
  }
37
36
  ]
38
37
  };
@@ -21,6 +21,11 @@ declare const blockSecurityDocs: bingo_stratum.BlockWithoutAddons<{
21
21
  profile: string;
22
22
  }[] | undefined;
23
23
  documentation?: string | undefined;
24
+ existingLabels?: {
25
+ name: string;
26
+ description: string;
27
+ color: string;
28
+ }[] | undefined;
24
29
  explainer?: string[] | undefined;
25
30
  funding?: string | undefined;
26
31
  guide?: {
@@ -24,6 +24,11 @@ declare const blockTSup: bingo_stratum.BlockWithAddons<{
24
24
  profile: string;
25
25
  }[] | undefined;
26
26
  documentation?: string | undefined;
27
+ existingLabels?: {
28
+ name: string;
29
+ description: string;
30
+ color: string;
31
+ }[] | undefined;
27
32
  explainer?: string[] | undefined;
28
33
  funding?: string | undefined;
29
34
  guide?: {
@@ -21,6 +21,11 @@ declare const blockTemplatedWith: bingo_stratum.BlockWithoutAddons<{
21
21
  profile: string;
22
22
  }[] | undefined;
23
23
  documentation?: string | undefined;
24
+ existingLabels?: {
25
+ name: string;
26
+ description: string;
27
+ color: string;
28
+ }[] | undefined;
24
29
  explainer?: string[] | undefined;
25
30
  funding?: string | undefined;
26
31
  guide?: {
@@ -21,6 +21,11 @@ declare const blockTypeScript: bingo_stratum.BlockWithoutAddons<{
21
21
  profile: string;
22
22
  }[] | undefined;
23
23
  documentation?: string | undefined;
24
+ existingLabels?: {
25
+ name: string;
26
+ description: string;
27
+ color: string;
28
+ }[] | undefined;
24
29
  explainer?: string[] | undefined;
25
30
  funding?: string | undefined;
26
31
  guide?: {
@@ -30,6 +30,11 @@ declare const blockVSCode: bingo_stratum.BlockWithAddons<{
30
30
  profile: string;
31
31
  }[] | undefined;
32
32
  documentation?: string | undefined;
33
+ existingLabels?: {
34
+ name: string;
35
+ description: string;
36
+ color: string;
37
+ }[] | undefined;
33
38
  explainer?: string[] | undefined;
34
39
  funding?: string | undefined;
35
40
  guide?: {
@@ -36,6 +36,11 @@ declare const blockVitest: bingo_stratum.BlockWithAddons<{
36
36
  profile: string;
37
37
  }[] | undefined;
38
38
  documentation?: string | undefined;
39
+ existingLabels?: {
40
+ name: string;
41
+ description: string;
42
+ color: string;
43
+ }[] | undefined;
39
44
  explainer?: string[] | undefined;
40
45
  funding?: string | undefined;
41
46
  guide?: {