create-typescript-app 2.0.0-beta.17 → 2.0.0-beta.19

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 (65) hide show
  1. package/lib/base.d.ts +1 -0
  2. package/lib/base.js +19 -1
  3. package/lib/base.js.map +1 -1
  4. package/lib/blocks/blockAllContributors.d.ts +7 -6
  5. package/lib/blocks/blockAreTheTypesWrong.d.ts +7 -6
  6. package/lib/blocks/blockCSpell.d.ts +7 -6
  7. package/lib/blocks/blockCodecov.d.ts +7 -6
  8. package/lib/blocks/blockContributingDocs.d.ts +7 -6
  9. package/lib/blocks/blockContributorCovenant.d.ts +7 -6
  10. package/lib/blocks/blockDevelopmentDocs.d.ts +8 -7
  11. package/lib/blocks/blockESLint.d.ts +7 -6
  12. package/lib/blocks/blockESLintComments.d.ts +7 -6
  13. package/lib/blocks/blockESLintJSDoc.d.ts +7 -6
  14. package/lib/blocks/blockESLintJSONC.d.ts +7 -6
  15. package/lib/blocks/blockESLintMarkdown.d.ts +7 -6
  16. package/lib/blocks/blockESLintMoreStyling.d.ts +7 -6
  17. package/lib/blocks/blockESLintNode.d.ts +7 -6
  18. package/lib/blocks/blockESLintPackageJson.d.ts +7 -6
  19. package/lib/blocks/blockESLintPerfectionist.d.ts +7 -6
  20. package/lib/blocks/blockESLintRegexp.d.ts +7 -6
  21. package/lib/blocks/blockESLintYML.d.ts +7 -6
  22. package/lib/blocks/blockExampleFiles.d.ts +7 -6
  23. package/lib/blocks/blockFunding.d.ts +7 -6
  24. package/lib/blocks/blockGitHubActionsCI.d.ts +7 -6
  25. package/lib/blocks/blockGitHubApps.d.ts +8 -7
  26. package/lib/blocks/blockGitHubIssueTemplates.d.ts +7 -6
  27. package/lib/blocks/blockGitHubPRTemplate.d.ts +7 -6
  28. package/lib/blocks/blockGitignore.d.ts +7 -6
  29. package/lib/blocks/blockKnip.d.ts +7 -6
  30. package/lib/blocks/blockMITLicense.d.ts +7 -6
  31. package/lib/blocks/blockMarkdownlint.d.ts +7 -6
  32. package/lib/blocks/blockNvmrc.d.ts +7 -6
  33. package/lib/blocks/blockPRCompliance.d.ts +7 -6
  34. package/lib/blocks/blockPackageJson.d.ts +8 -7
  35. package/lib/blocks/blockPnpmDedupe.d.ts +7 -6
  36. package/lib/blocks/blockPrettier.d.ts +7 -6
  37. package/lib/blocks/blockPrettierPluginCurly.d.ts +7 -6
  38. package/lib/blocks/blockPrettierPluginPackageJson.d.ts +7 -6
  39. package/lib/blocks/blockPrettierPluginSh.d.ts +7 -6
  40. package/lib/blocks/blockREADME.d.ts +7 -6
  41. package/lib/blocks/blockReleaseIt.d.ts +7 -6
  42. package/lib/blocks/blockRenovate.d.ts +7 -6
  43. package/lib/blocks/blockRepositoryBranchRuleset.d.ts +7 -6
  44. package/lib/blocks/blockRepositoryBranchRuleset.js +78 -54
  45. package/lib/blocks/blockRepositoryBranchRuleset.js.map +1 -1
  46. package/lib/blocks/blockRepositoryLabels.d.ts +7 -6
  47. package/lib/blocks/blockRepositorySecrets.d.ts +8 -7
  48. package/lib/blocks/blockRepositorySettings.d.ts +7 -6
  49. package/lib/blocks/blockSecurityDocs.d.ts +7 -6
  50. package/lib/blocks/blockTSup.d.ts +7 -6
  51. package/lib/blocks/blockTemplatedWith.d.ts +7 -6
  52. package/lib/blocks/blockTypeScript.d.ts +7 -6
  53. package/lib/blocks/blockVSCode.d.ts +7 -6
  54. package/lib/blocks/blockVitest.d.ts +7 -6
  55. package/lib/blocks/index.d.ts +303 -260
  56. package/lib/data/packageData.d.ts +1 -1
  57. package/lib/inputs/inputFromGitHub.d.ts +9 -0
  58. package/lib/inputs/inputFromGitHub.js +24 -0
  59. package/lib/inputs/inputFromGitHub.js.map +1 -0
  60. package/lib/presets/common.d.ts +3 -2
  61. package/lib/presets/everything.d.ts +3 -2
  62. package/lib/presets/index.d.ts +9 -6
  63. package/lib/presets/minimal.d.ts +3 -2
  64. package/lib/template.d.ts +3 -2
  65. package/package.json +1 -1
