create-typescript-app 2.4.6 → 2.6.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 (76) hide show
  1. package/README.md +1 -1
  2. package/lib/base.d.ts +14 -0
  3. package/lib/base.js +20 -3
  4. package/lib/blocks/blockAllContributors.d.ts +6 -0
  5. package/lib/blocks/blockAreTheTypesWrong.d.ts +6 -0
  6. package/lib/blocks/blockCSpell.d.ts +6 -0
  7. package/lib/blocks/blockCodecov.d.ts +6 -0
  8. package/lib/blocks/blockContributingDocs.d.ts +6 -0
  9. package/lib/blocks/blockContributingDocs.js +2 -2
  10. package/lib/blocks/blockContributorCovenant.d.ts +6 -0
  11. package/lib/blocks/blockDevelopmentDocs.d.ts +6 -0
  12. package/lib/blocks/blockESLint.d.ts +6 -0
  13. package/lib/blocks/blockESLintComments.d.ts +6 -0
  14. package/lib/blocks/blockESLintJSDoc.d.ts +6 -0
  15. package/lib/blocks/blockESLintJSONC.d.ts +6 -0
  16. package/lib/blocks/blockESLintMarkdown.d.ts +6 -0
  17. package/lib/blocks/blockESLintMoreStyling.d.ts +6 -0
  18. package/lib/blocks/blockESLintNode.d.ts +6 -0
  19. package/lib/blocks/blockESLintPackageJson.d.ts +6 -0
  20. package/lib/blocks/blockESLintPerfectionist.d.ts +6 -0
  21. package/lib/blocks/blockESLintRegexp.d.ts +6 -0
  22. package/lib/blocks/blockESLintYML.d.ts +6 -0
  23. package/lib/blocks/blockExampleFiles.d.ts +6 -0
  24. package/lib/blocks/blockFunding.d.ts +6 -0
  25. package/lib/blocks/blockGitHubActionsCI.d.ts +6 -0
  26. package/lib/blocks/blockGitHubApps.d.ts +6 -0
  27. package/lib/blocks/blockGitHubIssueTemplates.d.ts +6 -0
  28. package/lib/blocks/blockGitHubPRTemplate.d.ts +6 -0
  29. package/lib/blocks/blockGitHubPRTemplate.js +1 -1
  30. package/lib/blocks/blockGitignore.d.ts +6 -0
  31. package/lib/blocks/blockKnip.d.ts +6 -0
  32. package/lib/blocks/blockMITLicense.d.ts +6 -0
  33. package/lib/blocks/blockMarkdownlint.d.ts +6 -0
  34. package/lib/blocks/blockNvmrc.d.ts +6 -0
  35. package/lib/blocks/blockPRCompliance.d.ts +6 -0
  36. package/lib/blocks/blockPackageJson.d.ts +6 -0
  37. package/lib/blocks/blockPnpmDedupe.d.ts +6 -0
  38. package/lib/blocks/blockPrettier.d.ts +6 -0
  39. package/lib/blocks/blockPrettierPluginCurly.d.ts +6 -0
  40. package/lib/blocks/blockPrettierPluginPackageJson.d.ts +6 -0
  41. package/lib/blocks/blockPrettierPluginSh.d.ts +6 -0
  42. package/lib/blocks/blockREADME.d.ts +6 -0
  43. package/lib/blocks/blockREADME.js +1 -1
  44. package/lib/blocks/blockReleaseIt.d.ts +6 -0
  45. package/lib/blocks/blockRenovate.d.ts +6 -0
  46. package/lib/blocks/blockRepositoryBranchRuleset.d.ts +7 -1
  47. package/lib/blocks/blockRepositoryBranchRuleset.js +25 -32
  48. package/lib/blocks/blockRepositoryLabels.d.ts +6 -0
  49. package/lib/blocks/blockRepositoryLabels.js +47 -12
  50. package/lib/blocks/blockRepositorySecrets.d.ts +6 -0
  51. package/lib/blocks/blockRepositorySettings.d.ts +6 -0
  52. package/lib/blocks/blockRepositorySettings.js +22 -23
  53. package/lib/blocks/blockSecurityDocs.d.ts +6 -0
  54. package/lib/blocks/blockTSup.d.ts +6 -0
  55. package/lib/blocks/blockTemplatedWith.d.ts +6 -0
  56. package/lib/blocks/blockTypeScript.d.ts +6 -0
  57. package/lib/blocks/blockVSCode.d.ts +6 -0
  58. package/lib/blocks/blockVitest.d.ts +6 -0
  59. package/lib/blocks/index.d.ts +258 -0
  60. package/lib/blocks/options.fakes.d.ts +1 -0
  61. package/lib/blocks/options.fakes.js +1 -0
  62. package/lib/blocks/outcomeLabels.js +2 -2
  63. package/lib/data/packageData.d.ts +9 -7
  64. package/lib/index.d.ts +20 -0
  65. package/lib/options/getExistingLabels.d.ts +9 -0
  66. package/lib/options/getExistingLabels.js +22 -0
  67. package/lib/options/parseEmojiFromDescription.d.ts +3 -0
  68. package/lib/options/parseEmojiFromDescription.js +6 -0
  69. package/lib/options/readDefaultsFromReadme.d.ts +1 -1
  70. package/lib/options/readDefaultsFromReadme.js +2 -2
  71. package/lib/presets/common.d.ts +14 -0
  72. package/lib/presets/everything.d.ts +14 -0
  73. package/lib/presets/index.d.ts +42 -0
  74. package/lib/presets/minimal.d.ts +14 -0
  75. package/lib/template.d.ts +14 -0
  76. package/package.json +9 -7
