create-typescript-app 1.77.1 → 1.78.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.
- package/README.md +5 -4
- package/lib/next/blocks/{blockRepositoryBranchProtection.d.ts → blockRepositoryBranchRuleset.d.ts} +2 -2
- package/lib/next/blocks/blockRepositoryBranchRuleset.js +62 -0
- package/lib/next/blocks/blockRepositoryBranchRuleset.js.map +1 -0
- package/lib/next/presetMinimal.js +2 -2
- package/lib/next/presetMinimal.js.map +1 -1
- package/lib/steps/initializeGitHubRepository/initializeBranchProtectionSettings.js +44 -31
- package/lib/steps/initializeGitHubRepository/initializeBranchProtectionSettings.js.map +1 -1
- package/package.json +1 -1
- package/lib/next/blocks/blockRepositoryBranchProtection.js +0 -49
- package/lib/next/blocks/blockRepositoryBranchProtection.js.map +0 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<!-- prettier-ignore-start -->
|
|
7
7
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
8
|
-
<a href="#contributors" target="_blank"><img alt="👪 All Contributors:
|
|
8
|
+
<a href="#contributors" target="_blank"><img alt="👪 All Contributors: 51" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-51-21bb42.svg" /></a>
|
|
9
9
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
10
10
|
<!-- prettier-ignore-end -->
|
|
11
11
|
<a href="https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a>
|
|
@@ -107,30 +107,31 @@ Thanks! 💖
|
|
|
107
107
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/NazCodeland"><img src="https://avatars.githubusercontent.com/u/113494366?v=4?s=100" width="100px;" alt="NazCodeland"/><br /><sub><b>NazCodeland</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=NazCodeland" title="Code">💻</a></td>
|
|
108
108
|
<td align="center" valign="top" width="14.28%"><a href="https://orta.io"><img src="https://avatars.githubusercontent.com/u/49038?v=4?s=100" width="100px;" alt="Orta Therox"/><br /><sub><b>Orta Therox</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=orta" title="Code">💻</a></td>
|
|
109
109
|
<td align="center" valign="top" width="14.28%"><a href="https://paulisaweso.me/"><img src="https://avatars.githubusercontent.com/u/6335792?v=4?s=100" width="100px;" alt="Paul Esch-Laurent"/><br /><sub><b>Paul Esch-Laurent</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=Pinjasaur" title="Code">💻</a></td>
|
|
110
|
+
<td align="center" valign="top" width="14.28%"><a href="https://kodfabrik.se/"><img src="https://avatars.githubusercontent.com/u/34457?v=4?s=100" width="100px;" alt="Pelle Wessman"/><br /><sub><b>Pelle Wessman</b></sub></a><br /><a href="#ideas-voxpelli" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
110
111
|
<td align="center" valign="top" width="14.28%"><a href="https://praveenshinde.vercel.app/"><img src="https://avatars.githubusercontent.com/u/107350270?v=4?s=100" width="100px;" alt="Praveen Shinde"/><br /><sub><b>Praveen Shinde</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=praveenshinde3" title="Code">💻</a></td>
|
|
111
112
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/promise-dash"><img src="https://avatars.githubusercontent.com/u/86062880?v=4?s=100" width="100px;" alt="Promise Dash"/><br /><sub><b>Promise Dash</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=promise-dash" title="Code">💻</a></td>
|
|
112
113
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/RebeccaStevens"><img src="https://avatars.githubusercontent.com/u/7224206?v=4?s=100" width="100px;" alt="Rebecca Stevens"/><br /><sub><b>Rebecca Stevens</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=RebeccaStevens" title="Code">💻</a> <a href="#infra-RebeccaStevens" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
|
113
|
-
<td align="center" valign="top" width="14.28%"><a href="https://linktr.ee/ronbraha"><img src="https://avatars.githubusercontent.com/u/45559220?v=4?s=100" width="100px;" alt="Ron Braha"/><br /><sub><b>Ron Braha</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=RNR1" title="Code">💻</a> <a href="#design-RNR1" title="Design">🎨</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=RNR1" title="Tests">⚠️</a></td>
|
|
114
114
|
</tr>
|
|
115
115
|
<tr>
|
|
116
|
+
<td align="center" valign="top" width="14.28%"><a href="https://linktr.ee/ronbraha"><img src="https://avatars.githubusercontent.com/u/45559220?v=4?s=100" width="100px;" alt="Ron Braha"/><br /><sub><b>Ron Braha</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=RNR1" title="Code">💻</a> <a href="#design-RNR1" title="Design">🎨</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=RNR1" title="Tests">⚠️</a></td>
|
|
116
117
|
<td align="center" valign="top" width="14.28%"><a href="http://ronjeanfrancois.com"><img src="https://avatars.githubusercontent.com/u/105710107?v=4?s=100" width="100px;" alt="Ron Jean-Francois"/><br /><sub><b>Ron Jean-Francois</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=ronthetech" title="Code">💻</a> <a href="#infra-ronthetech" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
|
117
118
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/RuthwikReddy09"><img src="https://avatars.githubusercontent.com/u/126862059?v=4?s=100" width="100px;" alt="Ruthwik"/><br /><sub><b>Ruthwik</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=ruthwikreddy09" title="Code">💻</a></td>
|
|
118
119
|
<td align="center" valign="top" width="14.28%"><a href="https://ryota-murakami.github.io/"><img src="https://avatars.githubusercontent.com/u/5501268?v=4?s=100" width="100px;" alt="Ryota Murakami"/><br /><sub><b>Ryota Murakami</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=ryota-murakami" title="Code">💻</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3Aryota-murakami" title="Bug reports">🐛</a></td>
|
|
119
120
|
<td align="center" valign="top" width="14.28%"><a href="https://www.shraddha.tech"><img src="https://avatars.githubusercontent.com/u/27571141?v=4?s=100" width="100px;" alt="Shraddha"/><br /><sub><b>Shraddha</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=5hraddha" title="Code">💻</a></td>
|
|
120
121
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/the-lazy-learner"><img src="https://avatars.githubusercontent.com/u/13695177?v=4?s=100" width="100px;" alt="Sudhansu"/><br /><sub><b>Sudhansu</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=the-lazy-learner" title="Code">💻</a></td>
|
|
121
122
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mrswastik-robot"><img src="https://avatars.githubusercontent.com/u/107865087?v=4?s=100" width="100px;" alt="Swastik Patel"/><br /><sub><b>Swastik Patel</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=mrswastik-robot" title="Documentation">📖</a></td>
|
|
122
|
-
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/timonjurschitsch/"><img src="https://avatars.githubusercontent.com/u/103483059?v=4?s=100" width="100px;" alt="Timon Jurschitsch"/><br /><sub><b>Timon Jurschitsch</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=dertimonius" title="Code">💻</a></td>
|
|
123
123
|
</tr>
|
|
124
124
|
<tr>
|
|
125
|
+
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/timonjurschitsch/"><img src="https://avatars.githubusercontent.com/u/103483059?v=4?s=100" width="100px;" alt="Timon Jurschitsch"/><br /><sub><b>Timon Jurschitsch</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=dertimonius" title="Code">💻</a></td>
|
|
125
126
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tungbq"><img src="https://avatars.githubusercontent.com/u/85242618?v=4?s=100" width="100px;" alt="Tung Bui (Leo)"/><br /><sub><b>Tung Bui (Leo)</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=tungbq" title="Code">💻</a></td>
|
|
126
127
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/valon-loshaj"><img src="https://avatars.githubusercontent.com/u/73202963?v=4?s=100" width="100px;" alt="Valon"/><br /><sub><b>Valon</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=valon-loshaj" title="Documentation">📖</a></td>
|
|
127
128
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/vasanth9"><img src="https://avatars.githubusercontent.com/u/42891954?v=4?s=100" width="100px;" alt="Vasanth Kumar Cheepurupalli"/><br /><sub><b>Vasanth Kumar Cheepurupalli</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=vasanth9" title="Code">💻</a></td>
|
|
128
129
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/xl4624"><img src="https://avatars.githubusercontent.com/u/116298054?v=4?s=100" width="100px;" alt="Xiaomin Liu"/><br /><sub><b>Xiaomin Liu</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=xl4624" title="Code">💻</a></td>
|
|
129
130
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lcforbes"><img src="https://avatars.githubusercontent.com/u/42080532?v=4?s=100" width="100px;" alt="lcforbes"/><br /><sub><b>lcforbes</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3Alcforbes" title="Bug reports">🐛</a></td>
|
|
130
131
|
<td align="center" valign="top" width="14.28%"><a href="http://nandertga.ddns.net"><img src="https://avatars.githubusercontent.com/u/65074195?v=4?s=100" width="100px;" alt="nandertga"/><br /><sub><b>nandertga</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=nandertga" title="Code">💻</a></td>
|
|
131
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rubiesonthesky"><img src="https://avatars.githubusercontent.com/u/2591240?v=4?s=100" width="100px;" alt="rubiesonthesky"/><br /><sub><b>rubiesonthesky</b></sub></a><br /><a href="#ideas-rubiesonthesky" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=rubiesonthesky" title="Code">💻</a></td>
|
|
132
132
|
</tr>
|
|
133
133
|
<tr>
|
|
134
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rubiesonthesky"><img src="https://avatars.githubusercontent.com/u/2591240?v=4?s=100" width="100px;" alt="rubiesonthesky"/><br /><sub><b>rubiesonthesky</b></sub></a><br /><a href="#ideas-rubiesonthesky" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=rubiesonthesky" title="Code">💻</a></td>
|
|
134
135
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/TAKANOME-DEV"><img src="https://avatars.githubusercontent.com/u/79809121?v=4?s=100" width="100px;" alt="takanomedev"/><br /><sub><b>takanomedev</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=TAKANOME-DEV" title="Code">💻</a></td>
|
|
135
136
|
</tr>
|
|
136
137
|
</tbody>
|
package/lib/next/blocks/{blockRepositoryBranchProtection.d.ts → blockRepositoryBranchRuleset.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as create from 'create';
|
|
2
2
|
|
|
3
|
-
declare const
|
|
3
|
+
declare const blockRepositoryBranchRuleset: create.BlockWithAddons<{
|
|
4
4
|
requiredStatusChecks: string[];
|
|
5
5
|
}, {
|
|
6
6
|
description: string;
|
|
@@ -47,4 +47,4 @@ declare const blockRepositoryBranchProtection: create.BlockWithAddons<{
|
|
|
47
47
|
version?: string | undefined;
|
|
48
48
|
}>;
|
|
49
49
|
|
|
50
|
-
export {
|
|
50
|
+
export { blockRepositoryBranchRuleset };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { base } from "../base.js";
|
|
3
|
+
const blockRepositoryBranchRuleset = base.createBlock({
|
|
4
|
+
about: {
|
|
5
|
+
name: "Repository Branch Ruleset"
|
|
6
|
+
},
|
|
7
|
+
addons: {
|
|
8
|
+
requiredStatusChecks: z.array(z.string()).default([])
|
|
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
|
+
conditions: {
|
|
18
|
+
ref_name: {
|
|
19
|
+
exclude: [],
|
|
20
|
+
include: ["refs/heads/main"]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
enforcement: "active",
|
|
24
|
+
name: "Branch protection for main",
|
|
25
|
+
owner: options.owner,
|
|
26
|
+
repo: options.repository,
|
|
27
|
+
rules: [
|
|
28
|
+
{ type: "deletion" },
|
|
29
|
+
{
|
|
30
|
+
parameters: {
|
|
31
|
+
// @ts-expect-error -- https://github.com/github/rest-api-description/issues/4405
|
|
32
|
+
allowed_merge_methods: ["squash"],
|
|
33
|
+
dismiss_stale_reviews_on_push: false,
|
|
34
|
+
require_code_owner_review: false,
|
|
35
|
+
require_last_push_approval: false,
|
|
36
|
+
required_approving_review_count: 0,
|
|
37
|
+
required_review_thread_resolution: false
|
|
38
|
+
},
|
|
39
|
+
type: "pull_request"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
parameters: {
|
|
43
|
+
required_status_checks: addons.requiredStatusChecks.map(
|
|
44
|
+
(context) => ({ context })
|
|
45
|
+
),
|
|
46
|
+
strict_required_status_checks_policy: false
|
|
47
|
+
},
|
|
48
|
+
type: "required_status_checks"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
target: "branch"
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
export {
|
|
60
|
+
blockRepositoryBranchRuleset
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=blockRepositoryBranchRuleset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/next/blocks/blockRepositoryBranchRuleset.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { base } from \"../base.js\";\n\nexport const blockRepositoryBranchRuleset = base.createBlock({\n\tabout: {\n\t\tname: \"Repository Branch Ruleset\",\n\t},\n\taddons: {\n\t\trequiredStatusChecks: z.array(z.string()).default([]),\n\t},\n\tproduce({ addons, options }) {\n\t\treturn {\n\t\t\trequests: [\n\t\t\t\t{\n\t\t\t\t\tid: \"branch-ruleset\",\n\t\t\t\t\tasync send({ octokit }) {\n\t\t\t\t\t\tawait octokit.request(\"POST /repos/{owner}/{repo}/rulesets\", {\n\t\t\t\t\t\t\tconditions: {\n\t\t\t\t\t\t\t\tref_name: {\n\t\t\t\t\t\t\t\t\texclude: [],\n\t\t\t\t\t\t\t\t\tinclude: [\"refs/heads/main\"],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tenforcement: \"active\",\n\t\t\t\t\t\t\tname: \"Branch protection for main\",\n\t\t\t\t\t\t\towner: options.owner,\n\t\t\t\t\t\t\trepo: options.repository,\n\t\t\t\t\t\t\trules: [\n\t\t\t\t\t\t\t\t{ type: \"deletion\" },\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tparameters: {\n\t\t\t\t\t\t\t\t\t\t// @ts-expect-error -- https://github.com/github/rest-api-description/issues/4405\n\t\t\t\t\t\t\t\t\t\tallowed_merge_methods: [\"squash\"],\n\t\t\t\t\t\t\t\t\t\tdismiss_stale_reviews_on_push: false,\n\t\t\t\t\t\t\t\t\t\trequire_code_owner_review: false,\n\t\t\t\t\t\t\t\t\t\trequire_last_push_approval: false,\n\t\t\t\t\t\t\t\t\t\trequired_approving_review_count: 0,\n\t\t\t\t\t\t\t\t\t\trequired_review_thread_resolution: false,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\ttype: \"pull_request\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tparameters: {\n\t\t\t\t\t\t\t\t\t\trequired_status_checks: addons.requiredStatusChecks.map(\n\t\t\t\t\t\t\t\t\t\t\t(context) => ({ context }),\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\tstrict_required_status_checks_policy: false,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\ttype: \"required_status_checks\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttarget: \"branch\",\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t},\n});\n"],"mappings":"AAAA,SAAS,SAAS;AAElB,SAAS,YAAY;AAEd,MAAM,+BAA+B,KAAK,YAAY;AAAA,EAC5D,OAAO;AAAA,IACN,MAAM;AAAA,EACP;AAAA,EACA,QAAQ;AAAA,IACP,sBAAsB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;AAAA,EACrD;AAAA,EACA,QAAQ,EAAE,QAAQ,QAAQ,GAAG;AAC5B,WAAO;AAAA,MACN,UAAU;AAAA,QACT;AAAA,UACC,IAAI;AAAA,UACJ,MAAM,KAAK,EAAE,QAAQ,GAAG;AACvB,kBAAM,QAAQ,QAAQ,uCAAuC;AAAA,cAC5D,YAAY;AAAA,gBACX,UAAU;AAAA,kBACT,SAAS,CAAC;AAAA,kBACV,SAAS,CAAC,iBAAiB;AAAA,gBAC5B;AAAA,cACD;AAAA,cACA,aAAa;AAAA,cACb,MAAM;AAAA,cACN,OAAO,QAAQ;AAAA,cACf,MAAM,QAAQ;AAAA,cACd,OAAO;AAAA,gBACN,EAAE,MAAM,WAAW;AAAA,gBACnB;AAAA,kBACC,YAAY;AAAA;AAAA,oBAEX,uBAAuB,CAAC,QAAQ;AAAA,oBAChC,+BAA+B;AAAA,oBAC/B,2BAA2B;AAAA,oBAC3B,4BAA4B;AAAA,oBAC5B,iCAAiC;AAAA,oBACjC,mCAAmC;AAAA,kBACpC;AAAA,kBACA,MAAM;AAAA,gBACP;AAAA,gBACA;AAAA,kBACC,YAAY;AAAA,oBACX,wBAAwB,OAAO,qBAAqB;AAAA,sBACnD,CAAC,aAAa,EAAE,QAAQ;AAAA,oBACzB;AAAA,oBACA,sCAAsC;AAAA,kBACvC;AAAA,kBACA,MAAM;AAAA,gBACP;AAAA,cACD;AAAA,cACA,QAAQ;AAAA,YACT,CAAC;AAAA,UACF;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD,CAAC;","names":[]}
|
|
@@ -13,7 +13,7 @@ import { blockMITLicense } from "./blocks/blockMITLicense.js";
|
|
|
13
13
|
import { blockPackageJson } from "./blocks/blockPackageJson.js";
|
|
14
14
|
import { blockPrettier } from "./blocks/blockPrettier.js";
|
|
15
15
|
import { blockREADME } from "./blocks/blockREADME.js";
|
|
16
|
-
import {
|
|
16
|
+
import { blockRepositoryBranchRuleset } from "./blocks/blockRepositoryBranchRuleset.js";
|
|
17
17
|
import { blockRepositoryLabels } from "./blocks/blockRepositoryLabels.js";
|
|
18
18
|
import { blockRepositorySettings } from "./blocks/blockRepositorySettings.js";
|
|
19
19
|
import { blockTemplatedBy } from "./blocks/blockTemplatedBy.js";
|
|
@@ -39,7 +39,7 @@ const presetMinimal = base.createPreset({
|
|
|
39
39
|
blockPackageJson,
|
|
40
40
|
blockPrettier,
|
|
41
41
|
blockREADME,
|
|
42
|
-
|
|
42
|
+
blockRepositoryBranchRuleset,
|
|
43
43
|
blockRepositoryLabels,
|
|
44
44
|
blockRepositorySettings,
|
|
45
45
|
blockTemplatedBy,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/next/presetMinimal.ts"],"sourcesContent":["import { base } from \"./base.js\";\nimport { blockContributingDocs } from \"./blocks/blockContributingDocs.js\";\nimport { blockContributorCovenant } from \"./blocks/blockContributorCovenant.js\";\nimport { blockDevelopmentDocs } from \"./blocks/blockDevelopmentDocs.js\";\nimport { blockESLint } from \"./blocks/blockESLint.js\";\nimport { blockExampleFiles } from \"./blocks/blockExampleFiles.js\";\nimport { blockFunding } from \"./blocks/blockFunding.js\";\nimport { blockGitHubActionsCI } from \"./blocks/blockGitHubActionsCI.js\";\nimport { blockGitHubIssueTemplates } from \"./blocks/blockGitHubIssueTemplates.js\";\nimport { blockGitHubPRTemplate } from \"./blocks/blockGitHubPRTemplate.js\";\nimport { blockGitignore } from \"./blocks/blockGitignore.js\";\nimport { blockMITLicense } from \"./blocks/blockMITLicense.js\";\nimport { blockPackageJson } from \"./blocks/blockPackageJson.js\";\nimport { blockPrettier } from \"./blocks/blockPrettier.js\";\nimport { blockREADME } from \"./blocks/blockREADME.js\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/next/presetMinimal.ts"],"sourcesContent":["import { base } from \"./base.js\";\nimport { blockContributingDocs } from \"./blocks/blockContributingDocs.js\";\nimport { blockContributorCovenant } from \"./blocks/blockContributorCovenant.js\";\nimport { blockDevelopmentDocs } from \"./blocks/blockDevelopmentDocs.js\";\nimport { blockESLint } from \"./blocks/blockESLint.js\";\nimport { blockExampleFiles } from \"./blocks/blockExampleFiles.js\";\nimport { blockFunding } from \"./blocks/blockFunding.js\";\nimport { blockGitHubActionsCI } from \"./blocks/blockGitHubActionsCI.js\";\nimport { blockGitHubIssueTemplates } from \"./blocks/blockGitHubIssueTemplates.js\";\nimport { blockGitHubPRTemplate } from \"./blocks/blockGitHubPRTemplate.js\";\nimport { blockGitignore } from \"./blocks/blockGitignore.js\";\nimport { blockMITLicense } from \"./blocks/blockMITLicense.js\";\nimport { blockPackageJson } from \"./blocks/blockPackageJson.js\";\nimport { blockPrettier } from \"./blocks/blockPrettier.js\";\nimport { blockREADME } from \"./blocks/blockREADME.js\";\nimport { blockRepositoryBranchRuleset } from \"./blocks/blockRepositoryBranchRuleset.js\";\nimport { blockRepositoryLabels } from \"./blocks/blockRepositoryLabels.js\";\nimport { blockRepositorySettings } from \"./blocks/blockRepositorySettings.js\";\nimport { blockTemplatedBy } from \"./blocks/blockTemplatedBy.js\";\nimport { blockTSup } from \"./blocks/blockTSup.js\";\nimport { blockTypeScript } from \"./blocks/blockTypeScript.js\";\n\nexport const presetMinimal = base.createPreset({\n\tabout: {\n\t\tdescription:\n\t\t\t\"Just bare starter tooling: building, formatting, linting, and type checking.\",\n\t\tname: \"Minimal\",\n\t},\n\tblocks: [\n\t\tblockContributingDocs,\n\t\tblockContributorCovenant,\n\t\tblockDevelopmentDocs,\n\t\tblockESLint,\n\t\tblockExampleFiles,\n\t\tblockFunding,\n\t\tblockGitHubActionsCI,\n\t\tblockGitHubIssueTemplates,\n\t\tblockGitHubPRTemplate,\n\t\tblockGitignore,\n\t\tblockMITLicense,\n\t\tblockPackageJson,\n\t\tblockPrettier,\n\t\tblockREADME,\n\t\tblockRepositoryBranchRuleset,\n\t\tblockRepositoryLabels,\n\t\tblockRepositorySettings,\n\t\tblockTemplatedBy,\n\t\tblockTSup,\n\t\tblockTypeScript,\n\t],\n});\n"],"mappings":"AAAA,SAAS,YAAY;AACrB,SAAS,6BAA6B;AACtC,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,4BAA4B;AACrC,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AACtC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,oCAAoC;AAC7C,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AACxC,SAAS,wBAAwB;AACjC,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAEzB,MAAM,gBAAgB,KAAK,aAAa;AAAA,EAC9C,OAAO;AAAA,IACN,aACC;AAAA,IACD,MAAM;AAAA,EACP;AAAA,EACA,QAAQ;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD,CAAC;","names":[]}
|
|
@@ -1,37 +1,50 @@
|
|
|
1
1
|
async function initializeBranchProtectionSettings(octokit, options) {
|
|
2
2
|
try {
|
|
3
|
-
await octokit.request(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{ context: "Prettier" },
|
|
28
|
-
...options.excludeTests ? [] : [{ context: "Test" }]
|
|
29
|
-
],
|
|
30
|
-
strict: false
|
|
3
|
+
await octokit.request("POST /repos/{owner}/{repo}/rulesets", {
|
|
4
|
+
conditions: {
|
|
5
|
+
ref_name: {
|
|
6
|
+
exclude: [],
|
|
7
|
+
include: ["refs/heads/main"]
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
enforcement: "active",
|
|
11
|
+
name: "Branch protection for main",
|
|
12
|
+
owner: options.owner,
|
|
13
|
+
repo: options.repository,
|
|
14
|
+
rules: [
|
|
15
|
+
{ type: "deletion" },
|
|
16
|
+
{
|
|
17
|
+
parameters: {
|
|
18
|
+
// @ts-expect-error -- https://github.com/github/rest-api-description/issues/4405
|
|
19
|
+
allowed_merge_methods: ["squash"],
|
|
20
|
+
dismiss_stale_reviews_on_push: false,
|
|
21
|
+
require_code_owner_review: false,
|
|
22
|
+
require_last_push_approval: false,
|
|
23
|
+
required_approving_review_count: 0,
|
|
24
|
+
required_review_thread_resolution: false
|
|
25
|
+
},
|
|
26
|
+
type: "pull_request"
|
|
31
27
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
{
|
|
29
|
+
parameters: {
|
|
30
|
+
required_status_checks: [
|
|
31
|
+
{ context: "Build" },
|
|
32
|
+
...options.excludeCompliance ? [] : [{ context: "Compliance" }],
|
|
33
|
+
{ context: "Lint" },
|
|
34
|
+
...options.excludeLintKnip ? [] : [{ context: "Lint Knip" }],
|
|
35
|
+
...options.excludeLintMd ? [] : [{ context: "Lint Markdown" }],
|
|
36
|
+
...options.excludeLintPackages ? [] : [{ context: "Lint Packages" }],
|
|
37
|
+
...options.excludeLintSpelling ? [] : [{ context: "Lint Spelling" }],
|
|
38
|
+
{ context: "Prettier" },
|
|
39
|
+
...options.excludeTests ? [] : [{ context: "Test" }]
|
|
40
|
+
],
|
|
41
|
+
strict_required_status_checks_policy: false
|
|
42
|
+
},
|
|
43
|
+
type: "required_status_checks"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
target: "branch"
|
|
47
|
+
});
|
|
35
48
|
} catch (error) {
|
|
36
49
|
if (error.status === 403) {
|
|
37
50
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/steps/initializeGitHubRepository/initializeBranchProtectionSettings.ts"],"sourcesContent":["import { RequestError } from \"@octokit/request-error\";\nimport { Octokit } from \"octokit\";\n\nimport { Options } from \"../../shared/types.js\";\n\nexport async function initializeBranchProtectionSettings(\n\toctokit: Octokit,\n\toptions: Options,\n) {\n\ttry {\n\t\tawait octokit.request(\
|
|
1
|
+
{"version":3,"sources":["../../../src/steps/initializeGitHubRepository/initializeBranchProtectionSettings.ts"],"sourcesContent":["import { RequestError } from \"@octokit/request-error\";\nimport { Octokit } from \"octokit\";\n\nimport { Options } from \"../../shared/types.js\";\n\nexport async function initializeBranchProtectionSettings(\n\toctokit: Octokit,\n\toptions: Options,\n) {\n\ttry {\n\t\tawait octokit.request(\"POST /repos/{owner}/{repo}/rulesets\", {\n\t\t\tconditions: {\n\t\t\t\tref_name: {\n\t\t\t\t\texclude: [],\n\t\t\t\t\tinclude: [\"refs/heads/main\"],\n\t\t\t\t},\n\t\t\t},\n\t\t\tenforcement: \"active\",\n\t\t\tname: \"Branch protection for main\",\n\t\t\towner: options.owner,\n\t\t\trepo: options.repository,\n\t\t\trules: [\n\t\t\t\t{ type: \"deletion\" },\n\t\t\t\t{\n\t\t\t\t\tparameters: {\n\t\t\t\t\t\t// @ts-expect-error -- https://github.com/github/rest-api-description/issues/4405\n\t\t\t\t\t\tallowed_merge_methods: [\"squash\"],\n\t\t\t\t\t\tdismiss_stale_reviews_on_push: false,\n\t\t\t\t\t\trequire_code_owner_review: false,\n\t\t\t\t\t\trequire_last_push_approval: false,\n\t\t\t\t\t\trequired_approving_review_count: 0,\n\t\t\t\t\t\trequired_review_thread_resolution: false,\n\t\t\t\t\t},\n\t\t\t\t\ttype: \"pull_request\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tparameters: {\n\t\t\t\t\t\trequired_status_checks: [\n\t\t\t\t\t\t\t{ context: \"Build\" },\n\t\t\t\t\t\t\t...(options.excludeCompliance ? [] : [{ context: \"Compliance\" }]),\n\t\t\t\t\t\t\t{ context: \"Lint\" },\n\t\t\t\t\t\t\t...(options.excludeLintKnip ? [] : [{ context: \"Lint Knip\" }]),\n\t\t\t\t\t\t\t...(options.excludeLintMd ? [] : [{ context: \"Lint Markdown\" }]),\n\t\t\t\t\t\t\t...(options.excludeLintPackages\n\t\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t\t: [{ context: \"Lint Packages\" }]),\n\t\t\t\t\t\t\t...(options.excludeLintSpelling\n\t\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t\t: [{ context: \"Lint Spelling\" }]),\n\t\t\t\t\t\t\t{ context: \"Prettier\" },\n\t\t\t\t\t\t\t...(options.excludeTests ? [] : [{ context: \"Test\" }]),\n\t\t\t\t\t\t],\n\t\t\t\t\t\tstrict_required_status_checks_policy: false,\n\t\t\t\t\t},\n\t\t\t\t\ttype: \"required_status_checks\",\n\t\t\t\t},\n\t\t\t],\n\t\t\ttarget: \"branch\",\n\t\t});\n\t} catch (error) {\n\t\tif ((error as RequestError).status === 403) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n"],"mappings":"AAKA,eAAsB,mCACrB,SACA,SACC;AACD,MAAI;AACH,UAAM,QAAQ,QAAQ,uCAAuC;AAAA,MAC5D,YAAY;AAAA,QACX,UAAU;AAAA,UACT,SAAS,CAAC;AAAA,UACV,SAAS,CAAC,iBAAiB;AAAA,QAC5B;AAAA,MACD;AAAA,MACA,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO,QAAQ;AAAA,MACf,MAAM,QAAQ;AAAA,MACd,OAAO;AAAA,QACN,EAAE,MAAM,WAAW;AAAA,QACnB;AAAA,UACC,YAAY;AAAA;AAAA,YAEX,uBAAuB,CAAC,QAAQ;AAAA,YAChC,+BAA+B;AAAA,YAC/B,2BAA2B;AAAA,YAC3B,4BAA4B;AAAA,YAC5B,iCAAiC;AAAA,YACjC,mCAAmC;AAAA,UACpC;AAAA,UACA,MAAM;AAAA,QACP;AAAA,QACA;AAAA,UACC,YAAY;AAAA,YACX,wBAAwB;AAAA,cACvB,EAAE,SAAS,QAAQ;AAAA,cACnB,GAAI,QAAQ,oBAAoB,CAAC,IAAI,CAAC,EAAE,SAAS,aAAa,CAAC;AAAA,cAC/D,EAAE,SAAS,OAAO;AAAA,cAClB,GAAI,QAAQ,kBAAkB,CAAC,IAAI,CAAC,EAAE,SAAS,YAAY,CAAC;AAAA,cAC5D,GAAI,QAAQ,gBAAgB,CAAC,IAAI,CAAC,EAAE,SAAS,gBAAgB,CAAC;AAAA,cAC9D,GAAI,QAAQ,sBACT,CAAC,IACD,CAAC,EAAE,SAAS,gBAAgB,CAAC;AAAA,cAChC,GAAI,QAAQ,sBACT,CAAC,IACD,CAAC,EAAE,SAAS,gBAAgB,CAAC;AAAA,cAChC,EAAE,SAAS,WAAW;AAAA,cACtB,GAAI,QAAQ,eAAe,CAAC,IAAI,CAAC,EAAE,SAAS,OAAO,CAAC;AAAA,YACrD;AAAA,YACA,sCAAsC;AAAA,UACvC;AAAA,UACA,MAAM;AAAA,QACP;AAAA,MACD;AAAA,MACA,QAAQ;AAAA,IACT,CAAC;AAAA,EACF,SAAS,OAAO;AACf,QAAK,MAAuB,WAAW,KAAK;AAC3C,aAAO;AAAA,IACR;AAEA,UAAM;AAAA,EACP;AACD;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { base } from "../base.js";
|
|
3
|
-
const blockRepositoryBranchProtection = base.createBlock({
|
|
4
|
-
about: {
|
|
5
|
-
name: "Repository Branch Protection"
|
|
6
|
-
},
|
|
7
|
-
addons: {
|
|
8
|
-
requiredStatusChecks: z.array(z.string()).default([])
|
|
9
|
-
},
|
|
10
|
-
produce({ addons, options }) {
|
|
11
|
-
return {
|
|
12
|
-
requests: [
|
|
13
|
-
{
|
|
14
|
-
id: "branch-protection",
|
|
15
|
-
async send({ octokit }) {
|
|
16
|
-
await octokit.request(
|
|
17
|
-
`PUT /repos/{owner}/{repository}/branches/{main}/protection`,
|
|
18
|
-
{
|
|
19
|
-
allow_deletions: false,
|
|
20
|
-
allow_force_pushes: true,
|
|
21
|
-
allow_fork_pushes: false,
|
|
22
|
-
allow_fork_syncing: true,
|
|
23
|
-
block_creations: false,
|
|
24
|
-
branch: "main",
|
|
25
|
-
enforce_admins: false,
|
|
26
|
-
owner: options.owner,
|
|
27
|
-
repo: options.repository,
|
|
28
|
-
required_conversation_resolution: true,
|
|
29
|
-
required_linear_history: false,
|
|
30
|
-
required_pull_request_reviews: null,
|
|
31
|
-
required_status_checks: {
|
|
32
|
-
checks: addons.requiredStatusChecks.map((context) => ({
|
|
33
|
-
context
|
|
34
|
-
})),
|
|
35
|
-
strict: false
|
|
36
|
-
},
|
|
37
|
-
restrictions: null
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
export {
|
|
47
|
-
blockRepositoryBranchProtection
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=blockRepositoryBranchProtection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/next/blocks/blockRepositoryBranchProtection.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { base } from \"../base.js\";\n\nexport const blockRepositoryBranchProtection = base.createBlock({\n\tabout: {\n\t\tname: \"Repository Branch Protection\",\n\t},\n\taddons: {\n\t\trequiredStatusChecks: z.array(z.string()).default([]),\n\t},\n\tproduce({ addons, options }) {\n\t\treturn {\n\t\t\trequests: [\n\t\t\t\t{\n\t\t\t\t\tid: \"branch-protection\",\n\t\t\t\t\tasync send({ octokit }) {\n\t\t\t\t\t\tawait octokit.request(\n\t\t\t\t\t\t\t`PUT /repos/{owner}/{repository}/branches/{main}/protection`,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tallow_deletions: false,\n\t\t\t\t\t\t\t\tallow_force_pushes: true,\n\t\t\t\t\t\t\t\tallow_fork_pushes: false,\n\t\t\t\t\t\t\t\tallow_fork_syncing: true,\n\t\t\t\t\t\t\t\tblock_creations: false,\n\t\t\t\t\t\t\t\tbranch: \"main\",\n\t\t\t\t\t\t\t\tenforce_admins: false,\n\t\t\t\t\t\t\t\towner: options.owner,\n\t\t\t\t\t\t\t\trepo: options.repository,\n\t\t\t\t\t\t\t\trequired_conversation_resolution: true,\n\t\t\t\t\t\t\t\trequired_linear_history: false,\n\t\t\t\t\t\t\t\trequired_pull_request_reviews: null,\n\t\t\t\t\t\t\t\trequired_status_checks: {\n\t\t\t\t\t\t\t\t\tchecks: addons.requiredStatusChecks.map((context) => ({\n\t\t\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\t\t\tstrict: false,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\trestrictions: null,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t},\n});\n"],"mappings":"AAAA,SAAS,SAAS;AAElB,SAAS,YAAY;AAEd,MAAM,kCAAkC,KAAK,YAAY;AAAA,EAC/D,OAAO;AAAA,IACN,MAAM;AAAA,EACP;AAAA,EACA,QAAQ;AAAA,IACP,sBAAsB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;AAAA,EACrD;AAAA,EACA,QAAQ,EAAE,QAAQ,QAAQ,GAAG;AAC5B,WAAO;AAAA,MACN,UAAU;AAAA,QACT;AAAA,UACC,IAAI;AAAA,UACJ,MAAM,KAAK,EAAE,QAAQ,GAAG;AACvB,kBAAM,QAAQ;AAAA,cACb;AAAA,cACA;AAAA,gBACC,iBAAiB;AAAA,gBACjB,oBAAoB;AAAA,gBACpB,mBAAmB;AAAA,gBACnB,oBAAoB;AAAA,gBACpB,iBAAiB;AAAA,gBACjB,QAAQ;AAAA,gBACR,gBAAgB;AAAA,gBAChB,OAAO,QAAQ;AAAA,gBACf,MAAM,QAAQ;AAAA,gBACd,kCAAkC;AAAA,gBAClC,yBAAyB;AAAA,gBACzB,+BAA+B;AAAA,gBAC/B,wBAAwB;AAAA,kBACvB,QAAQ,OAAO,qBAAqB,IAAI,CAAC,aAAa;AAAA,oBACrD;AAAA,kBACD,EAAE;AAAA,kBACF,QAAQ;AAAA,gBACT;AAAA,gBACA,cAAc;AAAA,cACf;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD,CAAC;","names":[]}
|