@@ -1,17 +1,18 @@
1
1
  import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
3
  declare const blockNvmrc: bingo_stratum.BlockWithoutAddons<{
4
+ owner: string;
5
+ repository: string;
4
6
  description: string;
5
- access: "public" | "restricted";
6
- directory: string;
7
7
  email: {
8
8
  github: string;
9
9
  npm: string;
10
10
  };
11
11
  title: string;
12
- owner: string;
13
- repository: string;
12
+ access: "public" | "restricted";
13
+ directory: string;
14
14
  author?: string | undefined;
15
+ version?: string | undefined;
15
16
  bin?: string | undefined;
16
17
  contributors?: {
17
18
  name: string;
@@ -24,8 +25,8 @@ declare const blockNvmrc: bingo_stratum.BlockWithoutAddons<{
24
25
  explainer?: string[] | undefined;
25
26
  funding?: string | undefined;
26
27
  guide?: {
27
- href: string;
28
28
  title: string;
29
+ href: string;
29
30
  } | undefined;
30
31
  keywords?: string[] | undefined;
31
32
  logo?: {
@@ -43,8 +44,8 @@ declare const blockNvmrc: bingo_stratum.BlockWithoutAddons<{
43
44
  devDependencies?: Record<string, string> | undefined;
44
45
  scripts?: Record<string, string> | undefined;
45
46
  } | undefined;
47
+ rulesetId?: string | undefined;
46
48
  usage?: string | undefined;
47
- version?: string | undefined;
48
49
  }>;
49
50
 
50
51
  export { blockNvmrc };
@@ -1,17 +1,18 @@
1
1
  import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
3
  declare const blockPRCompliance: bingo_stratum.BlockWithoutAddons<{
4
+ owner: string;
5
+ repository: string;
4
6
  description: string;
5
- access: "public" | "restricted";
6
- directory: string;
7
7
  email: {
8
8
  github: string;
9
9
  npm: string;
10
10
  };
11
11
  title: string;
12
- owner: string;
13
- repository: string;
12
+ access: "public" | "restricted";
13
+ directory: string;
14
14
  author?: string | undefined;
15
+ version?: string | undefined;
15
16
  bin?: string | undefined;
16
17
  contributors?: {
17
18
  name: string;
@@ -24,8 +25,8 @@ declare const blockPRCompliance: bingo_stratum.BlockWithoutAddons<{
24
25
  explainer?: string[] | undefined;
25
26
  funding?: string | undefined;
26
27
  guide?: {
27
- href: string;
28
28
  title: string;
29
+ href: string;
29
30
  } | undefined;
30
31
  keywords?: string[] | undefined;
31
32
  logo?: {
@@ -43,8 +44,8 @@ declare const blockPRCompliance: bingo_stratum.BlockWithoutAddons<{
43
44
  devDependencies?: Record<string, string> | undefined;
44
45
  scripts?: Record<string, string> | undefined;
45
46
  } | undefined;
47
+ rulesetId?: string | undefined;
46
48
  usage?: string | undefined;
47
- version?: string | undefined;
48
49
  }>;
49
50
 
50
51
  export { blockPRCompliance };
@@ -2,25 +2,26 @@ import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
3
  declare const blockPackageJson: bingo_stratum.BlockWithAddons<{
4
4
  properties: {
5
+ files?: string[] | undefined;
5
6
  dependencies?: Record<string, string> | undefined;
6
7
  devDependencies?: Record<string, string> | undefined;
7
8
  scripts?: Record<string, string> | undefined;
8
- files?: string[] | undefined;
9
9
  peerDependencies?: Record<string, string> | undefined;
10
10
  } & Record<string, unknown>;
11
11
  cleanupCommands: string[];
12
12
  }, {
13
+ owner: string;
14
+ repository: string;
13
15
  description: string;
14
- access: "public" | "restricted";
15
- directory: string;
16
16
  email: {
17
17
  github: string;
18
18
  npm: string;
19
19
  };
20
20
  title: string;
21
- owner: string;
22
- repository: string;
21
+ access: "public" | "restricted";
22
+ directory: string;
23
23
  author?: string | undefined;
24
+ version?: string | undefined;
24
25
  bin?: string | undefined;
25
26
  contributors?: {
26
27
  name: string;
@@ -33,8 +34,8 @@ declare const blockPackageJson: bingo_stratum.BlockWithAddons<{
33
34
  explainer?: string[] | undefined;
34
35
  funding?: string | undefined;
35
36
  guide?: {
36
- href: string;
37
37
  title: string;
38
+ href: string;
38
39
  } | undefined;
39
40
  keywords?: string[] | undefined;
40
41
  logo?: {
@@ -52,8 +53,8 @@ declare const blockPackageJson: bingo_stratum.BlockWithAddons<{
52
53
  devDependencies?: Record<string, string> | undefined;
53
54
  scripts?: Record<string, string> | undefined;
54
55
  } | undefined;
56
+ rulesetId?: string | undefined;
55
57
  usage?: string | undefined;
56
- version?: string | undefined;
57
58
  }>;
58
59
 
59
60
  export { blockPackageJson };
@@ -1,17 +1,18 @@
1
1
  import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
3
  declare const blockPnpmDedupe: bingo_stratum.BlockWithoutAddons<{
4
+ owner: string;
5
+ repository: string;
4
6
  description: string;
5
- access: "public" | "restricted";
6
- directory: string;
7
7
  email: {
8
8
  github: string;
9
9
  npm: string;
10
10
  };
11
11
  title: string;
12
- owner: string;
13
- repository: string;
12
+ access: "public" | "restricted";
13
+ directory: string;
14
14
  author?: string | undefined;
15
+ version?: string | undefined;
15
16
  bin?: string | undefined;
16
17
  contributors?: {
17
18
  name: string;
@@ -24,8 +25,8 @@ declare const blockPnpmDedupe: bingo_stratum.BlockWithoutAddons<{
24
25
  explainer?: string[] | undefined;
25
26
  funding?: string | undefined;
26
27
  guide?: {
27
- href: string;
28
28
  title: string;
29
+ href: string;
29
30
  } | undefined;
30
31
  keywords?: string[] | undefined;
31
32
  logo?: {
@@ -43,8 +44,8 @@ declare const blockPnpmDedupe: bingo_stratum.BlockWithoutAddons<{
43
44
  devDependencies?: Record<string, string> | undefined;
44
45
  scripts?: Record<string, string> | undefined;
45
46
  } | undefined;
47
+ rulesetId?: string | undefined;
46
48
  usage?: string | undefined;
47
- version?: string | undefined;
48
49
  }>;
49
50
 
50
51
  export { blockPnpmDedupe };
@@ -10,17 +10,18 @@ declare const blockPrettier: bingo_stratum.BlockWithAddons<{
10
10
  files: string;
11
11
  }[];
12
12
  }, {
13
+ owner: string;
14
+ repository: string;
13
15
  description: string;
14
- access: "public" | "restricted";
15
- directory: string;
16
16
  email: {
17
17
  github: string;
18
18
  npm: string;
19
19
  };
20
20
  title: string;
21
- owner: string;
22
- repository: string;
21
+ access: "public" | "restricted";
22
+ directory: string;
23
23
  author?: string | undefined;
24
+ version?: string | undefined;
24
25
  bin?: string | undefined;
25
26
  contributors?: {
26
27
  name: string;
@@ -33,8 +34,8 @@ declare const blockPrettier: bingo_stratum.BlockWithAddons<{
33
34
  explainer?: string[] | undefined;
34
35
  funding?: string | undefined;
35
36
  guide?: {
36
- href: string;
37
37
  title: string;
38
+ href: string;
38
39
  } | undefined;
39
40
  keywords?: string[] | undefined;
40
41
  logo?: {
@@ -52,8 +53,8 @@ declare const blockPrettier: bingo_stratum.BlockWithAddons<{
52
53
  devDependencies?: Record<string, string> | undefined;
53
54
  scripts?: Record<string, string> | undefined;
54
55
  } | undefined;
56
+ rulesetId?: string | undefined;
55
57
  usage?: string | undefined;
56
- version?: string | undefined;
57
58
  }>;
58
59
 
59
60
  export { blockPrettier };
@@ -1,17 +1,18 @@
1
1
  import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
3
  declare const blockPrettierPluginCurly: bingo_stratum.BlockWithoutAddons<{
4
+ owner: string;
5
+ repository: string;
4
6
  description: string;
5
- access: "public" | "restricted";
6
- directory: string;
7
7
  email: {
8
8
  github: string;
9
9
  npm: string;
10
10
  };
11
11
  title: string;
12
- owner: string;
13
- repository: string;
12
+ access: "public" | "restricted";
13
+ directory: string;
14
14
  author?: string | undefined;
15
+ version?: string | undefined;
15
16
  bin?: string | undefined;
16
17
  contributors?: {
17
18
  name: string;
@@ -24,8 +25,8 @@ declare const blockPrettierPluginCurly: bingo_stratum.BlockWithoutAddons<{
24
25
  explainer?: string[] | undefined;
25
26
  funding?: string | undefined;
26
27
  guide?: {
27
- href: string;
28
28
  title: string;
29
+ href: string;
29
30
  } | undefined;
30
31
  keywords?: string[] | undefined;
31
32
  logo?: {
@@ -43,8 +44,8 @@ declare const blockPrettierPluginCurly: bingo_stratum.BlockWithoutAddons<{
43
44
  devDependencies?: Record<string, string> | undefined;
44
45
  scripts?: Record<string, string> | undefined;
45
46
  } | undefined;
47
+ rulesetId?: string | undefined;
46
48
  usage?: string | undefined;
47
- version?: string | undefined;
48
49
  }>;
49
50
 
50
51
  export { blockPrettierPluginCurly };
@@ -1,17 +1,18 @@
1
1
  import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
3
  declare const blockPrettierPluginPackageJson: bingo_stratum.BlockWithoutAddons<{
4
+ owner: string;
5
+ repository: string;
4
6
  description: string;
5
- access: "public" | "restricted";
6
- directory: string;
7
7
  email: {
8
8
  github: string;
9
9
  npm: string;
10
10
  };
11
11
  title: string;
12
- owner: string;
13
- repository: string;
12
+ access: "public" | "restricted";
13
+ directory: string;
14
14
  author?: string | undefined;
15
+ version?: string | undefined;
15
16
  bin?: string | undefined;
16
17
  contributors?: {
17
18
  name: string;
@@ -24,8 +25,8 @@ declare const blockPrettierPluginPackageJson: bingo_stratum.BlockWithoutAddons<{
24
25
  explainer?: string[] | undefined;
25
26
  funding?: string | undefined;
26
27
  guide?: {
27
- href: string;
28
28
  title: string;
29
+ href: string;
29
30
  } | undefined;
30
31
  keywords?: string[] | undefined;
31
32
  logo?: {
@@ -43,8 +44,8 @@ declare const blockPrettierPluginPackageJson: bingo_stratum.BlockWithoutAddons<{
43
44
  devDependencies?: Record<string, string> | undefined;
44
45
  scripts?: Record<string, string> | undefined;
45
46
  } | undefined;
47
+ rulesetId?: string | undefined;
46
48
  usage?: string | undefined;
47
- version?: string | undefined;
48
49
  }>;
49
50
 
50
51
  export { blockPrettierPluginPackageJson };
@@ -1,17 +1,18 @@
1
1
  import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
3
  declare const blockPrettierPluginSh: bingo_stratum.BlockWithoutAddons<{
4
+ owner: string;
5
+ repository: string;
4
6
  description: string;
5
- access: "public" | "restricted";
6
- directory: string;
7
7
  email: {
8
8
  github: string;
9
9
  npm: string;
10
10
  };
11
11
  title: string;
12
- owner: string;
13
- repository: string;
12
+ access: "public" | "restricted";
13
+ directory: string;
14
14
  author?: string | undefined;
15
+ version?: string | undefined;
15
16
  bin?: string | undefined;
16
17
  contributors?: {
17
18
  name: string;
@@ -24,8 +25,8 @@ declare const blockPrettierPluginSh: bingo_stratum.BlockWithoutAddons<{
24
25
  explainer?: string[] | undefined;
25
26
  funding?: string | undefined;
26
27
  guide?: {
27
- href: string;
28
28
  title: string;
29
+ href: string;
29
30
  } | undefined;
30
31
  keywords?: string[] | undefined;
31
32
  logo?: {
@@ -43,8 +44,8 @@ declare const blockPrettierPluginSh: bingo_stratum.BlockWithoutAddons<{
43
44
  devDependencies?: Record<string, string> | undefined;
44
45
  scripts?: Record<string, string> | undefined;
45
46
  } | undefined;
47
+ rulesetId?: string | undefined;
46
48
  usage?: string | undefined;
47
- version?: string | undefined;
48
49
  }>;
49
50
 
50
51
  export { blockPrettierPluginSh };
@@ -5,17 +5,18 @@ declare const blockREADME: bingo_stratum.BlockWithAddons<{
5
5
  notices: string[];
6
6
  sections: string[];
7
7
  }, {
8
+ owner: string;
9
+ repository: string;
8
10
  description: string;
9
- access: "public" | "restricted";
10
- directory: string;
11
11
  email: {
12
12
  github: string;
13
13
  npm: string;
14
14
  };
15
15
  title: string;
16
- owner: string;
17
- repository: string;
16
+ access: "public" | "restricted";
17
+ directory: string;
18
18
  author?: string | undefined;
19
+ version?: string | undefined;
19
20
  bin?: string | undefined;
20
21
  contributors?: {
21
22
  name: string;
@@ -28,8 +29,8 @@ declare const blockREADME: bingo_stratum.BlockWithAddons<{
28
29
  explainer?: string[] | undefined;
29
30
  funding?: string | undefined;
30
31
  guide?: {
31
- href: string;
32
32
  title: string;
33
+ href: string;
33
34
  } | undefined;
34
35
  keywords?: string[] | undefined;
35
36
  logo?: {
@@ -47,8 +48,8 @@ declare const blockREADME: bingo_stratum.BlockWithAddons<{
47
48
  devDependencies?: Record<string, string> | undefined;
48
49
  scripts?: Record<string, string> | undefined;
49
50
  } | undefined;
51
+ rulesetId?: string | undefined;
50
52
  usage?: string | undefined;
51
- version?: string | undefined;
52
53
  }>;
53
54
 
54
55
  export { blockREADME };
@@ -1,17 +1,18 @@
1
1
  import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
3
  declare const blockReleaseIt: bingo_stratum.BlockWithoutAddons<{
4
+ owner: string;
5
+ repository: string;
4
6
  description: string;
5
- access: "public" | "restricted";
6
- directory: string;
7
7
  email: {
8
8
  github: string;
9
9
  npm: string;
10
10
  };
11
11
  title: string;
12
- owner: string;
13
- repository: string;
12
+ access: "public" | "restricted";
13
+ directory: string;
14
14
  author?: string | undefined;
15
+ version?: string | undefined;
15
16
  bin?: string | undefined;
16
17
  contributors?: {
17
18
  name: string;
@@ -24,8 +25,8 @@ declare const blockReleaseIt: bingo_stratum.BlockWithoutAddons<{
24
25
  explainer?: string[] | undefined;
25
26
  funding?: string | undefined;
26
27
  guide?: {
27
- href: string;
28
28
  title: string;
29
+ href: string;
29
30
  } | undefined;
30
31
  keywords?: string[] | undefined;
31
32
  logo?: {
@@ -43,8 +44,8 @@ declare const blockReleaseIt: bingo_stratum.BlockWithoutAddons<{
43
44
  devDependencies?: Record<string, string> | undefined;
44
45
  scripts?: Record<string, string> | undefined;
45
46
  } | undefined;
47
+ rulesetId?: string | undefined;
46
48
  usage?: string | undefined;
47
- version?: string | undefined;
48
49
  }>;
49
50
 
50
51
  export { blockReleaseIt };
@@ -1,17 +1,18 @@
1
1
  import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
3
  declare const blockRenovate: bingo_stratum.BlockWithoutAddons<{
4
+ owner: string;
5
+ repository: string;
4
6
  description: string;
5
- access: "public" | "restricted";
6
- directory: string;
7
7
  email: {
8
8
  github: string;
9
9
  npm: string;
10
10
  };
11
11
  title: string;
12
- owner: string;
13
- repository: string;
12
+ access: "public" | "restricted";
13
+ directory: string;
14
14
  author?: string | undefined;
15
+ version?: string | undefined;
15
16
  bin?: string | undefined;
16
17
  contributors?: {
17
18
  name: string;
@@ -24,8 +25,8 @@ declare const blockRenovate: bingo_stratum.BlockWithoutAddons<{
24
25
  explainer?: string[] | undefined;
25
26
  funding?: string | undefined;
26
27
  guide?: {
27
- href: string;
28
28
  title: string;
29
+ href: string;
29
30
  } | undefined;
30
31
  keywords?: string[] | undefined;
31
32
  logo?: {
@@ -43,8 +44,8 @@ declare const blockRenovate: bingo_stratum.BlockWithoutAddons<{
43
44
  devDependencies?: Record<string, string> | undefined;
44
45
  scripts?: Record<string, string> | undefined;
45
46
  } | undefined;
47
+ rulesetId?: string | undefined;
46
48
  usage?: string | undefined;
47
- version?: string | undefined;
48
49
  }>;
49
50
 
50
51
  export { blockRenovate };
@@ -3,17 +3,18 @@ import * as bingo_stratum from 'bingo-stratum';
3
3
  declare const blockRepositoryBranchRuleset: bingo_stratum.BlockWithAddons<{
4
4
  requiredStatusChecks: string[];
5
5
  }, {
6
+ owner: string;
7
+ repository: string;
6
8
  description: string;
7
- access: "public" | "restricted";
8
- directory: string;
9
9
  email: {
10
10
  github: string;
11
11
  npm: string;
12
12
  };
13
13
  title: string;
14
- owner: string;
15
- repository: string;
14
+ access: "public" | "restricted";
15
+ directory: string;
16
16
  author?: string | undefined;
17
+ version?: string | undefined;
17
18
  bin?: string | undefined;
18
19
  contributors?: {
19
20
  name: string;
@@ -26,8 +27,8 @@ declare const blockRepositoryBranchRuleset: bingo_stratum.BlockWithAddons<{
26
27
  explainer?: string[] | undefined;
27
28
  funding?: string | undefined;
28
29
  guide?: {
29
- href: string;
30
30
  title: string;
31
+ href: string;
31
32
  } | undefined;
32
33
  keywords?: string[] | undefined;
33
34
  logo?: {
@@ -45,8 +46,8 @@ declare const blockRepositoryBranchRuleset: bingo_stratum.BlockWithAddons<{
45
46
  devDependencies?: Record<string, string> | undefined;
46
47
  scripts?: Record<string, string> | undefined;
47
48
  } | undefined;
49
+ rulesetId?: string | undefined;
48
50
  usage?: string | undefined;
49
- version?: string | undefined;
50
51
  }>;
51
52
 
52
53
  export { blockRepositoryBranchRuleset };
@@ -7,63 +7,87 @@ const blockRepositoryBranchRuleset = base.createBlock({
7
7
  addons: {
8
8
  requiredStatusChecks: z.array(z.string()).default([])
9
9
  },
10
- produce({ addons, options }) {
11
- return {
12
- requests: [
13
- {
14
- id: "branch-ruleset",
15
- async send({ octokit }) {
16
- await octokit.request("POST /repos/{owner}/{repo}/rulesets", {
17
- bypass_actors: [
18
- {
19
- // This *seems* to be the Repository Admin role always?
20
- // https://github.com/github/rest-api-description/issues/4406
21
- actor_id: 5,
22
- actor_type: "RepositoryRole",
23
- bypass_mode: "always"
24
- }
25
- ],
26
- conditions: {
27
- ref_name: {
28
- exclude: [],
29
- include: ["refs/heads/main"]
30
- }
10
+ setup({ addons, options }) {
11
+ return createRequestSend(
12
+ addons.requiredStatusChecks,
13
+ "POST /repos/{owner}/{repo}/rulesets",
14
+ options,
15
+ "branch-ruleset-create",
16
+ void 0
17
+ );
18
+ },
19
+ transition({ addons, options }) {
20
+ return createRequestSend(
21
+ addons.requiredStatusChecks,
22
+ `PUT /repos/{owner}/{repo}/rulesets/{ruleset_id}`,
23
+ options,
24
+ "branch-ruleset-update",
25
+ options.rulesetId
26
+ );
27
+ },
28
+ // TODO: Make produce() optional
29
+ // This needs createBlock to be generic to know if block.produce({}) is ok
30
+ produce() {
31
+ return {};
32
+ }
33
+ });
34
+ function createRequestSend(contexts, endpoint, options, requestId, rulesetId) {
35
+ return {
36
+ requests: [
37
+ {
38
+ id: requestId,
39
+ async send({ octokit }) {
40
+ await octokit.request(endpoint, {
41
+ bypass_actors: [
42
+ {
43
+ // This *seems* to be the Repository Admin role always?
44
+ // https://github.com/github/rest-api-description/issues/4406
45
+ actor_id: 5,
46
+ actor_type: "RepositoryRole",
47
+ bypass_mode: "always"
48
+ }
49
+ ],
50
+ conditions: {
51
+ ref_name: {
52
+ exclude: [],
53
+ include: ["refs/heads/main"]
54
+ }
55
+ },
56
+ enforcement: "active",
57
+ name: "Branch protection for main",
58
+ owner: options.owner,
59
+ repo: options.repository,
60
+ rules: [
61
+ { type: "deletion" },
62
+ {
63
+ parameters: {
64
+ allowed_merge_methods: ["squash"],
65
+ dismiss_stale_reviews_on_push: false,
66
+ require_code_owner_review: false,
67
+ require_last_push_approval: false,
68
+ required_approving_review_count: 0,
69
+ required_review_thread_resolution: false
70
+ },
71
+ type: "pull_request"
31
72
  },
32
- enforcement: "active",
33
- name: "Branch protection for main",
34
- owner: options.owner,
35
- repo: options.repository,
36
- rules: [
37
- { type: "deletion" },
38
- {
39
- parameters: {
40
- allowed_merge_methods: ["squash"],
41
- dismiss_stale_reviews_on_push: false,
42
- require_code_owner_review: false,
43
- require_last_push_approval: false,
44
- required_approving_review_count: 0,
45
- required_review_thread_resolution: false
46
- },
47
- type: "pull_request"
73
+ {
74
+ parameters: {
75
+ required_status_checks: contexts.map((context) => ({
76
+ context
77
+ })),
78
+ strict_required_status_checks_policy: false
48
79
  },
49
- {
50
- parameters: {
51
- required_status_checks: addons.requiredStatusChecks.map(
52
- (context) => ({ context })
53
- ),
54
- strict_required_status_checks_policy: false
55
- },
56
- type: "required_status_checks"
57
- }
58
- ],
59
- target: "branch"
60
- });
61
- }
80
+ type: "required_status_checks"
81
+ }
82
+ ],
83
+ ruleset_id: rulesetId,
84
+ target: "branch"
85
+ });
62
86
  }
63
- ]
64
- };
65
- }
66
- });
87
+ }
88
+ ]
89
+ };
90
+ }
67
91
  export {
68
92
  blockRepositoryBranchRuleset
69
93
  };