@@ -21,6 +21,12 @@ declare const blockReleaseIt: bingo_stratum.BlockWithoutAddons<{
21
21
  profile: string;
22
22
  }[] | undefined;
23
23
  documentation?: string | undefined;
24
+ emoji?: string | undefined;
25
+ existingLabels?: {
26
+ name: string;
27
+ description: string;
28
+ color: string;
29
+ }[] | undefined;
24
30
  explainer?: string[] | undefined;
25
31
  funding?: string | undefined;
26
32
  guide?: {
@@ -21,6 +21,12 @@ declare const blockRenovate: bingo_stratum.BlockWithoutAddons<{
21
21
  profile: string;
22
22
  }[] | undefined;
23
23
  documentation?: string | undefined;
24
+ emoji?: string | undefined;
25
+ existingLabels?: {
26
+ name: string;
27
+ description: string;
28
+ color: string;
29
+ }[] | undefined;
24
30
  explainer?: string[] | undefined;
25
31
  funding?: string | undefined;
26
32
  guide?: {
@@ -1,7 +1,7 @@
1
1
  import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
3
  declare const blockRepositoryBranchRuleset: bingo_stratum.BlockWithAddons<{
4
- requiredStatusChecks: string[];
4
+ requiredStatusChecks?: string[] | undefined;
5
5
  }, {
6
6
  access: "public" | "restricted";
7
7
  description: string;
@@ -23,6 +23,12 @@ declare const blockRepositoryBranchRuleset: bingo_stratum.BlockWithAddons<{
23
23
  profile: string;
24
24
  }[] | undefined;
25
25
  documentation?: string | undefined;
26
+ emoji?: string | undefined;
27
+ existingLabels?: {
28
+ name: string;
29
+ description: string;
30
+ color: string;
31
+ }[] | undefined;
26
32
  explainer?: string[] | undefined;
27
33
  funding?: string | undefined;
28
34
  guide?: {
@@ -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,12 @@ declare const blockRepositoryLabels: bingo_stratum.BlockWithoutAddons<{
21
21
  profile: string;
22
22
  }[] | undefined;
23
23
  documentation?: string | undefined;
24
+ emoji?: string | undefined;
25
+ existingLabels?: {
26
+ name: string;
27
+ description: string;
28
+ color: string;
29
+ }[] | undefined;
24
30
  explainer?: string[] | undefined;
25
31
  funding?: string | undefined;
26
32
  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,12 @@ declare const blockRepositorySecrets: bingo_stratum.BlockWithAddons<{
26
26
  profile: string;
27
27
  }[] | undefined;
28
28
  documentation?: string | undefined;
29
+ emoji?: string | undefined;
30
+ existingLabels?: {
31
+ name: string;
32
+ description: string;
33
+ color: string;
34
+ }[] | undefined;
29
35
  explainer?: string[] | undefined;
30
36
  funding?: string | undefined;
31
37
  guide?: {
@@ -21,6 +21,12 @@ declare const blockRepositorySettings: bingo_stratum.BlockWithoutAddons<{
21
21
  profile: string;
22
22
  }[] | undefined;
23
23
  documentation?: string | undefined;
24
+ emoji?: string | undefined;
25
+ existingLabels?: {
26
+ name: string;
27
+ description: string;
28
+ color: string;
29
+ }[] | undefined;
24
30
  explainer?: string[] | undefined;
25
31
  funding?: string | undefined;
26
32
  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,12 @@ declare const blockSecurityDocs: bingo_stratum.BlockWithoutAddons<{
21
21
  profile: string;
22
22
  }[] | undefined;
23
23
  documentation?: string | undefined;
24
+ emoji?: string | undefined;
25
+ existingLabels?: {
26
+ name: string;
27
+ description: string;
28
+ color: string;
29
+ }[] | undefined;
24
30
  explainer?: string[] | undefined;
25
31
  funding?: string | undefined;
26
32
  guide?: {
@@ -24,6 +24,12 @@ declare const blockTSup: bingo_stratum.BlockWithAddons<{
24
24
  profile: string;
25
25
  }[] | undefined;
26
26
  documentation?: string | undefined;
27
+ emoji?: string | undefined;
28
+ existingLabels?: {
29
+ name: string;
30
+ description: string;
31
+ color: string;
32
+ }[] | undefined;
27
33
  explainer?: string[] | undefined;
28
34
  funding?: string | undefined;
29
35
  guide?: {
@@ -21,6 +21,12 @@ declare const blockTemplatedWith: bingo_stratum.BlockWithoutAddons<{
21
21
  profile: string;
22
22
  }[] | undefined;
23
23
  documentation?: string | undefined;
24
+ emoji?: string | undefined;
25
+ existingLabels?: {
26
+ name: string;
27
+ description: string;
28
+ color: string;
29
+ }[] | undefined;
24
30
  explainer?: string[] | undefined;
25
31
  funding?: string | undefined;
26
32
  guide?: {
@@ -21,6 +21,12 @@ declare const blockTypeScript: bingo_stratum.BlockWithoutAddons<{
21
21
  profile: string;
22
22
  }[] | undefined;
23
23
  documentation?: string | undefined;
24
+ emoji?: string | undefined;
25
+ existingLabels?: {
26
+ name: string;
27
+ description: string;
28
+ color: string;
29
+ }[] | undefined;
24
30
  explainer?: string[] | undefined;
25
31
  funding?: string | undefined;
26
32
  guide?: {
@@ -30,6 +30,12 @@ declare const blockVSCode: bingo_stratum.BlockWithAddons<{
30
30
  profile: string;
31
31
  }[] | undefined;
32
32
  documentation?: string | undefined;
33
+ emoji?: string | undefined;
34
+ existingLabels?: {
35
+ name: string;
36
+ description: string;
37
+ color: string;
38
+ }[] | undefined;
33
39
  explainer?: string[] | undefined;
34
40
  funding?: string | undefined;
35
41
  guide?: {
@@ -36,6 +36,12 @@ declare const blockVitest: bingo_stratum.BlockWithAddons<{
36
36
  profile: string;
37
37
  }[] | undefined;
38
38
  documentation?: string | undefined;
39
+ emoji?: string | undefined;
40
+ existingLabels?: {
41
+ name: string;
42
+ description: string;
43
+ color: string;
44
+ }[] | undefined;
39
45
  explainer?: string[] | undefined;
40
46
  funding?: string | undefined;
41
47
  guide?: {