create-typescript-app 1.29.31 → 1.29.33
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/bin/mode.js +10 -3
- package/lib/bin/mode.js.map +1 -1
- package/lib/create/createWithOptions.d.ts +4 -3
- package/lib/create/createWithOptions.js +3 -6
- package/lib/create/createWithOptions.js.map +1 -1
- package/lib/initialize/initializeWithOptions.d.ts +4 -3
- package/lib/initialize/initializeWithOptions.js +3 -3
- package/lib/initialize/initializeWithOptions.js.map +1 -1
- package/lib/migrate/migrateWithOptions.d.ts +4 -3
- package/lib/migrate/migrateWithOptions.js +4 -4
- package/lib/migrate/migrateWithOptions.js.map +1 -1
- package/lib/shared/options/ensureRepositoryExists.d.ts +4 -3
- package/lib/shared/options/ensureRepositoryExists.js +9 -8
- package/lib/shared/options/ensureRepositoryExists.js.map +1 -1
- package/lib/shared/options/getGitHub.d.ts +9 -0
- package/lib/shared/options/{getOctokit.js → getGitHub.js} +5 -4
- package/lib/shared/options/getGitHub.js.map +1 -0
- package/lib/shared/options/getPrefillOrPromptedOption.d.ts +1 -1
- package/lib/shared/options/getPrefillOrPromptedOption.js +2 -2
- package/lib/shared/options/getPrefillOrPromptedOption.js.map +1 -1
- package/lib/shared/options/readGitAndNpmDefaults/index.d.ts +9 -9
- package/lib/shared/options/readGitAndNpmDefaults/index.js +16 -12
- package/lib/shared/options/readGitAndNpmDefaults/index.js.map +1 -1
- package/lib/shared/options/readOptions.d.ts +6 -5
- package/lib/shared/options/readOptions.js +10 -10
- package/lib/shared/options/readOptions.js.map +1 -1
- package/lib/shared/tryCatchLazyValueAsync.d.ts +3 -0
- package/lib/shared/tryCatchLazyValueAsync.js +9 -0
- package/lib/shared/tryCatchLazyValueAsync.js.map +1 -0
- package/lib/steps/detectExistingContributors.d.ts +1 -1
- package/lib/steps/detectExistingContributors.js +5 -2
- package/lib/steps/detectExistingContributors.js.map +1 -1
- package/lib/steps/initializeGitHubRepository/initializeBranchProtectionSettings.js +1 -1
- package/lib/steps/initializeGitHubRepository/initializeBranchProtectionSettings.js.map +1 -1
- package/lib/steps/uninstallPackages.js +1 -0
- package/lib/steps/uninstallPackages.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.js +7 -3
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/index.d.ts +2 -1
- package/lib/steps/writing/creation/dotGitHub/workflows.d.ts +2 -1
- package/lib/steps/writing/creation/dotGitHub/workflows.js +8 -2
- package/lib/steps/writing/creation/dotGitHub/workflows.js.map +1 -1
- package/lib/steps/writing/creation/writePackageJson.js +1 -0
- package/lib/steps/writing/creation/writePackageJson.js.map +1 -1
- package/package.json +3 -2
- package/lib/shared/options/getOctokit.d.ts +0 -5
- package/lib/shared/options/getOctokit.js.map +0 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<a href="#contributors" target="_blank">
|
|
7
7
|
<!-- prettier-ignore-start -->
|
|
8
8
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
9
|
-
<img alt="All Contributors:
|
|
9
|
+
<img alt="All Contributors: 25 🤝" src="https://img.shields.io/badge/all_contributors-25_🤝-21bb42.svg" />
|
|
10
10
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
11
11
|
<!-- prettier-ignore-end -->
|
|
12
12
|
</a>
|
|
@@ -84,28 +84,29 @@ Thanks! 💖
|
|
|
84
84
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/nowyDEV"><img src="https://avatars.githubusercontent.com/u/12304307?v=4?s=100" width="100px;" alt="Dominik Nowik"/><br /><sub><b>Dominik Nowik</b></sub></a><br /><a href="#tool-nowyDEV" title="Tools">🔧</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=nowyDEV" title="Code">💻</a></td>
|
|
85
85
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/emday4prez"><img src="https://avatars.githubusercontent.com/u/35363144?v=4?s=100" width="100px;" alt="Emerson"/><br /><sub><b>Emerson</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=emday4prez" title="Code">💻</a></td>
|
|
86
86
|
<td align="center" valign="top" width="14.28%"><a href="https://sinchang.me"><img src="https://avatars.githubusercontent.com/u/3297859?v=4?s=100" width="100px;" alt="Jeff Wen"/><br /><sub><b>Jeff Wen</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=sinchang" title="Code">💻</a></td>
|
|
87
|
+
<td align="center" valign="top" width="14.28%"><a href="https://jessicawilkins.dev/"><img src="https://avatars.githubusercontent.com/u/67210629?v=4?s=100" width="100px;" alt="Jessica Wilkins "/><br /><sub><b>Jessica Wilkins </b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=jdwilkin4" title="Code">💻</a></td>
|
|
87
88
|
<td align="center" valign="top" width="14.28%"><a href="https://typescriptcourse.com/tutorials"><img src="https://avatars.githubusercontent.com/u/3806031?v=4?s=100" width="100px;" alt="Joe Previte"/><br /><sub><b>Joe Previte</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3Ajsjoeio" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=jsjoeio" title="Code">💻</a></td>
|
|
88
|
-
<td align="center" valign="top" width="14.28%"><a href="https://blog.johnnyreilly.com/"><img src="https://avatars.githubusercontent.com/u/1010525?v=4?s=100" width="100px;" alt="John Reilly"/><br /><sub><b>John Reilly</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=johnnyreilly" title="Code">💻</a></td>
|
|
89
89
|
</tr>
|
|
90
90
|
<tr>
|
|
91
|
+
<td align="center" valign="top" width="14.28%"><a href="https://blog.johnnyreilly.com/"><img src="https://avatars.githubusercontent.com/u/1010525?v=4?s=100" width="100px;" alt="John Reilly"/><br /><sub><b>John Reilly</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=johnnyreilly" title="Code">💻</a></td>
|
|
91
92
|
<td align="center" valign="top" width="14.28%"><a href="http://www.joshuakgoldberg.com"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg"/><br /><sub><b>Josh Goldberg</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3AJoshuaKGoldberg" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=JoshuaKGoldberg" title="Code">💻</a> <a href="#maintenance-JoshuaKGoldberg" title="Maintenance">🚧</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/pulls?q=is%3Apr+reviewed-by%3AJoshuaKGoldberg" title="Reviewed Pull Requests">👀</a> <a href="#tool-JoshuaKGoldberg" title="Tools">🔧</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=JoshuaKGoldberg" title="Documentation">📖</a> <a href="#infra-JoshuaKGoldberg" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=JoshuaKGoldberg" title="Tests">⚠️</a></td>
|
|
92
93
|
<td align="center" valign="top" width="14.28%"><a href="https://twitter.com/Jolg42"><img src="https://avatars.githubusercontent.com/u/1328733?v=4?s=100" width="100px;" alt="Joël Galeran"/><br /><sub><b>Joël Galeran</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=jolg42" title="Code">💻</a></td>
|
|
93
94
|
<td align="center" valign="top" width="14.28%"><a href="https://kristo-baricevic.github.io/"><img src="https://avatars.githubusercontent.com/u/108290619?v=4?s=100" width="100px;" alt="Kristo Baricevic"/><br /><sub><b>Kristo Baricevic</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=kristo-baricevic" title="Code">💻</a></td>
|
|
94
95
|
<td align="center" valign="top" width="14.28%"><a href="https://webpro.nl"><img src="https://avatars.githubusercontent.com/u/456426?v=4?s=100" width="100px;" alt="Lars Kappert"/><br /><sub><b>Lars Kappert</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=webpro" title="Code">💻</a></td>
|
|
95
96
|
<td align="center" valign="top" width="14.28%"><a href="https://navinmoorthy.me/"><img src="https://avatars.githubusercontent.com/u/39694575?v=4?s=100" width="100px;" alt="Navin Moorthy"/><br /><sub><b>Navin Moorthy</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3Anavin-moorthy" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=navin-moorthy" title="Code">💻</a></td>
|
|
96
97
|
<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>
|
|
97
|
-
<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>
|
|
98
98
|
</tr>
|
|
99
99
|
<tr>
|
|
100
|
+
<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>
|
|
100
101
|
<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>
|
|
101
102
|
<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>
|
|
102
103
|
<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>
|
|
103
104
|
<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>
|
|
104
105
|
<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>
|
|
105
106
|
<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>
|
|
106
|
-
<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></td>
|
|
107
107
|
</tr>
|
|
108
108
|
<tr>
|
|
109
|
+
<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>
|
|
109
110
|
<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>
|
|
110
111
|
<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>
|
|
111
112
|
<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>
|
package/lib/bin/mode.js
CHANGED
|
@@ -16,20 +16,27 @@ async function promptForMode(input) {
|
|
|
16
16
|
}
|
|
17
17
|
return input;
|
|
18
18
|
}
|
|
19
|
+
const label = (base, text) => `${chalk.bold(base)} ${text}`;
|
|
19
20
|
const selection = filterPromptCancel(
|
|
20
21
|
await prompts.select({
|
|
21
22
|
message: chalk.blue("How would you like to use the template?"),
|
|
22
23
|
options: [
|
|
23
24
|
{
|
|
24
|
-
label: "
|
|
25
|
+
label: label("create", "a new repository in a child directory"),
|
|
25
26
|
value: "create"
|
|
26
27
|
},
|
|
27
28
|
{
|
|
28
|
-
label:
|
|
29
|
+
label: label(
|
|
30
|
+
"initialize",
|
|
31
|
+
"a freshly repository in the current directory"
|
|
32
|
+
),
|
|
29
33
|
value: "initialize"
|
|
30
34
|
},
|
|
31
35
|
{
|
|
32
|
-
label:
|
|
36
|
+
label: label(
|
|
37
|
+
"migrate",
|
|
38
|
+
"an existing repository in the current directory"
|
|
39
|
+
),
|
|
33
40
|
value: "migrate"
|
|
34
41
|
}
|
|
35
42
|
]
|
package/lib/bin/mode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bin/mode.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport chalk from \"chalk\";\n\nimport { StatusCode } from \"../shared/codes.js\";\nimport { filterPromptCancel } from \"../shared/prompts.js\";\nimport { Options } from \"../shared/types.js\";\n\nexport interface ModeResult {\n\tcode: StatusCode;\n\toptions: Partial<Options>;\n}\n\nexport type ModeRunner = (args: string[]) => Promise<ModeResult>;\n\nexport type Mode = \"create\" | \"initialize\" | \"migrate\";\n\nconst allowedModes = [\"create\", \"initialize\", \"migrate\"] satisfies Mode[];\n\nfunction isMode(input: boolean | string): input is Mode {\n\treturn allowedModes.includes(input as Mode);\n}\n\nexport async function promptForMode(input: boolean | string | undefined) {\n\tif (input) {\n\t\tif (!isMode(input)) {\n\t\t\treturn new Error(\n\t\t\t\t`Unknown --mode: ${input}. Allowed modes are: ${allowedModes.join(\n\t\t\t\t\t\", \",\n\t\t\t\t)}.`,\n\t\t\t);\n\t\t}\n\n\t\treturn input;\n\t}\n\n\tconst selection = filterPromptCancel(\n\t\t(await prompts.select({\n\t\t\tmessage: chalk.blue(\"How would you like to use the template?\"),\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"
|
|
1
|
+
{"version":3,"sources":["../../src/bin/mode.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport chalk from \"chalk\";\n\nimport { StatusCode } from \"../shared/codes.js\";\nimport { filterPromptCancel } from \"../shared/prompts.js\";\nimport { Options } from \"../shared/types.js\";\n\nexport interface ModeResult {\n\tcode: StatusCode;\n\toptions: Partial<Options>;\n}\n\nexport type ModeRunner = (args: string[]) => Promise<ModeResult>;\n\nexport type Mode = \"create\" | \"initialize\" | \"migrate\";\n\nconst allowedModes = [\"create\", \"initialize\", \"migrate\"] satisfies Mode[];\n\nfunction isMode(input: boolean | string): input is Mode {\n\treturn allowedModes.includes(input as Mode);\n}\n\nexport async function promptForMode(input: boolean | string | undefined) {\n\tif (input) {\n\t\tif (!isMode(input)) {\n\t\t\treturn new Error(\n\t\t\t\t`Unknown --mode: ${input}. Allowed modes are: ${allowedModes.join(\n\t\t\t\t\t\", \",\n\t\t\t\t)}.`,\n\t\t\t);\n\t\t}\n\n\t\treturn input;\n\t}\n\n\tconst label = (base: string, text: string) => `${chalk.bold(base)} ${text}`;\n\n\tconst selection = filterPromptCancel(\n\t\t(await prompts.select({\n\t\t\tmessage: chalk.blue(\"How would you like to use the template?\"),\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tlabel: label(\"create\", \"a new repository in a child directory\"),\n\t\t\t\t\tvalue: \"create\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: label(\n\t\t\t\t\t\t\"initialize\",\n\t\t\t\t\t\t\"a freshly repository in the current directory\",\n\t\t\t\t\t),\n\t\t\t\t\tvalue: \"initialize\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: label(\n\t\t\t\t\t\t\"migrate\",\n\t\t\t\t\t\t\"an existing repository in the current directory\",\n\t\t\t\t\t),\n\t\t\t\t\tvalue: \"migrate\",\n\t\t\t\t},\n\t\t\t],\n\t\t})) as Mode | symbol,\n\t);\n\n\treturn selection;\n}\n"],"mappings":"AAAA,YAAY,aAAa;AACzB,OAAO,WAAW;AAGlB,SAAS,0BAA0B;AAYnC,MAAM,eAAe,CAAC,UAAU,cAAc,SAAS;AAEvD,SAAS,OAAO,OAAwC;AACvD,SAAO,aAAa,SAAS,KAAa;AAC3C;AAEA,eAAsB,cAAc,OAAqC;AACxE,MAAI,OAAO;AACV,QAAI,CAAC,OAAO,KAAK,GAAG;AACnB,aAAO,IAAI;AAAA,QACV,mBAAmB,KAAK,wBAAwB,aAAa;AAAA,UAC5D;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD;AAEA,WAAO;AAAA,EACR;AAEA,QAAM,QAAQ,CAAC,MAAc,SAAiB,GAAG,MAAM,KAAK,IAAI,CAAC,IAAI,IAAI;AAEzE,QAAM,YAAY;AAAA,IAChB,MAAM,QAAQ,OAAO;AAAA,MACrB,SAAS,MAAM,KAAK,yCAAyC;AAAA,MAC7D,SAAS;AAAA,QACR;AAAA,UACC,OAAO,MAAM,UAAU,uCAAuC;AAAA,UAC9D,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,OAAO;AAAA,YACN;AAAA,YACA;AAAA,UACD;AAAA,UACA,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,OAAO;AAAA,YACN;AAAA,YACA;AAAA,UACD;AAAA,UACA,OAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF;AAEA,SAAO;AACR;","names":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import 'octokit';
|
|
1
|
+
import { GitHubAndOptions } from '../shared/options/readOptions.js';
|
|
3
2
|
import '../shared/types.js';
|
|
3
|
+
import '../shared/options/getGitHub.js';
|
|
4
|
+
import 'octokit';
|
|
4
5
|
|
|
5
|
-
declare function createWithOptions({
|
|
6
|
+
declare function createWithOptions({ github, options }: GitHubAndOptions): Promise<{
|
|
6
7
|
sentToGitHub: boolean | undefined;
|
|
7
8
|
}>;
|
|
8
9
|
|
|
@@ -8,10 +8,7 @@ import { initializeGitHubRepository } from "../steps/initializeGitHubRepository/
|
|
|
8
8
|
import { runCommands } from "../steps/runCommands.js";
|
|
9
9
|
import { writeReadme } from "../steps/writeReadme.js";
|
|
10
10
|
import { writeStructure } from "../steps/writing/writeStructure.js";
|
|
11
|
-
async function createWithOptions({
|
|
12
|
-
octokit,
|
|
13
|
-
options
|
|
14
|
-
}) {
|
|
11
|
+
async function createWithOptions({ github, options }) {
|
|
15
12
|
await withSpinners("Creating repository structure", [
|
|
16
13
|
[
|
|
17
14
|
"Writing structure",
|
|
@@ -42,7 +39,7 @@ async function createWithOptions({
|
|
|
42
39
|
"pnpm format --write",
|
|
43
40
|
"pnpm lint --fix"
|
|
44
41
|
]);
|
|
45
|
-
const sendToGitHub =
|
|
42
|
+
const sendToGitHub = github && await doesRepositoryExist(github.octokit, options) && (options.createRepository ?? await prompts.confirm({
|
|
46
43
|
message: "Would you like to push the template's tooling up to the repository on GitHub?"
|
|
47
44
|
}) === true);
|
|
48
45
|
if (sendToGitHub) {
|
|
@@ -51,7 +48,7 @@ async function createWithOptions({
|
|
|
51
48
|
await $`git add -A`;
|
|
52
49
|
await $`git commit --message ${"feat: initialized repo \u2728"}`;
|
|
53
50
|
await $`git push -u origin main --force`;
|
|
54
|
-
await initializeGitHubRepository(octokit, options);
|
|
51
|
+
await initializeGitHubRepository(github.octokit, options);
|
|
55
52
|
});
|
|
56
53
|
}
|
|
57
54
|
return { sentToGitHub: sendToGitHub };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/create/createWithOptions.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport { $ } from \"execa\";\n\nimport { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { doesRepositoryExist } from \"../shared/doesRepositoryExist.js\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/create/createWithOptions.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport { $ } from \"execa\";\n\nimport { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { doesRepositoryExist } from \"../shared/doesRepositoryExist.js\";\nimport { GitHubAndOptions } from \"../shared/options/readOptions.js\";\nimport { addToolAllContributors } from \"../steps/addToolAllContributors.js\";\nimport { finalizeDependencies } from \"../steps/finalizeDependencies.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { runCommands } from \"../steps/runCommands.js\";\nimport { writeReadme } from \"../steps/writeReadme.js\";\nimport { writeStructure } from \"../steps/writing/writeStructure.js\";\n\nexport async function createWithOptions({ github, options }: GitHubAndOptions) {\n\tawait withSpinners(\"Creating repository structure\", [\n\t\t[\n\t\t\t\"Writing structure\",\n\t\t\tasync () => {\n\t\t\t\tawait writeStructure(options);\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\t\"Writing README.md\",\n\t\t\tasync () => {\n\t\t\t\tawait writeReadme(options);\n\t\t\t},\n\t\t],\n\t]);\n\n\tif (!options.excludeContributors) {\n\t\tawait withSpinner(\"Adding contributors to table\", async () => {\n\t\t\tawait addToolAllContributors(options.owner);\n\t\t});\n\t}\n\n\tif (!options.skipInstall) {\n\t\tawait withSpinner(\"Installing packages\", async () =>\n\t\t\tfinalizeDependencies(options),\n\t\t);\n\t}\n\n\tawait runCommands(\"Cleaning up files\", [\n\t\t\"pnpm dedupe\",\n\t\t\"pnpm format --write\",\n\t\t\"pnpm lint --fix\",\n\t]);\n\n\tconst sendToGitHub =\n\t\tgithub &&\n\t\t(await doesRepositoryExist(github.octokit, options)) &&\n\t\t(options.createRepository ??\n\t\t\t(await prompts.confirm({\n\t\t\t\tmessage:\n\t\t\t\t\t\"Would you like to push the template's tooling up to the repository on GitHub?\",\n\t\t\t})) === true);\n\n\tif (sendToGitHub) {\n\t\tawait withSpinner(\"Initializing GitHub repository\", async () => {\n\t\t\tawait $`git remote add origin https://github.com/${options.owner}/${options.repository}`;\n\t\t\tawait $`git add -A`;\n\t\t\tawait $`git commit --message ${\"feat: initialized repo ✨\"}`;\n\t\t\tawait $`git push -u origin main --force`;\n\t\t\tawait initializeGitHubRepository(github.octokit, options);\n\t\t});\n\t}\n\n\treturn { sentToGitHub: sendToGitHub };\n}\n"],"mappings":"AAAA,YAAY,aAAa;AACzB,SAAS,SAAS;AAElB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,2BAA2B;AAEpC,SAAS,8BAA8B;AACvC,SAAS,4BAA4B;AACrC,SAAS,kCAAkC;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAE/B,eAAsB,kBAAkB,EAAE,QAAQ,QAAQ,GAAqB;AAC9E,QAAM,aAAa,iCAAiC;AAAA,IACnD;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,eAAe,OAAO;AAAA,MAC7B;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,YAAY,OAAO;AAAA,MAC1B;AAAA,IACD;AAAA,EACD,CAAC;AAED,MAAI,CAAC,QAAQ,qBAAqB;AACjC,UAAM,YAAY,gCAAgC,YAAY;AAC7D,YAAM,uBAAuB,QAAQ,KAAK;AAAA,IAC3C,CAAC;AAAA,EACF;AAEA,MAAI,CAAC,QAAQ,aAAa;AACzB,UAAM;AAAA,MAAY;AAAA,MAAuB,YACxC,qBAAqB,OAAO;AAAA,IAC7B;AAAA,EACD;AAEA,QAAM,YAAY,qBAAqB;AAAA,IACtC;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAC;AAED,QAAM,eACL,UACC,MAAM,oBAAoB,OAAO,SAAS,OAAO,MACjD,QAAQ,oBACP,MAAM,QAAQ,QAAQ;AAAA,IACtB,SACC;AAAA,EACF,CAAC,MAAO;AAEV,MAAI,cAAc;AACjB,UAAM,YAAY,kCAAkC,YAAY;AAC/D,YAAM,6CAA6C,QAAQ,KAAK,IAAI,QAAQ,UAAU;AACtF,YAAM;AACN,YAAM,yBAAyB,+BAA0B;AACzD,YAAM;AACN,YAAM,2BAA2B,OAAO,SAAS,OAAO;AAAA,IACzD,CAAC;AAAA,EACF;AAEA,SAAO,EAAE,cAAc,aAAa;AACrC;","names":[]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import 'octokit';
|
|
1
|
+
import { GitHubAndOptions } from '../shared/options/readOptions.js';
|
|
3
2
|
import '../shared/types.js';
|
|
3
|
+
import '../shared/options/getGitHub.js';
|
|
4
|
+
import 'octokit';
|
|
4
5
|
|
|
5
|
-
declare function initializeWithOptions({
|
|
6
|
+
declare function initializeWithOptions({ github, options, }: GitHubAndOptions): Promise<void>;
|
|
6
7
|
|
|
7
8
|
export { initializeWithOptions };
|
|
@@ -10,7 +10,7 @@ import { updateAllContributorsTable } from "../steps/updateAllContributorsTable.
|
|
|
10
10
|
import { updateLocalFiles } from "../steps/updateLocalFiles.js";
|
|
11
11
|
import { updateReadme } from "../steps/updateReadme.js";
|
|
12
12
|
async function initializeWithOptions({
|
|
13
|
-
|
|
13
|
+
github,
|
|
14
14
|
options
|
|
15
15
|
}) {
|
|
16
16
|
await withSpinners("Initializing local files", [
|
|
@@ -35,9 +35,9 @@ async function initializeWithOptions({
|
|
|
35
35
|
await addOwnerAsAllContributor(options.owner);
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
if (
|
|
38
|
+
if (github) {
|
|
39
39
|
await withSpinner("Initializing GitHub repository", async () => {
|
|
40
|
-
await initializeGitHubRepository(octokit, options);
|
|
40
|
+
await initializeGitHubRepository(github.octokit, options);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
if (!options.skipRemoval) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/initialize/initializeWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/initialize/initializeWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { GitHubAndOptions } from \"../shared/options/readOptions.js\";\nimport { addOwnerAsAllContributor } from \"../steps/addOwnerAsAllContributor.js\";\nimport { clearChangelog } from \"../steps/clearChangelog.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { removeSetupScripts } from \"../steps/removeSetupScripts.js\";\nimport { resetGitTags } from \"../steps/resetGitTags.js\";\nimport { runCommands } from \"../steps/runCommands.js\";\nimport { uninstallPackages } from \"../steps/uninstallPackages.js\";\nimport { updateAllContributorsTable } from \"../steps/updateAllContributorsTable.js\";\nimport { updateLocalFiles } from \"../steps/updateLocalFiles.js\";\nimport { updateReadme } from \"../steps/updateReadme.js\";\n\nexport async function initializeWithOptions({\n\tgithub,\n\toptions,\n}: GitHubAndOptions) {\n\tawait withSpinners(\"Initializing local files\", [\n\t\t[\n\t\t\t\"Updating local files\",\n\t\t\tasync () => {\n\t\t\t\tawait updateLocalFiles(options);\n\t\t\t},\n\t\t],\n\t\t[\"Updating README.md\", updateReadme],\n\t\t[\"Clearing changelog\", clearChangelog],\n\t\t[\n\t\t\t\"Updating all-contributors table\",\n\t\t\tasync () => {\n\t\t\t\tawait updateAllContributorsTable(options);\n\t\t\t},\n\t\t],\n\t\t[\"Resetting Git tags\", resetGitTags],\n\t]);\n\n\tif (!options.excludeContributors) {\n\t\tawait withSpinner(\"Updating existing contributor details\", async () => {\n\t\t\tawait addOwnerAsAllContributor(options.owner);\n\t\t});\n\t}\n\n\tif (github) {\n\t\tawait withSpinner(\"Initializing GitHub repository\", async () => {\n\t\t\tawait initializeGitHubRepository(github.octokit, options);\n\t\t});\n\t}\n\n\tif (!options.skipRemoval) {\n\t\tawait withSpinner(\"Removing setup scripts\", removeSetupScripts);\n\t}\n\n\tif (!options.skipUninstall) {\n\t\tawait withSpinner(\n\t\t\t\"Uninstalling initialization-only packages\",\n\t\t\tuninstallPackages,\n\t\t);\n\t}\n\n\tawait runCommands(\"Cleaning up files\", [\n\t\t\"pnpm lint --fix\",\n\t\t\"pnpm format --write\",\n\t]);\n}\n"],"mappings":"AAAA,SAAS,aAAa,oBAAoB;AAE1C,SAAS,gCAAgC;AACzC,SAAS,sBAAsB;AAC/B,SAAS,kCAAkC;AAC3C,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAE7B,eAAsB,sBAAsB;AAAA,EAC3C;AAAA,EACA;AACD,GAAqB;AACpB,QAAM,aAAa,4BAA4B;AAAA,IAC9C;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,iBAAiB,OAAO;AAAA,MAC/B;AAAA,IACD;AAAA,IACA,CAAC,sBAAsB,YAAY;AAAA,IACnC,CAAC,sBAAsB,cAAc;AAAA,IACrC;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,2BAA2B,OAAO;AAAA,MACzC;AAAA,IACD;AAAA,IACA,CAAC,sBAAsB,YAAY;AAAA,EACpC,CAAC;AAED,MAAI,CAAC,QAAQ,qBAAqB;AACjC,UAAM,YAAY,yCAAyC,YAAY;AACtE,YAAM,yBAAyB,QAAQ,KAAK;AAAA,IAC7C,CAAC;AAAA,EACF;AAEA,MAAI,QAAQ;AACX,UAAM,YAAY,kCAAkC,YAAY;AAC/D,YAAM,2BAA2B,OAAO,SAAS,OAAO;AAAA,IACzD,CAAC;AAAA,EACF;AAEA,MAAI,CAAC,QAAQ,aAAa;AACzB,UAAM,YAAY,0BAA0B,kBAAkB;AAAA,EAC/D;AAEA,MAAI,CAAC,QAAQ,eAAe;AAC3B,UAAM;AAAA,MACL;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,QAAM,YAAY,qBAAqB;AAAA,IACtC;AAAA,IACA;AAAA,EACD,CAAC;AACF;","names":[]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import 'octokit';
|
|
1
|
+
import { GitHubAndOptions } from '../shared/options/readOptions.js';
|
|
3
2
|
import '../shared/types.js';
|
|
3
|
+
import '../shared/options/getGitHub.js';
|
|
4
|
+
import 'octokit';
|
|
4
5
|
|
|
5
|
-
declare function migrateWithOptions({
|
|
6
|
+
declare function migrateWithOptions({ github, options, }: GitHubAndOptions): Promise<void>;
|
|
6
7
|
|
|
7
8
|
export { migrateWithOptions };
|
|
@@ -9,7 +9,7 @@ import { updateLocalFiles } from "../steps/updateLocalFiles.js";
|
|
|
9
9
|
import { writeReadme } from "../steps/writeReadme.js";
|
|
10
10
|
import { writeStructure } from "../steps/writing/writeStructure.js";
|
|
11
11
|
async function migrateWithOptions({
|
|
12
|
-
|
|
12
|
+
github,
|
|
13
13
|
options
|
|
14
14
|
}) {
|
|
15
15
|
await withSpinners("Migrating repository structure", [
|
|
@@ -39,15 +39,15 @@ async function migrateWithOptions({
|
|
|
39
39
|
}
|
|
40
40
|
]
|
|
41
41
|
]);
|
|
42
|
-
if (
|
|
42
|
+
if (github) {
|
|
43
43
|
await withSpinner("Initializing GitHub repository", async () => {
|
|
44
|
-
await initializeGitHubRepository(octokit, options);
|
|
44
|
+
await initializeGitHubRepository(github.octokit, options);
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
if (!options.excludeContributors) {
|
|
48
48
|
await withSpinner(
|
|
49
49
|
"Detecting existing contributors",
|
|
50
|
-
async () => detectExistingContributors(options)
|
|
50
|
+
async () => detectExistingContributors(github?.auth, options)
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
if (!options.skipInstall) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/migrate/migrateWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/migrate/migrateWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { GitHubAndOptions } from \"../shared/options/readOptions.js\";\nimport { clearUnnecessaryFiles } from \"../steps/clearUnnecessaryFiles.js\";\nimport { detectExistingContributors } from \"../steps/detectExistingContributors.js\";\nimport { finalizeDependencies } from \"../steps/finalizeDependencies.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { runCommands } from \"../steps/runCommands.js\";\nimport { updateAllContributorsTable } from \"../steps/updateAllContributorsTable.js\";\nimport { updateLocalFiles } from \"../steps/updateLocalFiles.js\";\nimport { writeReadme } from \"../steps/writeReadme.js\";\nimport { writeStructure } from \"../steps/writing/writeStructure.js\";\n\nexport async function migrateWithOptions({\n\tgithub,\n\toptions,\n}: GitHubAndOptions) {\n\tawait withSpinners(\"Migrating repository structure\", [\n\t\t[\"Clearing unnecessary files\", clearUnnecessaryFiles],\n\t\t[\n\t\t\t\"Writing structure\",\n\t\t\tasync () => {\n\t\t\t\tawait writeStructure(options);\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\t\"Writing README.md\",\n\t\t\tasync () => {\n\t\t\t\tawait writeReadme(options);\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\t\"Updating local files\",\n\t\t\tasync () => {\n\t\t\t\tawait updateLocalFiles(options);\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\t\"Updating all-contributors table\",\n\t\t\tasync () => {\n\t\t\t\tawait updateAllContributorsTable(options);\n\t\t\t},\n\t\t],\n\t]);\n\n\tif (github) {\n\t\tawait withSpinner(\"Initializing GitHub repository\", async () => {\n\t\t\tawait initializeGitHubRepository(github.octokit, options);\n\t\t});\n\t}\n\n\tif (!options.excludeContributors) {\n\t\tawait withSpinner(\"Detecting existing contributors\", async () =>\n\t\t\tdetectExistingContributors(github?.auth, options),\n\t\t);\n\t}\n\n\tif (!options.skipInstall) {\n\t\tawait withSpinner(\"Installing packages\", async () =>\n\t\t\tfinalizeDependencies(options),\n\t\t);\n\t}\n\n\tawait runCommands(\"Cleaning up files\", [\n\t\t\"pnpm lint --fix\",\n\t\t\"pnpm format --write\",\n\t]);\n}\n"],"mappings":"AAAA,SAAS,aAAa,oBAAoB;AAE1C,SAAS,6BAA6B;AACtC,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AACrC,SAAS,kCAAkC;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,kCAAkC;AAC3C,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAE/B,eAAsB,mBAAmB;AAAA,EACxC;AAAA,EACA;AACD,GAAqB;AACpB,QAAM,aAAa,kCAAkC;AAAA,IACpD,CAAC,8BAA8B,qBAAqB;AAAA,IACpD;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,eAAe,OAAO;AAAA,MAC7B;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,YAAY,OAAO;AAAA,MAC1B;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,iBAAiB,OAAO;AAAA,MAC/B;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,2BAA2B,OAAO;AAAA,MACzC;AAAA,IACD;AAAA,EACD,CAAC;AAED,MAAI,QAAQ;AACX,UAAM,YAAY,kCAAkC,YAAY;AAC/D,YAAM,2BAA2B,OAAO,SAAS,OAAO;AAAA,IACzD,CAAC;AAAA,EACF;AAEA,MAAI,CAAC,QAAQ,qBAAqB;AACjC,UAAM;AAAA,MAAY;AAAA,MAAmC,YACpD,2BAA2B,QAAQ,MAAM,OAAO;AAAA,IACjD;AAAA,EACD;AAEA,MAAI,CAAC,QAAQ,aAAa;AACzB,UAAM;AAAA,MAAY;AAAA,MAAuB,YACxC,qBAAqB,OAAO;AAAA,IAC7B;AAAA,EACD;AAEA,QAAM,YAAY,qBAAqB;AAAA,IACtC;AAAA,IACA;AAAA,EACD,CAAC;AACF;","names":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Octokit } from 'octokit';
|
|
2
1
|
import { Options } from '../types.js';
|
|
2
|
+
import { GitHub } from './getGitHub.js';
|
|
3
|
+
import 'octokit';
|
|
3
4
|
|
|
4
5
|
type EnsureRepositoryExistsOptions = Pick<Options, "createRepository" | "owner" | "repository">;
|
|
5
6
|
interface RepositoryExistsResult {
|
|
6
|
-
|
|
7
|
+
github: GitHub | undefined;
|
|
7
8
|
repository: string;
|
|
8
9
|
}
|
|
9
|
-
declare function ensureRepositoryExists(
|
|
10
|
+
declare function ensureRepositoryExists(github: GitHub | undefined, options: EnsureRepositoryExistsOptions): Promise<Partial<RepositoryExistsResult>>;
|
|
10
11
|
|
|
11
12
|
export { EnsureRepositoryExistsOptions, RepositoryExistsResult, ensureRepositoryExists };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as prompts from "@clack/prompts";
|
|
2
2
|
import { doesRepositoryExist } from "../doesRepositoryExist.js";
|
|
3
3
|
import { filterPromptCancel } from "../prompts.js";
|
|
4
|
-
async function ensureRepositoryExists(
|
|
4
|
+
async function ensureRepositoryExists(github, options) {
|
|
5
5
|
let { createRepository, repository } = options;
|
|
6
|
-
while (
|
|
7
|
-
if (await doesRepositoryExist(octokit, options)) {
|
|
8
|
-
return {
|
|
6
|
+
while (github) {
|
|
7
|
+
if (await doesRepositoryExist(github.octokit, options)) {
|
|
8
|
+
return { github, repository };
|
|
9
9
|
}
|
|
10
10
|
const selection = createRepository ? "create" : filterPromptCancel(
|
|
11
11
|
await prompts.select({
|
|
@@ -26,16 +26,17 @@ async function ensureRepositoryExists(octokit, options) {
|
|
|
26
26
|
);
|
|
27
27
|
createRepository = false;
|
|
28
28
|
switch (selection) {
|
|
29
|
+
case void 0:
|
|
29
30
|
case "bail":
|
|
30
31
|
return {};
|
|
31
32
|
case "create":
|
|
32
|
-
await octokit.rest.repos.createUsingTemplate({
|
|
33
|
+
await github.octokit.rest.repos.createUsingTemplate({
|
|
33
34
|
name: repository,
|
|
34
35
|
owner: options.owner,
|
|
35
36
|
template_owner: "JoshuaKGoldberg",
|
|
36
37
|
template_repo: "create-typescript-app"
|
|
37
38
|
});
|
|
38
|
-
return {
|
|
39
|
+
return { github, repository };
|
|
39
40
|
case "different":
|
|
40
41
|
const newRepository = filterPromptCancel(
|
|
41
42
|
await prompts.text({
|
|
@@ -48,11 +49,11 @@ async function ensureRepositoryExists(octokit, options) {
|
|
|
48
49
|
repository = newRepository;
|
|
49
50
|
break;
|
|
50
51
|
case "local":
|
|
51
|
-
|
|
52
|
+
github = void 0;
|
|
52
53
|
break;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
|
-
return {
|
|
56
|
+
return { github, repository };
|
|
56
57
|
}
|
|
57
58
|
export {
|
|
58
59
|
ensureRepositoryExists
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/options/ensureRepositoryExists.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/options/ensureRepositoryExists.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\n\nimport { doesRepositoryExist } from \"../doesRepositoryExist.js\";\nimport { filterPromptCancel } from \"../prompts.js\";\nimport { Options } from \"../types.js\";\nimport { GitHub } from \"./getGitHub.js\";\n\nexport type EnsureRepositoryExistsOptions = Pick<\n\tOptions,\n\t\"createRepository\" | \"owner\" | \"repository\"\n>;\n\nexport interface RepositoryExistsResult {\n\tgithub: GitHub | undefined;\n\trepository: string;\n}\n\nexport async function ensureRepositoryExists(\n\tgithub: GitHub | undefined,\n\toptions: EnsureRepositoryExistsOptions,\n): Promise<Partial<RepositoryExistsResult>> {\n\t// We'll only respect input options once before prompting for them\n\tlet { createRepository, repository } = options;\n\n\t// We'll continuously pester the user for a repository\n\t// until they bail, create a new one, or it exists.\n\twhile (github) {\n\t\tif (await doesRepositoryExist(github.octokit, options)) {\n\t\t\treturn { github, repository };\n\t\t}\n\n\t\tconst selection = createRepository\n\t\t\t? \"create\"\n\t\t\t: filterPromptCancel(\n\t\t\t\t\t(await prompts.select({\n\t\t\t\t\t\tmessage: `Repository ${options.repository} doesn't seem to exist under ${options.owner}. What would you like to do?`,\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{ label: \"Create a new repository\", value: \"create\" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: \"Switch to a different repository name\",\n\t\t\t\t\t\t\t\tvalue: \"different\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: \"Keep changes local\",\n\t\t\t\t\t\t\t\tvalue: \"local\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ label: \"Bail out and maybe try again later\", value: \"bail\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t})) as \"bail\" | \"create\" | \"different\" | \"local\",\n\t\t\t );\n\n\t\tcreateRepository = false;\n\n\t\tswitch (selection) {\n\t\t\tcase undefined:\n\t\t\tcase \"bail\":\n\t\t\t\treturn {};\n\n\t\t\tcase \"create\":\n\t\t\t\tawait github.octokit.rest.repos.createUsingTemplate({\n\t\t\t\t\tname: repository,\n\t\t\t\t\towner: options.owner,\n\t\t\t\t\ttemplate_owner: \"JoshuaKGoldberg\",\n\t\t\t\t\ttemplate_repo: \"create-typescript-app\",\n\t\t\t\t});\n\t\t\t\treturn { github: github, repository };\n\n\t\t\tcase \"different\":\n\t\t\t\tconst newRepository = filterPromptCancel(\n\t\t\t\t\tawait prompts.text({\n\t\t\t\t\t\tmessage: `What would you like to call the repository?`,\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tif (!newRepository) {\n\t\t\t\t\treturn {};\n\t\t\t\t}\n\n\t\t\t\trepository = newRepository;\n\t\t\t\tbreak;\n\n\t\t\tcase \"local\":\n\t\t\t\tgithub = undefined;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn { github: github, repository };\n}\n"],"mappings":"AAAA,YAAY,aAAa;AAEzB,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AAcnC,eAAsB,uBACrB,QACA,SAC2C;AAE3C,MAAI,EAAE,kBAAkB,WAAW,IAAI;AAIvC,SAAO,QAAQ;AACd,QAAI,MAAM,oBAAoB,OAAO,SAAS,OAAO,GAAG;AACvD,aAAO,EAAE,QAAQ,WAAW;AAAA,IAC7B;AAEA,UAAM,YAAY,mBACf,WACA;AAAA,MACC,MAAM,QAAQ,OAAO;AAAA,QACrB,SAAS,cAAc,QAAQ,UAAU,gCAAgC,QAAQ,KAAK;AAAA,QACtF,SAAS;AAAA,UACR,EAAE,OAAO,2BAA2B,OAAO,SAAS;AAAA,UACpD;AAAA,YACC,OAAO;AAAA,YACP,OAAO;AAAA,UACR;AAAA,UACA;AAAA,YACC,OAAO;AAAA,YACP,OAAO;AAAA,UACR;AAAA,UACA,EAAE,OAAO,sCAAsC,OAAO,OAAO;AAAA,QAC9D;AAAA,MACD,CAAC;AAAA,IACD;AAEH,uBAAmB;AAEnB,YAAQ,WAAW;AAAA,MAClB,KAAK;AAAA,MACL,KAAK;AACJ,eAAO,CAAC;AAAA,MAET,KAAK;AACJ,cAAM,OAAO,QAAQ,KAAK,MAAM,oBAAoB;AAAA,UACnD,MAAM;AAAA,UACN,OAAO,QAAQ;AAAA,UACf,gBAAgB;AAAA,UAChB,eAAe;AAAA,QAChB,CAAC;AACD,eAAO,EAAE,QAAgB,WAAW;AAAA,MAErC,KAAK;AACJ,cAAM,gBAAgB;AAAA,UACrB,MAAM,QAAQ,KAAK;AAAA,YAClB,SAAS;AAAA,UACV,CAAC;AAAA,QACF;AAEA,YAAI,CAAC,eAAe;AACnB,iBAAO,CAAC;AAAA,QACT;AAEA,qBAAa;AACb;AAAA,MAED,KAAK;AACJ,iBAAS;AACT;AAAA,IACF;AAAA,EACD;AAEA,SAAO,EAAE,QAAgB,WAAW;AACrC;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $ } from "execa";
|
|
2
2
|
import { Octokit } from "octokit";
|
|
3
|
-
async function
|
|
3
|
+
async function getGitHub() {
|
|
4
4
|
try {
|
|
5
5
|
await $`gh auth status`;
|
|
6
6
|
} catch (error) {
|
|
@@ -9,9 +9,10 @@ async function getOctokit() {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
const auth = (await $`gh auth token`).stdout.trim();
|
|
12
|
-
|
|
12
|
+
const octokit = new Octokit({ auth });
|
|
13
|
+
return { auth, octokit };
|
|
13
14
|
}
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
+
getGitHub
|
|
16
17
|
};
|
|
17
|
-
//# sourceMappingURL=
|
|
18
|
+
//# sourceMappingURL=getGitHub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/options/getGitHub.ts"],"sourcesContent":["import { $ } from \"execa\";\nimport { Octokit } from \"octokit\";\n\nexport interface GitHub {\n\tauth: string;\n\toctokit: Octokit;\n}\n\nexport async function getGitHub(): Promise<GitHub | undefined> {\n\ttry {\n\t\tawait $`gh auth status`;\n\t} catch (error) {\n\t\tthrow new Error(\"GitHub authentication failed.\", {\n\t\t\tcause: (error as Error).message,\n\t\t});\n\t}\n\n\tconst auth = (await $`gh auth token`).stdout.trim();\n\tconst octokit = new Octokit({ auth });\n\n\treturn { auth, octokit };\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB,SAAS,eAAe;AAOxB,eAAsB,YAAyC;AAC9D,MAAI;AACH,UAAM;AAAA,EACP,SAAS,OAAO;AACf,UAAM,IAAI,MAAM,iCAAiC;AAAA,MAChD,OAAQ,MAAgB;AAAA,IACzB,CAAC;AAAA,EACF;AAEA,QAAM,QAAQ,MAAM,kBAAkB,OAAO,KAAK;AAClD,QAAM,UAAU,IAAI,QAAQ,EAAE,KAAK,CAAC;AAEpC,SAAO,EAAE,MAAM,QAAQ;AACxB;","names":[]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare function getPrefillOrPromptedOption(existingValue: string | undefined, message: string,
|
|
1
|
+
declare function getPrefillOrPromptedOption(existingValue: string | undefined, message: string, getPlaceholder?: () => Promise<string | undefined>): Promise<string | undefined>;
|
|
2
2
|
|
|
3
3
|
export { getPrefillOrPromptedOption };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as prompts from "@clack/prompts";
|
|
2
2
|
import { filterPromptCancel } from "../prompts.js";
|
|
3
|
-
async function getPrefillOrPromptedOption(existingValue, message,
|
|
3
|
+
async function getPrefillOrPromptedOption(existingValue, message, getPlaceholder) {
|
|
4
4
|
if (existingValue) {
|
|
5
5
|
return existingValue;
|
|
6
6
|
}
|
|
7
7
|
const value = filterPromptCancel(
|
|
8
8
|
await prompts.text({
|
|
9
9
|
message,
|
|
10
|
-
placeholder,
|
|
10
|
+
placeholder: await getPlaceholder?.(),
|
|
11
11
|
validate: (val) => {
|
|
12
12
|
if (val.length === 0) {
|
|
13
13
|
return "Please enter a value.";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/options/getPrefillOrPromptedOption.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\n\nimport { filterPromptCancel } from \"../prompts.js\";\n\nexport async function getPrefillOrPromptedOption(\n\texistingValue: string | undefined,\n\tmessage: string,\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/options/getPrefillOrPromptedOption.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\n\nimport { filterPromptCancel } from \"../prompts.js\";\n\nexport async function getPrefillOrPromptedOption(\n\texistingValue: string | undefined,\n\tmessage: string,\n\tgetPlaceholder?: () => Promise<string | undefined>,\n) {\n\tif (existingValue) {\n\t\treturn existingValue;\n\t}\n\n\tconst value = filterPromptCancel(\n\t\tawait prompts.text({\n\t\t\tmessage,\n\t\t\tplaceholder: await getPlaceholder?.(),\n\t\t\tvalidate: (val) => {\n\t\t\t\tif (val.length === 0) {\n\t\t\t\t\treturn \"Please enter a value.\";\n\t\t\t\t}\n\t\t\t},\n\t\t}),\n\t);\n\n\treturn value;\n}\n"],"mappings":"AAAA,YAAY,aAAa;AAEzB,SAAS,0BAA0B;AAEnC,eAAsB,2BACrB,eACA,SACA,gBACC;AACD,MAAI,eAAe;AAClB,WAAO;AAAA,EACR;AAEA,QAAM,QAAQ;AAAA,IACb,MAAM,QAAQ,KAAK;AAAA,MAClB;AAAA,MACA,aAAa,MAAM,iBAAiB;AAAA,MACpC,UAAU,CAAC,QAAQ;AAClB,YAAI,IAAI,WAAW,GAAG;AACrB,iBAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF;AAEA,SAAO;AACR;","names":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
declare function getGitAndNpmDefaults():
|
|
2
|
-
author:
|
|
3
|
-
description: string | undefined
|
|
4
|
-
email: string | undefined
|
|
5
|
-
funding: string | undefined
|
|
6
|
-
owner: string | undefined
|
|
7
|
-
repository: string | undefined
|
|
8
|
-
title: string | undefined
|
|
9
|
-
}
|
|
1
|
+
declare function getGitAndNpmDefaults(): {
|
|
2
|
+
author: () => Promise<string>;
|
|
3
|
+
description: () => Promise<string | undefined>;
|
|
4
|
+
email: () => Promise<string | undefined>;
|
|
5
|
+
funding: () => Promise<string | undefined>;
|
|
6
|
+
owner: () => Promise<string | undefined>;
|
|
7
|
+
repository: () => Promise<string | undefined>;
|
|
8
|
+
title: () => Promise<string | undefined>;
|
|
9
|
+
};
|
|
10
10
|
|
|
11
11
|
export { getGitAndNpmDefaults };
|
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
import { $ } from "execa";
|
|
2
2
|
import gitRemoteOriginUrl from "git-remote-origin-url";
|
|
3
3
|
import gitUrlParse from "git-url-parse";
|
|
4
|
+
import lazyValue from "lazy-value";
|
|
4
5
|
import fs from "node:fs/promises";
|
|
5
6
|
import npmUser from "npm-user";
|
|
6
7
|
import { readPackageData } from "../../packages.js";
|
|
7
8
|
import { tryCatchAsync } from "../../tryCatchAsync.js";
|
|
9
|
+
import { tryCatchLazyValueAsync } from "../../tryCatchLazyValueAsync.js";
|
|
8
10
|
import { parsePackageAuthor } from "./parsePackageAuthor.js";
|
|
9
11
|
import { readTitleFromReadme } from "./readTitleFromReadme.js";
|
|
10
|
-
|
|
11
|
-
const gitDefaults =
|
|
12
|
+
function getGitAndNpmDefaults() {
|
|
13
|
+
const gitDefaults = tryCatchLazyValueAsync(
|
|
12
14
|
async () => gitUrlParse(await gitRemoteOriginUrl())
|
|
13
15
|
);
|
|
14
|
-
const npmDefaults =
|
|
16
|
+
const npmDefaults = tryCatchLazyValueAsync(
|
|
15
17
|
async () => await npmUser((await $`npm whoami`).stdout)
|
|
16
18
|
);
|
|
17
|
-
const packageData =
|
|
18
|
-
const packageAuthor =
|
|
19
|
+
const packageData = lazyValue(readPackageData);
|
|
20
|
+
const packageAuthor = lazyValue(
|
|
21
|
+
async () => parsePackageAuthor(await packageData())
|
|
22
|
+
);
|
|
19
23
|
return {
|
|
20
|
-
author: packageAuthor.author ?? npmDefaults
|
|
21
|
-
description: packageData.description,
|
|
22
|
-
email: npmDefaults?.email ?? packageAuthor.email ?? await tryCatchAsync(
|
|
24
|
+
author: async () => (await packageAuthor()).author ?? npmDefaults.name,
|
|
25
|
+
description: async () => (await packageData()).description,
|
|
26
|
+
email: async () => (await npmDefaults())?.email ?? (await packageAuthor()).email ?? await tryCatchAsync(
|
|
23
27
|
async () => (await $`git config --get user.email`).stdout
|
|
24
28
|
),
|
|
25
|
-
funding: await tryCatchAsync(
|
|
29
|
+
funding: async () => await tryCatchAsync(
|
|
26
30
|
async () => (await fs.readFile(".github/FUNDING.yml")).toString().split(":")[1]?.trim()
|
|
27
31
|
),
|
|
28
|
-
owner: gitDefaults?.organization ?? packageAuthor.author,
|
|
29
|
-
repository: gitDefaults?.name ?? packageData.name,
|
|
30
|
-
title: await readTitleFromReadme()
|
|
32
|
+
owner: async () => (await gitDefaults())?.organization ?? (await packageAuthor()).author,
|
|
33
|
+
repository: async () => (await gitDefaults())?.name ?? (await packageData()).name,
|
|
34
|
+
title: async () => await readTitleFromReadme()
|
|
31
35
|
};
|
|
32
36
|
}
|
|
33
37
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/shared/options/readGitAndNpmDefaults/index.ts"],"sourcesContent":["import { $ } from \"execa\";\nimport gitRemoteOriginUrl from \"git-remote-origin-url\";\nimport gitUrlParse from \"git-url-parse\";\nimport fs from \"node:fs/promises\";\nimport npmUser from \"npm-user\";\n\nimport { readPackageData } from \"../../packages.js\";\nimport { tryCatchAsync } from \"../../tryCatchAsync.js\";\nimport { parsePackageAuthor } from \"./parsePackageAuthor.js\";\nimport { readTitleFromReadme } from \"./readTitleFromReadme.js\";\n\nexport
|
|
1
|
+
{"version":3,"sources":["../../../../src/shared/options/readGitAndNpmDefaults/index.ts"],"sourcesContent":["import { $ } from \"execa\";\nimport gitRemoteOriginUrl from \"git-remote-origin-url\";\nimport gitUrlParse from \"git-url-parse\";\nimport lazyValue from \"lazy-value\";\nimport fs from \"node:fs/promises\";\nimport npmUser from \"npm-user\";\n\nimport { readPackageData } from \"../../packages.js\";\nimport { tryCatchAsync } from \"../../tryCatchAsync.js\";\nimport { tryCatchLazyValueAsync } from \"../../tryCatchLazyValueAsync.js\";\nimport { parsePackageAuthor } from \"./parsePackageAuthor.js\";\nimport { readTitleFromReadme } from \"./readTitleFromReadme.js\";\n\nexport function getGitAndNpmDefaults() {\n\tconst gitDefaults = tryCatchLazyValueAsync(async () =>\n\t\tgitUrlParse(await gitRemoteOriginUrl()),\n\t);\n\n\tconst npmDefaults = tryCatchLazyValueAsync(\n\t\tasync () => await npmUser((await $`npm whoami`).stdout),\n\t);\n\n\tconst packageData = lazyValue(readPackageData);\n\tconst packageAuthor = lazyValue(async () =>\n\t\tparsePackageAuthor(await packageData()),\n\t);\n\n\treturn {\n\t\tauthor: async () => (await packageAuthor()).author ?? npmDefaults.name,\n\t\tdescription: async () => (await packageData()).description,\n\t\temail: async () =>\n\t\t\t(await npmDefaults())?.email ??\n\t\t\t(await packageAuthor()).email ??\n\t\t\t(await tryCatchAsync(\n\t\t\t\tasync () => (await $`git config --get user.email`).stdout,\n\t\t\t)),\n\t\tfunding: async () =>\n\t\t\tawait tryCatchAsync(\n\t\t\t\tasync () =>\n\t\t\t\t\t(await fs.readFile(\".github/FUNDING.yml\"))\n\t\t\t\t\t\t.toString()\n\t\t\t\t\t\t.split(\":\")[1]\n\t\t\t\t\t\t?.trim(),\n\t\t\t),\n\t\towner: async () =>\n\t\t\t(await gitDefaults())?.organization ?? (await packageAuthor()).author,\n\t\trepository: async () =>\n\t\t\t(await gitDefaults())?.name ?? (await packageData()).name,\n\t\ttitle: async () => await readTitleFromReadme(),\n\t};\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB,OAAO,wBAAwB;AAC/B,OAAO,iBAAiB;AACxB,OAAO,eAAe;AACtB,OAAO,QAAQ;AACf,OAAO,aAAa;AAEpB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AAE7B,SAAS,uBAAuB;AACtC,QAAM,cAAc;AAAA,IAAuB,YAC1C,YAAY,MAAM,mBAAmB,CAAC;AAAA,EACvC;AAEA,QAAM,cAAc;AAAA,IACnB,YAAY,MAAM,SAAS,MAAM,eAAe,MAAM;AAAA,EACvD;AAEA,QAAM,cAAc,UAAU,eAAe;AAC7C,QAAM,gBAAgB;AAAA,IAAU,YAC/B,mBAAmB,MAAM,YAAY,CAAC;AAAA,EACvC;AAEA,SAAO;AAAA,IACN,QAAQ,aAAa,MAAM,cAAc,GAAG,UAAU,YAAY;AAAA,IAClE,aAAa,aAAa,MAAM,YAAY,GAAG;AAAA,IAC/C,OAAO,aACL,MAAM,YAAY,IAAI,UACtB,MAAM,cAAc,GAAG,SACvB,MAAM;AAAA,MACN,aAAa,MAAM,gCAAgC;AAAA,IACpD;AAAA,IACD,SAAS,YACR,MAAM;AAAA,MACL,aACE,MAAM,GAAG,SAAS,qBAAqB,GACtC,SAAS,EACT,MAAM,GAAG,EAAE,CAAC,GACX,KAAK;AAAA,IACV;AAAA,IACD,OAAO,aACL,MAAM,YAAY,IAAI,iBAAiB,MAAM,cAAc,GAAG;AAAA,IAChE,YAAY,aACV,MAAM,YAAY,IAAI,SAAS,MAAM,YAAY,GAAG;AAAA,IACtD,OAAO,YAAY,MAAM,oBAAoB;AAAA,EAC9C;AACD;","names":[]}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { Octokit } from 'octokit';
|
|
2
1
|
import { Options } from '../types.js';
|
|
2
|
+
import { GitHub } from './getGitHub.js';
|
|
3
|
+
import 'octokit';
|
|
3
4
|
|
|
4
|
-
interface
|
|
5
|
-
|
|
5
|
+
interface GitHubAndOptions {
|
|
6
|
+
github: GitHub | undefined;
|
|
6
7
|
options: Options;
|
|
7
8
|
}
|
|
8
9
|
interface OptionsParseCancelled {
|
|
9
10
|
cancelled: true;
|
|
10
11
|
options: Partial<Options>;
|
|
11
12
|
}
|
|
12
|
-
interface OptionsParseSuccess extends
|
|
13
|
+
interface OptionsParseSuccess extends GitHubAndOptions {
|
|
13
14
|
cancelled: false;
|
|
14
15
|
}
|
|
15
16
|
type OptionsParseResult = OptionsParseCancelled | OptionsParseSuccess;
|
|
16
17
|
declare function readOptions(args: string[]): Promise<OptionsParseResult>;
|
|
17
18
|
|
|
18
|
-
export {
|
|
19
|
+
export { GitHubAndOptions, OptionsParseCancelled, OptionsParseResult, OptionsParseSuccess, readOptions };
|
|
@@ -4,11 +4,11 @@ import { withSpinner } from "../cli/spinners.js";
|
|
|
4
4
|
import { allArgOptions } from "./args.js";
|
|
5
5
|
import { augmentOptionsWithExcludes } from "./augmentOptionsWithExcludes.js";
|
|
6
6
|
import { ensureRepositoryExists } from "./ensureRepositoryExists.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getGitHub } from "./getGitHub.js";
|
|
8
8
|
import { getPrefillOrPromptedOption } from "./getPrefillOrPromptedOption.js";
|
|
9
9
|
import { getGitAndNpmDefaults } from "./readGitAndNpmDefaults/index.js";
|
|
10
10
|
async function readOptions(args) {
|
|
11
|
-
const defaults =
|
|
11
|
+
const defaults = getGitAndNpmDefaults();
|
|
12
12
|
const { values } = parseArgs({
|
|
13
13
|
args,
|
|
14
14
|
options: allArgOptions,
|
|
@@ -66,8 +66,8 @@ async function readOptions(args) {
|
|
|
66
66
|
options
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
const {
|
|
70
|
-
values["skip-github-api"] ? void 0 : await withSpinner("Checking GitHub authentication",
|
|
69
|
+
const { github, repository } = await ensureRepositoryExists(
|
|
70
|
+
values["skip-github-api"] ? void 0 : await withSpinner("Checking GitHub authentication", getGitHub),
|
|
71
71
|
{
|
|
72
72
|
createRepository: options.createRepository,
|
|
73
73
|
owner: options.owner,
|
|
@@ -80,7 +80,7 @@ async function readOptions(args) {
|
|
|
80
80
|
options.description ??= await getPrefillOrPromptedOption(
|
|
81
81
|
options.description,
|
|
82
82
|
"How would you describe the new package?",
|
|
83
|
-
defaults.description ?? "A very lovely package. Hooray!"
|
|
83
|
+
async () => await defaults.description() ?? "A very lovely package. Hooray!"
|
|
84
84
|
);
|
|
85
85
|
if (!options.description) {
|
|
86
86
|
return { cancelled: true, options };
|
|
@@ -88,16 +88,16 @@ async function readOptions(args) {
|
|
|
88
88
|
options.title ??= await getPrefillOrPromptedOption(
|
|
89
89
|
options.title,
|
|
90
90
|
"What will the Title Case title of the repository be?",
|
|
91
|
-
defaults.title ?? titleCase(repository).replaceAll("-", " ")
|
|
91
|
+
async () => await defaults.title() ?? titleCase(repository).replaceAll("-", " ")
|
|
92
92
|
);
|
|
93
93
|
if (!options.title) {
|
|
94
94
|
return { cancelled: true, options };
|
|
95
95
|
}
|
|
96
96
|
const augmentedOptions = await augmentOptionsWithExcludes({
|
|
97
97
|
...options,
|
|
98
|
-
author: options.author ?? defaults.owner,
|
|
99
|
-
email: options.email ?? defaults.email,
|
|
100
|
-
funding: options.funding ?? defaults.funding,
|
|
98
|
+
author: options.author ?? await defaults.owner(),
|
|
99
|
+
email: options.email ?? await defaults.email(),
|
|
100
|
+
funding: options.funding ?? await defaults.funding(),
|
|
101
101
|
repository
|
|
102
102
|
});
|
|
103
103
|
if (!augmentedOptions) {
|
|
@@ -108,7 +108,7 @@ async function readOptions(args) {
|
|
|
108
108
|
}
|
|
109
109
|
return {
|
|
110
110
|
cancelled: false,
|
|
111
|
-
|
|
111
|
+
github,
|
|
112
112
|
options: augmentedOptions
|
|
113
113
|
};
|
|
114
114
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/options/readOptions.ts"],"sourcesContent":["import { parseArgs } from \"node:util\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/options/readOptions.ts"],"sourcesContent":["import { parseArgs } from \"node:util\";\nimport { titleCase } from \"title-case\";\n\nimport { withSpinner } from \"../cli/spinners.js\";\nimport { InputBase, Options } from \"../types.js\";\nimport { allArgOptions } from \"./args.js\";\nimport { augmentOptionsWithExcludes } from \"./augmentOptionsWithExcludes.js\";\nimport { ensureRepositoryExists } from \"./ensureRepositoryExists.js\";\nimport { GitHub, getGitHub } from \"./getGitHub.js\";\nimport { getPrefillOrPromptedOption } from \"./getPrefillOrPromptedOption.js\";\nimport { getGitAndNpmDefaults } from \"./readGitAndNpmDefaults/index.js\";\n\nexport interface GitHubAndOptions {\n\tgithub: GitHub | undefined;\n\toptions: Options;\n}\n\nexport interface OptionsParseCancelled {\n\tcancelled: true;\n\toptions: Partial<Options>;\n}\n\nexport interface OptionsParseSuccess extends GitHubAndOptions {\n\tcancelled: false;\n}\n\nexport type OptionsParseResult = OptionsParseCancelled | OptionsParseSuccess;\n\nexport async function readOptions(args: string[]): Promise<OptionsParseResult> {\n\tconst defaults = getGitAndNpmDefaults();\n\tconst { values } = parseArgs({\n\t\targs,\n\t\toptions: allArgOptions,\n\t\tstrict: false,\n\t\ttokens: true,\n\t});\n\n\tconst options = {\n\t\tauthor: values.author as string | undefined,\n\t\tbase: values.base as InputBase,\n\t\tcreateRepository: values[\"create-repository\"] as boolean | undefined,\n\t\tdescription: values.description as string | undefined,\n\t\temail: values.email as string | undefined,\n\t\texcludeCompliance: values[\"exclude-compliance\"] as boolean | undefined,\n\t\texcludeContributors: values[\"exclude-contributors\"] as boolean | undefined,\n\t\texcludeLintJson: values[\"exclude-lint-json\"] as boolean | undefined,\n\t\texcludeLintKnip: values[\"exclude-lint-knip\"] as boolean | undefined,\n\t\texcludeLintMd: values[\"exclude-lint-md\"] as boolean | undefined,\n\t\texcludeLintPackageJson: values[\"exclude-lint-package-json\"] as\n\t\t\t| boolean\n\t\t\t| undefined,\n\t\texcludeLintPackages: values[\"exclude-lint-packages\"] as boolean | undefined,\n\t\texcludeLintPerfectionist: values[\"exclude-lint-perfectionist\"] as\n\t\t\t| boolean\n\t\t\t| undefined,\n\t\texcludeLintSpelling: values[\"exclude-lint-spelling\"] as boolean | undefined,\n\t\texcludeLintYml: values[\"exclude-lint-yml\"] as boolean | undefined,\n\t\texcludeReleases: values[\"exclude-releases\"] as boolean | undefined,\n\t\texcludeRenovate: values[\"exclude-renovate\"] as boolean | undefined,\n\t\texcludeTests: values[\"unit-tests\"] as boolean | undefined,\n\t\tfunding: values.funding as string | undefined,\n\t\towner: values.owner as string | undefined,\n\t\trepository: values.repository as string | undefined,\n\t\tskipGitHubApi: !!values[\"skip-github-api\"],\n\t\tskipInstall: !!values[\"skip-install\"],\n\t\tskipRemoval: !!values[\"skip-removal\"],\n\t\tskipRestore: values[\"skip-restore\"] as boolean | undefined,\n\t\tskipUninstall: !!values[\"skip-uninstall\"],\n\t\ttitle: values.title as string | undefined,\n\t};\n\n\toptions.owner ??= await getPrefillOrPromptedOption(\n\t\tvalues.owner as string | undefined,\n\t\t\"What organization or user will the repository be under?\",\n\t\tdefaults.owner,\n\t);\n\tif (!options.owner) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\toptions.repository ??= await getPrefillOrPromptedOption(\n\t\toptions.repository,\n\t\t\"What will the kebab-case name of the repository be?\",\n\t\tdefaults.repository,\n\t);\n\tif (!options.repository) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\tconst { github, repository } = await ensureRepositoryExists(\n\t\tvalues[\"skip-github-api\"]\n\t\t\t? undefined\n\t\t\t: await withSpinner(\"Checking GitHub authentication\", getGitHub),\n\t\t{\n\t\t\tcreateRepository: options.createRepository,\n\t\t\towner: options.owner,\n\t\t\trepository: options.repository,\n\t\t},\n\t);\n\tif (!repository) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\toptions.description ??= await getPrefillOrPromptedOption(\n\t\toptions.description,\n\t\t\"How would you describe the new package?\",\n\t\tasync () =>\n\t\t\t(await defaults.description()) ?? \"A very lovely package. Hooray!\",\n\t);\n\tif (!options.description) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\toptions.title ??= await getPrefillOrPromptedOption(\n\t\toptions.title,\n\t\t\"What will the Title Case title of the repository be?\",\n\t\tasync () =>\n\t\t\t(await defaults.title()) ?? titleCase(repository).replaceAll(\"-\", \" \"),\n\t);\n\tif (!options.title) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\tconst augmentedOptions = await augmentOptionsWithExcludes({\n\t\t...options,\n\t\tauthor: options.author ?? (await defaults.owner()),\n\t\temail: options.email ?? (await defaults.email()),\n\t\tfunding: options.funding ?? (await defaults.funding()),\n\t\trepository,\n\t} as Options);\n\n\tif (!augmentedOptions) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\treturn {\n\t\tcancelled: false,\n\t\tgithub,\n\t\toptions: augmentedOptions,\n\t};\n}\n"],"mappings":"AAAA,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAE1B,SAAS,mBAAmB;AAE5B,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAC3C,SAAS,8BAA8B;AACvC,SAAiB,iBAAiB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AAkBrC,eAAsB,YAAY,MAA6C;AAC9E,QAAM,WAAW,qBAAqB;AACtC,QAAM,EAAE,OAAO,IAAI,UAAU;AAAA,IAC5B;AAAA,IACA,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,EACT,CAAC;AAED,QAAM,UAAU;AAAA,IACf,QAAQ,OAAO;AAAA,IACf,MAAM,OAAO;AAAA,IACb,kBAAkB,OAAO,mBAAmB;AAAA,IAC5C,aAAa,OAAO;AAAA,IACpB,OAAO,OAAO;AAAA,IACd,mBAAmB,OAAO,oBAAoB;AAAA,IAC9C,qBAAqB,OAAO,sBAAsB;AAAA,IAClD,iBAAiB,OAAO,mBAAmB;AAAA,IAC3C,iBAAiB,OAAO,mBAAmB;AAAA,IAC3C,eAAe,OAAO,iBAAiB;AAAA,IACvC,wBAAwB,OAAO,2BAA2B;AAAA,IAG1D,qBAAqB,OAAO,uBAAuB;AAAA,IACnD,0BAA0B,OAAO,4BAA4B;AAAA,IAG7D,qBAAqB,OAAO,uBAAuB;AAAA,IACnD,gBAAgB,OAAO,kBAAkB;AAAA,IACzC,iBAAiB,OAAO,kBAAkB;AAAA,IAC1C,iBAAiB,OAAO,kBAAkB;AAAA,I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E,MAAM,SAAS,MAAM,KAAM,UAAU,UAAU,EAAE,WAAW,KAAK,GAAG;AAAA,EACvE;AACA,MAAI,CAAC,QAAQ,OAAO;AACnB,WAAO,EAAE,WAAW,MAAM,QAAQ;AAAA,EACnC;AAEA,QAAM,mBAAmB,MAAM,2BAA2B;AAAA,IACzD,GAAG;AAAA,IACH,QAAQ,QAAQ,UAAW,MAAM,SAAS,MAAM;AAAA,IAChD,OAAO,QAAQ,SAAU,MAAM,SAAS,MAAM;AAAA,IAC9C,SAAS,QAAQ,WAAY,MAAM,SAAS,QAAQ;AAAA,IACpD;AAAA,EACD,CAAY;AAEZ,MAAI,CAAC,kBAAkB;AACtB,WAAO;AAAA,MACN,WAAW;AAAA,MACX;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AAAA,IACN,WAAW;AAAA,IACX;AAAA,IACA,SAAS;AAAA,EACV;AACD;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import lazyValue from "lazy-value";
|
|
2
|
+
import { tryCatchAsync } from "./tryCatchAsync.js";
|
|
3
|
+
function tryCatchLazyValueAsync(get) {
|
|
4
|
+
return lazyValue(async () => await tryCatchAsync(get));
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
tryCatchLazyValueAsync
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=tryCatchLazyValueAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/shared/tryCatchLazyValueAsync.ts"],"sourcesContent":["import lazyValue from \"lazy-value\";\n\nimport { tryCatchAsync } from \"./tryCatchAsync.js\";\n\nexport function tryCatchLazyValueAsync<T>(get: () => Promise<T>) {\n\treturn lazyValue(async () => await tryCatchAsync(get));\n}\n"],"mappings":"AAAA,OAAO,eAAe;AAEtB,SAAS,qBAAqB;AAEvB,SAAS,uBAA0B,KAAuB;AAChE,SAAO,UAAU,YAAY,MAAM,cAAc,GAAG,CAAC;AACtD;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Options } from '../shared/types.js';
|
|
2
2
|
|
|
3
|
-
declare function detectExistingContributors(options: Pick<Options, "owner" | "repository">): Promise<void>;
|
|
3
|
+
declare function detectExistingContributors(auth: string | undefined, options: Pick<Options, "owner" | "repository">): Promise<void>;
|
|
4
4
|
|
|
5
5
|
export { detectExistingContributors };
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { getAllContributorsForRepository } from "all-contributors-for-repository";
|
|
2
2
|
import { $ } from "execa";
|
|
3
|
-
async function detectExistingContributors(options) {
|
|
3
|
+
async function detectExistingContributors(auth, options) {
|
|
4
4
|
const contributors = await getAllContributorsForRepository({
|
|
5
|
+
auth,
|
|
5
6
|
owner: options.owner,
|
|
6
7
|
repo: options.repository
|
|
7
8
|
});
|
|
8
9
|
for (const [contributor, contributions] of Object.entries(contributors)) {
|
|
9
10
|
const contributionTypes = Object.keys(contributions).join(",");
|
|
10
|
-
await
|
|
11
|
+
await $({
|
|
12
|
+
env: { PRIVATE_TOKEN: auth }
|
|
13
|
+
})`npx -y all-contributors-cli add ${contributor} ${contributionTypes}`;
|
|
11
14
|
}
|
|
12
15
|
}
|
|
13
16
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/steps/detectExistingContributors.ts"],"sourcesContent":["import { getAllContributorsForRepository } from \"all-contributors-for-repository\";\nimport { $ } from \"execa\";\n\nimport { Options } from \"../shared/types.js\";\n\nexport async function detectExistingContributors(\n\toptions: Pick<Options, \"owner\" | \"repository\">,\n) {\n\tconst contributors = await getAllContributorsForRepository({\n\t\towner: options.owner,\n\t\trepo: options.repository,\n\t});\n\n\tfor (const [contributor, contributions] of Object.entries(contributors)) {\n\t\tconst contributionTypes = Object.keys(contributions).join(\",\");\n\t\tawait
|
|
1
|
+
{"version":3,"sources":["../../src/steps/detectExistingContributors.ts"],"sourcesContent":["import { getAllContributorsForRepository } from \"all-contributors-for-repository\";\nimport { $ } from \"execa\";\n\nimport { Options } from \"../shared/types.js\";\n\nexport async function detectExistingContributors(\n\tauth: string | undefined,\n\toptions: Pick<Options, \"owner\" | \"repository\">,\n) {\n\tconst contributors = await getAllContributorsForRepository({\n\t\tauth,\n\t\towner: options.owner,\n\t\trepo: options.repository,\n\t});\n\n\tfor (const [contributor, contributions] of Object.entries(contributors)) {\n\t\tconst contributionTypes = Object.keys(contributions).join(\",\");\n\t\tawait $({\n\t\t\tenv: { PRIVATE_TOKEN: auth },\n\t\t})`npx -y all-contributors-cli add ${contributor} ${contributionTypes}`;\n\t}\n}\n"],"mappings":"AAAA,SAAS,uCAAuC;AAChD,SAAS,SAAS;AAIlB,eAAsB,2BACrB,MACA,SACC;AACD,QAAM,eAAe,MAAM,gCAAgC;AAAA,IAC1D;AAAA,IACA,OAAO,QAAQ;AAAA,IACf,MAAM,QAAQ;AAAA,EACf,CAAC;AAED,aAAW,CAAC,aAAa,aAAa,KAAK,OAAO,QAAQ,YAAY,GAAG;AACxE,UAAM,oBAAoB,OAAO,KAAK,aAAa,EAAE,KAAK,GAAG;AAC7D,UAAM,EAAE;AAAA,MACP,KAAK,EAAE,eAAe,KAAK;AAAA,IAC5B,CAAC,oCAAoC,WAAW,IAAI,iBAAiB;AAAA,EACtE;AACD;","names":[]}
|
|
@@ -22,7 +22,7 @@ async function initializeBranchProtectionSettings(octokit, { owner, repository }
|
|
|
22
22
|
{ context: "lint" },
|
|
23
23
|
{ context: "lint_knip" },
|
|
24
24
|
{ context: "lint_markdown" },
|
|
25
|
-
{ context: "
|
|
25
|
+
{ context: "lint_package_json" },
|
|
26
26
|
{ context: "lint_packages" },
|
|
27
27
|
{ context: "lint_spelling" },
|
|
28
28
|
{ context: "prettier" },
|
|
@@ -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\t{ owner, repository }: Pick<Options, \"owner\" | \"repository\">,\n) {\n\ttry {\n\t\tawait octokit.request(\n\t\t\t`PUT /repos/${owner}/${repository}/branches/main/protection`,\n\t\t\t{\n\t\t\t\tallow_deletions: false,\n\t\t\t\tallow_force_pushes: true,\n\t\t\t\tallow_fork_pushes: false,\n\t\t\t\tallow_fork_syncing: true,\n\t\t\t\tblock_creations: false,\n\t\t\t\tbranch: \"main\",\n\t\t\t\tenforce_admins: false,\n\t\t\t\towner,\n\t\t\t\trepo: repository,\n\t\t\t\trequired_conversation_resolution: true,\n\t\t\t\trequired_linear_history: false,\n\t\t\t\trequired_pull_request_reviews: null,\n\t\t\t\trequired_status_checks: {\n\t\t\t\t\tchecks: [\n\t\t\t\t\t\t{ context: \"build\" },\n\t\t\t\t\t\t{ context: \"compliance\" },\n\t\t\t\t\t\t{ context: \"lint\" },\n\t\t\t\t\t\t{ context: \"lint_knip\" },\n\t\t\t\t\t\t{ context: \"lint_markdown\" },\n\t\t\t\t\t\t{ context: \"
|
|
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\t{ owner, repository }: Pick<Options, \"owner\" | \"repository\">,\n) {\n\ttry {\n\t\tawait octokit.request(\n\t\t\t`PUT /repos/${owner}/${repository}/branches/main/protection`,\n\t\t\t{\n\t\t\t\tallow_deletions: false,\n\t\t\t\tallow_force_pushes: true,\n\t\t\t\tallow_fork_pushes: false,\n\t\t\t\tallow_fork_syncing: true,\n\t\t\t\tblock_creations: false,\n\t\t\t\tbranch: \"main\",\n\t\t\t\tenforce_admins: false,\n\t\t\t\towner,\n\t\t\t\trepo: repository,\n\t\t\t\trequired_conversation_resolution: true,\n\t\t\t\trequired_linear_history: false,\n\t\t\t\trequired_pull_request_reviews: null,\n\t\t\t\trequired_status_checks: {\n\t\t\t\t\tchecks: [\n\t\t\t\t\t\t{ context: \"build\" },\n\t\t\t\t\t\t{ context: \"compliance\" },\n\t\t\t\t\t\t{ context: \"lint\" },\n\t\t\t\t\t\t{ context: \"lint_knip\" },\n\t\t\t\t\t\t{ context: \"lint_markdown\" },\n\t\t\t\t\t\t{ context: \"lint_package_json\" },\n\t\t\t\t\t\t{ context: \"lint_packages\" },\n\t\t\t\t\t\t{ context: \"lint_spelling\" },\n\t\t\t\t\t\t{ context: \"prettier\" },\n\t\t\t\t\t\t{ context: \"test\" },\n\t\t\t\t\t],\n\t\t\t\t\tstrict: false,\n\t\t\t\t},\n\t\t\t\trestrictions: null,\n\t\t\t},\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,EAAE,OAAO,WAAW,GACnB;AACD,MAAI;AACH,UAAM,QAAQ;AAAA,MACb,cAAc,KAAK,IAAI,UAAU;AAAA,MACjC;AAAA,QACC,iBAAiB;AAAA,QACjB,oBAAoB;AAAA,QACpB,mBAAmB;AAAA,QACnB,oBAAoB;AAAA,QACpB,iBAAiB;AAAA,QACjB,QAAQ;AAAA,QACR,gBAAgB;AAAA,QAChB;AAAA,QACA,MAAM;AAAA,QACN,kCAAkC;AAAA,QAClC,yBAAyB;AAAA,QACzB,+BAA+B;AAAA,QAC/B,wBAAwB;AAAA,UACvB,QAAQ;AAAA,YACP,EAAE,SAAS,QAAQ;AAAA,YACnB,EAAE,SAAS,aAAa;AAAA,YACxB,EAAE,SAAS,OAAO;AAAA,YAClB,EAAE,SAAS,YAAY;AAAA,YACvB,EAAE,SAAS,gBAAgB;AAAA,YAC3B,EAAE,SAAS,oBAAoB;AAAA,YAC/B,EAAE,SAAS,gBAAgB;AAAA,YAC3B,EAAE,SAAS,gBAAgB;AAAA,YAC3B,EAAE,SAAS,WAAW;AAAA,YACtB,EAAE,SAAS,OAAO;AAAA,UACnB;AAAA,UACA,QAAQ;AAAA,QACT;AAAA,QACA,cAAc;AAAA,MACf;AAAA,IACD;AAAA,EACD,SAAS,OAAO;AACf,QAAK,MAAuB,WAAW,KAAK;AAC3C,aAAO;AAAA,IACR;AAEA,UAAM;AAAA,EACP;AACD;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/steps/uninstallPackages.ts"],"sourcesContent":["import { $ } from \"execa\";\n\nimport { readPackageData, removeDependencies } from \"../shared/packages.js\";\n\nexport async function uninstallPackages() {\n\tconst packageData = await readPackageData();\n\n\tawait removeDependencies(\n\t\t[\n\t\t\t\"@clack/prompts\",\n\t\t\t\"all-contributors-for-repository\",\n\t\t\t\"chalk\",\n\t\t\t\"execa\",\n\t\t\t\"git-remote-origin-url\",\n\t\t\t\"git-url-parse\",\n\t\t\t\"js-yaml\",\n\t\t\t\"npm-user\",\n\t\t\t\"octokit\",\n\t\t\t\"prettier\",\n\t\t\t\"replace-in-file\",\n\t\t\t\"title-case\",\n\t\t],\n\t\tpackageData.dependencies,\n\t);\n\n\tawait removeDependencies(\n\t\t[\n\t\t\t\"@octokit/request-error\",\n\t\t\t\"@types/git-url-parse\",\n\t\t\t\"@types/js-yaml\",\n\t\t\t\"@types/prettier\",\n\t\t\t\"all-contributors-cli\",\n\t\t\t\"c8\",\n\t\t\t\"globby\",\n\t\t\t\"tsx\",\n\t\t],\n\t\tpackageData.devDependencies,\n\t\t\"-D\",\n\t);\n\n\tawait $`pnpm add prettier -D`;\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAElB,SAAS,iBAAiB,0BAA0B;AAEpD,eAAsB,oBAAoB;AACzC,QAAM,cAAc,MAAM,gBAAgB;AAE1C,QAAM;AAAA,IACL;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,YAAY;AAAA,EACb;AAEA,QAAM;AAAA,IACL;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EACD;AAEA,QAAM;AACP;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/steps/uninstallPackages.ts"],"sourcesContent":["import { $ } from \"execa\";\n\nimport { readPackageData, removeDependencies } from \"../shared/packages.js\";\n\nexport async function uninstallPackages() {\n\tconst packageData = await readPackageData();\n\n\tawait removeDependencies(\n\t\t[\n\t\t\t\"@clack/prompts\",\n\t\t\t\"all-contributors-for-repository\",\n\t\t\t\"chalk\",\n\t\t\t\"execa\",\n\t\t\t\"git-remote-origin-url\",\n\t\t\t\"git-url-parse\",\n\t\t\t\"lazy-value\",\n\t\t\t\"js-yaml\",\n\t\t\t\"npm-user\",\n\t\t\t\"octokit\",\n\t\t\t\"prettier\",\n\t\t\t\"replace-in-file\",\n\t\t\t\"title-case\",\n\t\t],\n\t\tpackageData.dependencies,\n\t);\n\n\tawait removeDependencies(\n\t\t[\n\t\t\t\"@octokit/request-error\",\n\t\t\t\"@types/git-url-parse\",\n\t\t\t\"@types/js-yaml\",\n\t\t\t\"@types/prettier\",\n\t\t\t\"all-contributors-cli\",\n\t\t\t\"c8\",\n\t\t\t\"globby\",\n\t\t\t\"tsx\",\n\t\t],\n\t\tpackageData.devDependencies,\n\t\t\"-D\",\n\t);\n\n\tawait $`pnpm add prettier -D`;\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAElB,SAAS,iBAAiB,0BAA0B;AAEpD,eAAsB,oBAAoB;AACzC,QAAM,cAAc,MAAM,gBAAgB;AAE1C,QAAM;AAAA,IACL;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,YAAY;AAAA,EACb;AAEA,QAAM;AAAA,IACL;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EACD;AAEA,QAAM;AACP;","names":[]}
|
|
@@ -21,13 +21,17 @@ pnpm install
|
|
|
21
21
|
|
|
22
22
|
## Building
|
|
23
23
|
|
|
24
|
-
Run [
|
|
24
|
+
Run [**tsup**](https://tsup.egoist.dev) locally to build source files from \`src/\` into output files in \`lib/\`:
|
|
25
25
|
|
|
26
26
|
\`\`\`shell
|
|
27
|
-
pnpm build
|
|
27
|
+
pnpm build
|
|
28
28
|
\`\`\`
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Add \`--watch\` to run the builder in a watch mode that continuously cleans and recreates \`lib/\` as you save files:
|
|
31
|
+
|
|
32
|
+
\`\`\`shell
|
|
33
|
+
pnpm build --watch
|
|
34
|
+
\`\`\`
|
|
31
35
|
|
|
32
36
|
## Formatting
|
|
33
37
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/steps/writing/creation/dotGitHub/createDevelopment.ts"],"sourcesContent":["import { Options } from \"../../../../shared/types.js\";\n\nexport function createDevelopment(options: Options) {\n\tconst lintLines = [\n\t\t!options.excludeLintKnip &&\n\t\t\t`- \\`pnpm lint:knip\\` ([knip](https://github.com/webpro/knip)): Detects unused files, dependencies, and code exports`,\n\t\t!options.excludeLintMd &&\n\t\t\t`- \\`pnpm lint:md\\` ([Markdownlint](https://github.com/DavidAnson/markdownlint)): Checks Markdown source files`,\n\t\t!options.excludeLintPackageJson &&\n\t\t\t`- \\`pnpm lint:package-json\\` ([npm-package-json-lint](https://npmpackagejsonlint.org/)): Lints the \\`package.json\\` file`,\n\t\t!options.excludeLintPackages &&\n\t\t\t`- \\`pnpm lint:packages\\` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the \\`pnpm-lock.yml\\` file`,\n\t\t!options.excludeLintSpelling &&\n\t\t\t`- \\`pnpm lint:spelling\\` ([cspell](https://cspell.org)): Spell checks across all source files`,\n\t].filter(Boolean);\n\n\treturn `# Development\n\nAfter [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo) and [installing pnpm](https://pnpm.io/installation):\n\n\\`\\`\\`shell\ngit clone https://github.com/<your-name-here>/${options.repository}\ncd ${options.repository}\npnpm install\n\\`\\`\\`\n\n> This repository includes a list of suggested VS Code extensions.\n> It's a good idea to use [VS Code](https://code.visualstudio.com) and accept its suggestion to install them, as they'll help with development.\n\n## Building\n\nRun [
|
|
1
|
+
{"version":3,"sources":["../../../../../src/steps/writing/creation/dotGitHub/createDevelopment.ts"],"sourcesContent":["import { Options } from \"../../../../shared/types.js\";\n\nexport function createDevelopment(options: Options) {\n\tconst lintLines = [\n\t\t!options.excludeLintKnip &&\n\t\t\t`- \\`pnpm lint:knip\\` ([knip](https://github.com/webpro/knip)): Detects unused files, dependencies, and code exports`,\n\t\t!options.excludeLintMd &&\n\t\t\t`- \\`pnpm lint:md\\` ([Markdownlint](https://github.com/DavidAnson/markdownlint)): Checks Markdown source files`,\n\t\t!options.excludeLintPackageJson &&\n\t\t\t`- \\`pnpm lint:package-json\\` ([npm-package-json-lint](https://npmpackagejsonlint.org/)): Lints the \\`package.json\\` file`,\n\t\t!options.excludeLintPackages &&\n\t\t\t`- \\`pnpm lint:packages\\` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the \\`pnpm-lock.yml\\` file`,\n\t\t!options.excludeLintSpelling &&\n\t\t\t`- \\`pnpm lint:spelling\\` ([cspell](https://cspell.org)): Spell checks across all source files`,\n\t].filter(Boolean);\n\n\treturn `# Development\n\nAfter [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo) and [installing pnpm](https://pnpm.io/installation):\n\n\\`\\`\\`shell\ngit clone https://github.com/<your-name-here>/${options.repository}\ncd ${options.repository}\npnpm install\n\\`\\`\\`\n\n> This repository includes a list of suggested VS Code extensions.\n> It's a good idea to use [VS Code](https://code.visualstudio.com) and accept its suggestion to install them, as they'll help with development.\n\n## Building\n\nRun [**tsup**](https://tsup.egoist.dev) locally to build source files from \\`src/\\` into output files in \\`lib/\\`:\n\n\\`\\`\\`shell\npnpm build\n\\`\\`\\`\n\nAdd \\`--watch\\` to run the builder in a watch mode that continuously cleans and recreates \\`lib/\\` as you save files:\n\n\\`\\`\\`shell\npnpm build --watch\n\\`\\`\\`\n\n## Formatting\n\n[Prettier](https://prettier.io) is used to format code.\nIt should be applied automatically when you save files in VS Code or make a Git commit.\n\nTo manually reformat all files, you can run:\n\n\\`\\`\\`shell\npnpm format:write\n\\`\\`\\`\n\n## Linting\n\n${\n\tlintLines.length\n\t\t? [\n\t\t\t\t`This package includes several forms of linting to enforce consistent code quality and styling.`,\n\t\t\t\t`Each should be shown in VS Code, and can be run manually on the command-line:`,\n\t\t\t\t``,\n\t\t\t\t`- \\`pnpm lint\\` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files`,\n\t\t\t\t...lintLines,\n\t\t\t\t``,\n\t\t\t\t`Read the individual documentation for each linter to understand how it can be configured and used best.`,\n\t\t\t\t``,\n\t\t\t\t`For example, ESLint can be run with \\`--fix\\` to auto-fix some lint rule complaints:`,\n\t\t ].join(\"\\n\")\n\t\t: `[ESLint](https://eslint.org) is used with with [typescript-eslint](https://typescript-eslint.io)) to lint JavaScript and TypeScript source files.\nYou can run it locally on the command-line:\n\n\\`\\`\\`shell\npnpm run lint\n\\`\\`\\`\n\nESLint can be run with \\`--fix\\` to auto-fix some lint rule complaints:`\n}\n\n\\`\\`\\`shell\npnpm run lint --fix\n\\`\\`\\`\n\n${\n\t!options.excludeTests &&\n\t`## Testing\n\n[Vitest](https://vitest.dev) is used for tests.\nYou can run it locally on the command-line:\n\n\\`\\`\\`shell\npnpm run test\n\\`\\`\\`\n\nAdd the \\`--coverage\\` flag to compute test coverage and place reports in the \\`coverage/\\` directory:\n\n\\`\\`\\`shell\npnpm run test --coverage\n\\`\\`\\`\n\nNote that [console-fail-test](https://github.com/JoshuaKGoldberg/console-fail-test) is enabled for all test runs.\nCalls to \\`console.log\\`, \\`console.warn\\`, and other console methods will cause a test to fail.\n\n### Debugging Tests\n\nThis repository includes a [VS Code launch configuration](https://code.visualstudio.com/docs/editor/debugging) for debugging unit tests.\nTo launch it, open a test file, then run _Debug Current Test File_ from the VS Code Debug panel (or press F5).\n`\n}\n## Type Checking\n\nYou should be able to see suggestions from [TypeScript](https://typescriptlang.org) in your editor for all open files.\n\nHowever, it can be useful to run the TypeScript command-line (\\`tsc\\`) to type check all files in \\`src/\\`:\n\n\\`\\`\\`shell\npnpm tsc\n\\`\\`\\`\n\nAdd \\`--watch\\` to keep the type checker running in a watch mode that updates the display as you save files:\n\n\\`\\`\\`shell\npnpm tsc --watch\n\\`\\`\\`\n`;\n}\n"],"mappings":"AAEO,SAAS,kBAAkB,SAAkB;AACnD,QAAM,YAAY;AAAA,IACjB,CAAC,QAAQ,mBACR;AAAA,IACD,CAAC,QAAQ,iBACR;AAAA,IACD,CAAC,QAAQ,0BACR;AAAA,IACD,CAAC,QAAQ,uBACR;AAAA,IACD,CAAC,QAAQ,uBACR;AAAA,EACF,EAAE,OAAO,OAAO;AAEhB,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA,gDAKwC,QAAQ,UAAU;AAAA,KAC7D,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmCtB,UAAU,SACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACA,EAAE,KAAK,IAAI,IACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wEAQJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOC,CAAC,QAAQ,gBACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAuBD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA;","names":[]}
|
|
@@ -25,7 +25,8 @@ declare function createDotGitHub(options: Options): Promise<{
|
|
|
25
25
|
"post-release.yml"?: string | undefined;
|
|
26
26
|
"release.yml"?: string | undefined;
|
|
27
27
|
"lint-spelling.yml"?: string | undefined;
|
|
28
|
-
"lint-
|
|
28
|
+
"lint-packages.yml"?: string | undefined;
|
|
29
|
+
"lint-package-json.yml"?: string | undefined;
|
|
29
30
|
"lint-markdown.yml"?: string | undefined;
|
|
30
31
|
"lint-knip.yml"?: string | undefined;
|
|
31
32
|
"lint.yml": string;
|
|
@@ -5,7 +5,8 @@ declare function createWorkflows(options: Options): {
|
|
|
5
5
|
"post-release.yml"?: string | undefined;
|
|
6
6
|
"release.yml"?: string | undefined;
|
|
7
7
|
"lint-spelling.yml"?: string | undefined;
|
|
8
|
-
"lint-
|
|
8
|
+
"lint-packages.yml"?: string | undefined;
|
|
9
|
+
"lint-package-json.yml"?: string | undefined;
|
|
9
10
|
"lint-markdown.yml"?: string | undefined;
|
|
10
11
|
"lint-knip.yml"?: string | undefined;
|
|
11
12
|
"lint.yml": string;
|
|
@@ -102,11 +102,17 @@ echo "See https://github.com/actions-ecosystem/action-remove-labels/issues/221."
|
|
|
102
102
|
})
|
|
103
103
|
},
|
|
104
104
|
...!options.excludeLintPackageJson && {
|
|
105
|
-
"lint-package.yml": createWorkflowFile({
|
|
105
|
+
"lint-package-json.yml": createWorkflowFile({
|
|
106
106
|
name: "Lint Package JSON",
|
|
107
107
|
runs: ["pnpm lint:package-json"]
|
|
108
108
|
})
|
|
109
109
|
},
|
|
110
|
+
...!options.excludeLintPackageJson && {
|
|
111
|
+
"lint-packages.yml": createWorkflowFile({
|
|
112
|
+
name: "Lint Packages",
|
|
113
|
+
runs: ["pnpm lint:packages"]
|
|
114
|
+
})
|
|
115
|
+
},
|
|
110
116
|
...!options.excludeLintSpelling && {
|
|
111
117
|
"lint-spelling.yml": createWorkflowFile({
|
|
112
118
|
name: "Lint spelling",
|
|
@@ -240,7 +246,7 @@ echo "See https://github.com/actions-ecosystem/action-remove-labels/issues/221."
|
|
|
240
246
|
{ context: "lint" },
|
|
241
247
|
{ context: "lint_knip" },
|
|
242
248
|
{ context: "lint_markdown" },
|
|
243
|
-
{ context: "
|
|
249
|
+
{ context: "lint_package_json" },
|
|
244
250
|
{ context: "lint_packages" },
|
|
245
251
|
{ context: "lint_spelling" },
|
|
246
252
|
{ context: "prettier" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/steps/writing/creation/dotGitHub/workflows.ts"],"sourcesContent":["/* spellchecker: disable */\nimport { Options } from \"../../../../shared/types.js\";\nimport { createWorkflowFile } from \"./createWorkflowFile.js\";\n\nexport function createWorkflows(options: Options) {\n\treturn {\n\t\t\"build.yml\": createWorkflowFile({\n\t\t\tname: \"Build\",\n\t\t\truns: [\"pnpm build\", \"node ./lib/index.js\"],\n\t\t}),\n\t\t\"pr-review-requested.yml\": createWorkflowFile({\n\t\t\tname: \"PR Review Requested\",\n\t\t\ton: {\n\t\t\t\tpull_request_target: {\n\t\t\t\t\ttypes: [\"review_requested\"],\n\t\t\t\t},\n\t\t\t},\n\t\t\tpermissions: {\n\t\t\t\t\"pull-requests\": \"write\",\n\t\t\t},\n\t\t\tsteps: [\n\t\t\t\t{\n\t\t\t\t\tuses: \"actions-ecosystem/action-remove-labels@v1\",\n\t\t\t\t\twith: {\n\t\t\t\t\t\tlabels: \"status: waiting for author\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tif: \"failure()\",\n\t\t\t\t\trun: 'echo \"Don\\'t worry if the previous step failed.\"\\necho \"See https://github.com/actions-ecosystem/action-remove-labels/issues/221.\"\\n',\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t\t\"prettier.yml\": createWorkflowFile({\n\t\t\tname: \"Prettier\",\n\t\t\truns: [\"pnpm format --list-different\"],\n\t\t}),\n\t\t\"tsc.yml\": createWorkflowFile({\n\t\t\tname: \"Type Check\",\n\t\t\truns: [\"pnpm tsc\"],\n\t\t}),\n\t\t...(!options.excludeCompliance && {\n\t\t\t\"compliance.yml\": createWorkflowFile({\n\t\t\t\tname: \"Compliance\",\n\t\t\t\ton: {\n\t\t\t\t\tpull_request: {\n\t\t\t\t\t\tbranches: [\"main\"],\n\t\t\t\t\t\ttypes: [\"edited\", \"opened\", \"reopened\", \"synchronize\"],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tpermissions: {\n\t\t\t\t\t\"pull-requests\": \"write\",\n\t\t\t\t},\n\t\t\t\tsteps: [\n\t\t\t\t\t{\n\t\t\t\t\t\tuses: \"mtfoley/pr-compliance-action@main\",\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\"body-auto-close\": false,\n\t\t\t\t\t\t\t\"ignore-authors\": [\n\t\t\t\t\t\t\t\t\"allcontributors\",\n\t\t\t\t\t\t\t\t\"allcontributors[bot]\",\n\t\t\t\t\t\t\t\t\"renovate\",\n\t\t\t\t\t\t\t\t\"renovate[bot]\",\n\t\t\t\t\t\t\t].join(\"\\n\"),\n\t\t\t\t\t\t\t\"ignore-team-members\": false,\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\t...(!options.excludeContributors && {\n\t\t\t\"contributors.yml\": createWorkflowFile({\n\t\t\t\tname: \"Contributors\",\n\t\t\t\ton: {\n\t\t\t\t\tpush: {\n\t\t\t\t\t\tbranches: [\"main\"],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tsteps: [\n\t\t\t\t\t{ uses: \"actions/checkout@v3\", with: { \"fetch-depth\": 0 } },\n\t\t\t\t\t{ uses: \"./.github/actions/prepare\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tenv: { GITHUB_TOKEN: \"${{ secrets.ACCESS_TOKEN }}\" },\n\t\t\t\t\t\tuses: `JoshuaKGoldberg/all-contributors-auto-action@v0.3.2`,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t}),\n\t\t\"lint.yml\": createWorkflowFile({\n\t\t\tname: \"Lint\",\n\t\t\truns: [\"pnpm lint\"],\n\t\t}),\n\t\t...(!options.excludeLintKnip && {\n\t\t\t\"lint-knip.yml\": createWorkflowFile({\n\t\t\t\tname: \"Lint Knip\",\n\t\t\t\truns: [\"pnpm lint:knip\"],\n\t\t\t}),\n\t\t}),\n\t\t...(!options.excludeLintMd && {\n\t\t\t\"lint-markdown.yml\": createWorkflowFile({\n\t\t\t\tname: \"Lint Markdown\",\n\t\t\t\truns: [\"pnpm lint:md\"],\n\t\t\t}),\n\t\t}),\n\t\t...(!options.excludeLintPackageJson && {\n\t\t\t\"lint-package.yml\": createWorkflowFile({\n\t\t\t\tname: \"Lint Package JSON\",\n\t\t\t\truns: [\"pnpm lint:package-json\"],\n\t\t\t}),\n\t\t}),\n\t\t...(!options.excludeLintSpelling && {\n\t\t\t\"lint-spelling.yml\": createWorkflowFile({\n\t\t\t\tname: \"Lint spelling\",\n\t\t\t\truns: [\"pnpm lint:spelling\"],\n\t\t\t}),\n\t\t}),\n\t\t...(!options.excludeReleases && {\n\t\t\t\"post-release.yml\": createWorkflowFile({\n\t\t\t\tname: \"Post Release\",\n\t\t\t\ton: {\n\t\t\t\t\trelease: {\n\t\t\t\t\t\ttypes: [\"published\"],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tsteps: [\n\t\t\t\t\t{ uses: \"actions/checkout@v3\", with: { \"fetch-depth\": 0 } },\n\t\t\t\t\t{\n\t\t\t\t\t\trun: `echo \"npm_version=$(npm pkg get version | tr -d '\"')\" >> \"$GITHUB_ENV\"`,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tuses: \"apexskier/github-release-commenter@v1\",\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tGITHUB_TOKEN: \"${{ secrets.GITHUB_TOKEN }}\",\n\t\t\t\t\t\t\t\"comment-template\": `\n\t\t\t\t\t\t\t:tada: This is included in version {release_link} :tada:\n\n\t\t\t\t\t\t\tThe release is available on:\n\t\t\t\t\n\t\t\t\t\t\t\t* [GitHub releases](https://github.com/${options.owner}/${options.repository}/releases/tag/{release_tag})\n\t\t\t\t\t\t\t* [npm package (@latest dist-tag)](https://www.npmjs.com/package/${options.repository}/v/\\${{ env.npm_version }})\n\t\t\t\t\n\t\t\t\t\t\t\tCheers! 📦🚀\n\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\t\"release.yml\": createWorkflowFile({\n\t\t\t\tconcurrency: {\n\t\t\t\t\t\"cancel-in-progress\": true,\n\t\t\t\t\tgroup: \"${{ github.workflow }}\",\n\t\t\t\t},\n\t\t\t\tname: \"Release\",\n\t\t\t\ton: {\n\t\t\t\t\tpush: {\n\t\t\t\t\t\tbranches: [\"main\"],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tpermissions: {\n\t\t\t\t\tcontents: \"write\",\n\t\t\t\t\t\"id-token\": \"write\",\n\t\t\t\t},\n\t\t\t\tsteps: [\n\t\t\t\t\t{\n\t\t\t\t\t\tuses: \"actions/checkout@v3\",\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\"fetch-depth\": 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tuses: \"./.github/actions/prepare\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\trun: \"pnpm build\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\trun: 'git config user.name \"${GITHUB_ACTOR}\"',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\trun: 'git config user.email \"${GITHUB_ACTOR}@users.noreply.github.com\"',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tenv: {\n\t\t\t\t\t\t\tNPM_TOKEN: \"${{ secrets.NPM_TOKEN }}\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\trun: \"npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Delete branch protection on main\",\n\t\t\t\t\t\tuses: \"actions/github-script@v6.4.1\",\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\"github-token\": \"${{ secrets.ACCESS_TOKEN }}\",\n\t\t\t\t\t\t\tscript: `\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tawait github.request(\n\t\t\t\t\t\t\t\t\t \\`DELETE /repos/${options.owner}/${options.repository}/branches/main/protection\\`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\tif (!error.message?.includes?.(\"Branch not protected\")) {\n\t\t\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t\t\t}\n\t\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\t{\n\t\t\t\t\t\tenv: {\n\t\t\t\t\t\t\tGITHUB_TOKEN: \"${{ secrets.ACCESS_TOKEN }}\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\trun: `\n\t\t\t\t\t\tif pnpm run should-semantic-release ; then\n\t\t\t\t\t\t pnpm release-it --verbose\n\t\t\t\t\t\t gh workflow run post-release.yml\n\t\t\t\t\t\tfi`,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tif: \"always()\",\n\t\t\t\t\t\tname: \"Recreate branch protection on main\",\n\t\t\t\t\t\tuses: \"actions/github-script@v6.4.1\",\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\"github-token\": \"${{ secrets.ACCESS_TOKEN }}\",\n\t\t\t\t\t\t\tscript: `\n\t\t\t\t\t\t\tgithub.request(\n\t\t\t\t\t\t\t \\`PUT /repos/${options.owner}/${options.repository}/branches/main/protection\\`,\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t allow_deletions: false,\n\t\t\t\t\t\t\t\t allow_force_pushes: true,\n\t\t\t\t\t\t\t\t allow_fork_pushes: false,\n\t\t\t\t\t\t\t\t allow_fork_syncing: true,\n\t\t\t\t\t\t\t\t block_creations: false,\n\t\t\t\t\t\t\t\t branch: \"main\",\n\t\t\t\t\t\t\t\t enforce_admins: false,\n\t\t\t\t\t\t\t\t owner: \"${options.owner}\",\n\t\t\t\t\t\t\t\t repo: \"${options.repository}\",\n\t\t\t\t\t\t\t\t required_conversation_resolution: true,\n\t\t\t\t\t\t\t\t required_linear_history: false,\n\t\t\t\t\t\t\t\t required_pull_request_reviews: null,\n\t\t\t\t\t\t\t\t required_status_checks: {\n\t\t\t\t\t\t\t\t\tchecks: [\n\t\t\t\t\t\t\t\t\t { context: \"build\" },\n\t\t\t\t\t\t\t\t\t { context: \"compliance\" },\n\t\t\t\t\t\t\t\t\t { context: \"lint\" },\n\t\t\t\t\t\t\t\t\t { context: \"lint_knip\" },\n\t\t\t\t\t\t\t\t\t { context: \"lint_markdown\" },\n\t\t\t\t\t\t\t\t\t { context: \"lint_package\" },\n\t\t\t\t\t\t\t\t\t { context: \"lint_packages\" },\n\t\t\t\t\t\t\t\t\t { context: \"lint_spelling\" },\n\t\t\t\t\t\t\t\t\t { context: \"prettier\" },\n\t\t\t\t\t\t\t\t\t { context: \"test\" },\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\t restrictions: null,\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t);\n\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\t...(options.excludeTests && {\n\t\t\t\"test.yml\": createWorkflowFile({\n\t\t\t\tname: \"Test\",\n\t\t\t\tsteps: [\n\t\t\t\t\t{ uses: \"actions/checkout@v3\" },\n\t\t\t\t\t{ uses: \"./.github/actions/prepare\" },\n\t\t\t\t\t{ run: \"pnpm run test --coverage\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Codecov\",\n\t\t\t\t\t\tuses: \"codecov/codecov-action@v3\",\n\t\t\t\t\t\twith: { \"github-token\": \"${{ secrets.GITHUB_TOKEN }}\" },\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t}),\n\t};\n}\n"],"mappings":"AAEA,SAAS,0BAA0B;AAE5B,SAAS,gBAAgB,SAAkB;AACjD,SAAO;AAAA,IACN,aAAa,mBAAmB;AAAA,MAC/B,MAAM;AAAA,MACN,MAAM,CAAC,cAAc,qBAAqB;AAAA,IAC3C,CAAC;AAAA,IACD,2BAA2B,mBAAmB;AAAA,MAC7C,MAAM;AAAA,MACN,IAAI;AAAA,QACH,qBAAqB;AAAA,UACpB,OAAO,CAAC,kBAAkB;AAAA,QAC3B;AAAA,MACD;AAAA,MACA,aAAa;AAAA,QACZ,iBAAiB;AAAA,MAClB;AAAA,MACA,OAAO;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN,MAAM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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAuB/B;AAAA,UACD;AAAA,QACD;AAAA,MACD,CAAC;AAAA,IACF;AAAA,IACA,GAAI,QAAQ,gBAAgB;AAAA,MAC3B,YAAY,mBAAmB;AAAA,QAC9B,MAAM;AAAA,QACN,OAAO;AAAA,UACN,EAAE,MAAM,sBAAsB;AAAA,UAC9B,EAAE,MAAM,4BAA4B;AAAA,UACpC,EAAE,KAAK,2BAA2B;AAAA,UAClC;AAAA,YACC,MAAM;AAAA,YACN,MAAM;AAAA,YACN,MAAM,EAAE,gBAAgB,8BAA8B;AAAA,UACvD;AAAA,QACD;AAAA,MACD,CAAC;AAAA,IACF;AAAA,EACD;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/steps/writing/creation/dotGitHub/workflows.ts"],"sourcesContent":["/* spellchecker: disable */\nimport { Options } from \"../../../../shared/types.js\";\nimport { createWorkflowFile } from \"./createWorkflowFile.js\";\n\nexport function createWorkflows(options: Options) {\n\treturn {\n\t\t\"build.yml\": createWorkflowFile({\n\t\t\tname: \"Build\",\n\t\t\truns: [\"pnpm build\", \"node ./lib/index.js\"],\n\t\t}),\n\t\t\"pr-review-requested.yml\": createWorkflowFile({\n\t\t\tname: \"PR Review Requested\",\n\t\t\ton: {\n\t\t\t\tpull_request_target: {\n\t\t\t\t\ttypes: [\"review_requested\"],\n\t\t\t\t},\n\t\t\t},\n\t\t\tpermissions: {\n\t\t\t\t\"pull-requests\": \"write\",\n\t\t\t},\n\t\t\tsteps: [\n\t\t\t\t{\n\t\t\t\t\tuses: \"actions-ecosystem/action-remove-labels@v1\",\n\t\t\t\t\twith: {\n\t\t\t\t\t\tlabels: \"status: waiting for author\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tif: \"failure()\",\n\t\t\t\t\trun: 'echo \"Don\\'t worry if the previous step failed.\"\\necho \"See https://github.com/actions-ecosystem/action-remove-labels/issues/221.\"\\n',\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t\t\"prettier.yml\": createWorkflowFile({\n\t\t\tname: \"Prettier\",\n\t\t\truns: [\"pnpm format --list-different\"],\n\t\t}),\n\t\t\"tsc.yml\": createWorkflowFile({\n\t\t\tname: \"Type Check\",\n\t\t\truns: [\"pnpm tsc\"],\n\t\t}),\n\t\t...(!options.excludeCompliance && {\n\t\t\t\"compliance.yml\": createWorkflowFile({\n\t\t\t\tname: \"Compliance\",\n\t\t\t\ton: {\n\t\t\t\t\tpull_request: {\n\t\t\t\t\t\tbranches: [\"main\"],\n\t\t\t\t\t\ttypes: [\"edited\", \"opened\", \"reopened\", \"synchronize\"],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tpermissions: {\n\t\t\t\t\t\"pull-requests\": \"write\",\n\t\t\t\t},\n\t\t\t\tsteps: [\n\t\t\t\t\t{\n\t\t\t\t\t\tuses: \"mtfoley/pr-compliance-action@main\",\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\"body-auto-close\": false,\n\t\t\t\t\t\t\t\"ignore-authors\": [\n\t\t\t\t\t\t\t\t\"allcontributors\",\n\t\t\t\t\t\t\t\t\"allcontributors[bot]\",\n\t\t\t\t\t\t\t\t\"renovate\",\n\t\t\t\t\t\t\t\t\"renovate[bot]\",\n\t\t\t\t\t\t\t].join(\"\\n\"),\n\t\t\t\t\t\t\t\"ignore-team-members\": false,\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\t...(!options.excludeContributors && {\n\t\t\t\"contributors.yml\": createWorkflowFile({\n\t\t\t\tname: \"Contributors\",\n\t\t\t\ton: {\n\t\t\t\t\tpush: {\n\t\t\t\t\t\tbranches: [\"main\"],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tsteps: [\n\t\t\t\t\t{ uses: \"actions/checkout@v3\", with: { \"fetch-depth\": 0 } },\n\t\t\t\t\t{ uses: \"./.github/actions/prepare\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tenv: { GITHUB_TOKEN: \"${{ secrets.ACCESS_TOKEN }}\" },\n\t\t\t\t\t\tuses: `JoshuaKGoldberg/all-contributors-auto-action@v0.3.2`,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t}),\n\t\t\"lint.yml\": createWorkflowFile({\n\t\t\tname: \"Lint\",\n\t\t\truns: [\"pnpm lint\"],\n\t\t}),\n\t\t...(!options.excludeLintKnip && {\n\t\t\t\"lint-knip.yml\": createWorkflowFile({\n\t\t\t\tname: \"Lint Knip\",\n\t\t\t\truns: [\"pnpm lint:knip\"],\n\t\t\t}),\n\t\t}),\n\t\t...(!options.excludeLintMd && {\n\t\t\t\"lint-markdown.yml\": createWorkflowFile({\n\t\t\t\tname: \"Lint Markdown\",\n\t\t\t\truns: [\"pnpm lint:md\"],\n\t\t\t}),\n\t\t}),\n\t\t...(!options.excludeLintPackageJson && {\n\t\t\t\"lint-package-json.yml\": createWorkflowFile({\n\t\t\t\tname: \"Lint Package JSON\",\n\t\t\t\truns: [\"pnpm lint:package-json\"],\n\t\t\t}),\n\t\t}),\n\t\t...(!options.excludeLintPackageJson && {\n\t\t\t\"lint-packages.yml\": createWorkflowFile({\n\t\t\t\tname: \"Lint Packages\",\n\t\t\t\truns: [\"pnpm lint:packages\"],\n\t\t\t}),\n\t\t}),\n\t\t...(!options.excludeLintSpelling && {\n\t\t\t\"lint-spelling.yml\": createWorkflowFile({\n\t\t\t\tname: \"Lint spelling\",\n\t\t\t\truns: [\"pnpm lint:spelling\"],\n\t\t\t}),\n\t\t}),\n\t\t...(!options.excludeReleases && {\n\t\t\t\"post-release.yml\": createWorkflowFile({\n\t\t\t\tname: \"Post Release\",\n\t\t\t\ton: {\n\t\t\t\t\trelease: {\n\t\t\t\t\t\ttypes: [\"published\"],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tsteps: [\n\t\t\t\t\t{ uses: \"actions/checkout@v3\", with: { \"fetch-depth\": 0 } },\n\t\t\t\t\t{\n\t\t\t\t\t\trun: `echo \"npm_version=$(npm pkg get version | tr -d '\"')\" >> \"$GITHUB_ENV\"`,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tuses: \"apexskier/github-release-commenter@v1\",\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tGITHUB_TOKEN: \"${{ secrets.GITHUB_TOKEN }}\",\n\t\t\t\t\t\t\t\"comment-template\": `\n\t\t\t\t\t\t\t:tada: This is included in version {release_link} :tada:\n\n\t\t\t\t\t\t\tThe release is available on:\n\t\t\t\t\n\t\t\t\t\t\t\t* [GitHub releases](https://github.com/${options.owner}/${options.repository}/releases/tag/{release_tag})\n\t\t\t\t\t\t\t* [npm package (@latest dist-tag)](https://www.npmjs.com/package/${options.repository}/v/\\${{ env.npm_version }})\n\t\t\t\t\n\t\t\t\t\t\t\tCheers! 📦🚀\n\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\t\"release.yml\": createWorkflowFile({\n\t\t\t\tconcurrency: {\n\t\t\t\t\t\"cancel-in-progress\": true,\n\t\t\t\t\tgroup: \"${{ github.workflow }}\",\n\t\t\t\t},\n\t\t\t\tname: \"Release\",\n\t\t\t\ton: {\n\t\t\t\t\tpush: {\n\t\t\t\t\t\tbranches: [\"main\"],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tpermissions: {\n\t\t\t\t\tcontents: \"write\",\n\t\t\t\t\t\"id-token\": \"write\",\n\t\t\t\t},\n\t\t\t\tsteps: [\n\t\t\t\t\t{\n\t\t\t\t\t\tuses: \"actions/checkout@v3\",\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\"fetch-depth\": 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tuses: \"./.github/actions/prepare\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\trun: \"pnpm build\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\trun: 'git config user.name \"${GITHUB_ACTOR}\"',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\trun: 'git config user.email \"${GITHUB_ACTOR}@users.noreply.github.com\"',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tenv: {\n\t\t\t\t\t\t\tNPM_TOKEN: \"${{ secrets.NPM_TOKEN }}\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\trun: \"npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Delete branch protection on main\",\n\t\t\t\t\t\tuses: \"actions/github-script@v6.4.1\",\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\"github-token\": \"${{ secrets.ACCESS_TOKEN }}\",\n\t\t\t\t\t\t\tscript: `\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tawait github.request(\n\t\t\t\t\t\t\t\t\t \\`DELETE /repos/${options.owner}/${options.repository}/branches/main/protection\\`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\tif (!error.message?.includes?.(\"Branch not protected\")) {\n\t\t\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t\t\t}\n\t\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\t{\n\t\t\t\t\t\tenv: {\n\t\t\t\t\t\t\tGITHUB_TOKEN: \"${{ secrets.ACCESS_TOKEN }}\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\trun: `\n\t\t\t\t\t\tif pnpm run should-semantic-release ; then\n\t\t\t\t\t\t pnpm release-it --verbose\n\t\t\t\t\t\t gh workflow run post-release.yml\n\t\t\t\t\t\tfi`,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tif: \"always()\",\n\t\t\t\t\t\tname: \"Recreate branch protection on main\",\n\t\t\t\t\t\tuses: \"actions/github-script@v6.4.1\",\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\"github-token\": \"${{ secrets.ACCESS_TOKEN }}\",\n\t\t\t\t\t\t\tscript: `\n\t\t\t\t\t\t\tgithub.request(\n\t\t\t\t\t\t\t \\`PUT /repos/${options.owner}/${options.repository}/branches/main/protection\\`,\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t allow_deletions: false,\n\t\t\t\t\t\t\t\t allow_force_pushes: true,\n\t\t\t\t\t\t\t\t allow_fork_pushes: false,\n\t\t\t\t\t\t\t\t allow_fork_syncing: true,\n\t\t\t\t\t\t\t\t block_creations: false,\n\t\t\t\t\t\t\t\t branch: \"main\",\n\t\t\t\t\t\t\t\t enforce_admins: false,\n\t\t\t\t\t\t\t\t owner: \"${options.owner}\",\n\t\t\t\t\t\t\t\t repo: \"${options.repository}\",\n\t\t\t\t\t\t\t\t required_conversation_resolution: true,\n\t\t\t\t\t\t\t\t required_linear_history: false,\n\t\t\t\t\t\t\t\t required_pull_request_reviews: null,\n\t\t\t\t\t\t\t\t required_status_checks: {\n\t\t\t\t\t\t\t\t\tchecks: [\n\t\t\t\t\t\t\t\t\t { context: \"build\" },\n\t\t\t\t\t\t\t\t\t { context: \"compliance\" },\n\t\t\t\t\t\t\t\t\t { context: \"lint\" },\n\t\t\t\t\t\t\t\t\t { context: \"lint_knip\" },\n\t\t\t\t\t\t\t\t\t { context: \"lint_markdown\" },\n\t\t\t\t\t\t\t\t\t { context: \"lint_package_json\" },\n\t\t\t\t\t\t\t\t\t { context: \"lint_packages\" },\n\t\t\t\t\t\t\t\t\t { context: \"lint_spelling\" },\n\t\t\t\t\t\t\t\t\t { context: \"prettier\" },\n\t\t\t\t\t\t\t\t\t { context: \"test\" },\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\t restrictions: null,\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t);\n\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\t...(options.excludeTests && {\n\t\t\t\"test.yml\": createWorkflowFile({\n\t\t\t\tname: \"Test\",\n\t\t\t\tsteps: [\n\t\t\t\t\t{ uses: \"actions/checkout@v3\" },\n\t\t\t\t\t{ uses: \"./.github/actions/prepare\" },\n\t\t\t\t\t{ run: \"pnpm run test --coverage\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Codecov\",\n\t\t\t\t\t\tuses: \"codecov/codecov-action@v3\",\n\t\t\t\t\t\twith: { \"github-token\": \"${{ secrets.GITHUB_TOKEN }}\" },\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t}),\n\t};\n}\n"],"mappings":"AAEA,SAAS,0BAA0B;AAE5B,SAAS,gBAAgB,SAAkB;AACjD,SAAO;AAAA,IACN,aAAa,mBAAmB;AAAA,MAC/B,MAAM;AAAA,MACN,MAAM,CAAC,cAAc,qBAAqB;AAAA,IAC3C,CAAC;AAAA,IACD,2BAA2B,mBAAmB;AAAA,MAC7C,MAAM;AAAA,MACN,IAAI;AAAA,QACH,qBAAqB;AAAA,UACpB,OAAO,CAAC,kBAAkB;AAAA,QAC3B;AAAA,MACD;AAAA,MACA,aAAa;AAAA,QACZ,iBAAiB;AAAA,MAClB;AAAA,MACA,OAAO;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN,MAAM;AAAA,YACL,QAAQ;AAAA,UACT;AAAA,QACD;AAAA,QACA;AAAA,UACC,IAAI;AAAA,UACJ,KAAK;AAAA;AAAA;AAAA,QACN;AAAA,MACD;AAAA,IACD,CAAC;AAAA,IACD,gBAAgB,mBAAmB;AAAA,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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAuB/B;AAAA,UACD;AAAA,QACD;AAAA,MACD,CAAC;AAAA,IACF;AAAA,IACA,GAAI,QAAQ,gBAAgB;AAAA,MAC3B,YAAY,mBAAmB;AAAA,QAC9B,MAAM;AAAA,QACN,OAAO;AAAA,UACN,EAAE,MAAM,sBAAsB;AAAA,UAC9B,EAAE,MAAM,4BAA4B;AAAA,UACpC,EAAE,KAAK,2BAA2B;AAAA,UAClC;AAAA,YACC,MAAM;AAAA,YACN,MAAM;AAAA,YACN,MAAM,EAAE,gBAAgB,8BAA8B;AAAA,UACvD;AAAA,QACD;AAAA,MACD,CAAC;AAAA,IACF;AAAA,EACD;AACD;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/steps/writing/creation/writePackageJson.ts"],"sourcesContent":["import { readFileSafeAsJson } from \"../../../shared/readFileSafeAsJson.js\";\nimport { Options } from \"../../../shared/types.js\";\nimport { formatJson } from \"./formatters/formatJson.js\";\n\nconst devDependenciesToRemove = [\n\t\"@babel/core\",\n\t\"@babel/preset-env\",\n\t\"@babel/preset-react\",\n\t\"@babel/preset-typescript\",\n\t\"@swc/jest\",\n\t\"ava\",\n\t\"babel-jest\",\n\t\"commitlint\",\n\t\"cson-parser\",\n\t\"esbuild\",\n\t\"eslint-config-prettier\",\n\t\"eslint-plugin-prettier\",\n\t\"eslint-plugin-simple-import-sort\",\n\t\"jasmine\",\n\t\"jest\",\n\t\"mocha\",\n\t\"npm-run-all\",\n\t\"pretty-quick\",\n];\n\nexport async function writePackageJson(options: Options) {\n\tconst existingPackageJson =\n\t\t((await readFileSafeAsJson(\"./package.json\")) as null | object) ?? {};\n\n\treturn await formatJson({\n\t\t// If we didn't already have a version, set it to 0.0.0\n\t\tversion: \"0.0.0\",\n\n\t\t// To start, copy over all existing package fields (e.g. \"dependencies\")\n\t\t...existingPackageJson,\n\n\t\tauthor: { email: options.email, name: options.author },\n\t\tdescription: options.description,\n\n\t\t// We copy all existing dev dependencies except those we know are not used anymore\n\t\tdevDependencies: copyDevDependencies(existingPackageJson),\n\n\t\t// Remove fields we know we don't want, such as old or redundant configs\n\t\teslintConfig: undefined,\n\t\thusky: undefined,\n\t\tprettierConfig: undefined,\n\t\ttypes: undefined,\n\n\t\t// The rest of the fields are ones we know from our template\n\t\tengines: {\n\t\t\tnode: \">=18\",\n\t\t},\n\t\tfiles: [\"lib/\", \"package.json\", \"LICENSE.md\", \"README.md\"],\n\t\tlicense: \"MIT\",\n\t\t\"lint-staged\": {\n\t\t\t\"*\": \"prettier --ignore-unknown --write\",\n\t\t},\n\t\tmain: \"./lib/index.js\",\n\t\tname: options.repository,\n\t\tpackageManager: \"pnpm@8.7.0\",\n\t\tpublishConfig: {\n\t\t\tprovenance: true,\n\t\t},\n\t\trepository: {\n\t\t\ttype: \"git\",\n\t\t\turl: `https://github.com/${options.owner}/${options.repository}`,\n\t\t},\n\t\tscripts: {\n\t\t\tbuild: \"tsup\",\n\t\t\tformat: 'prettier \"**/*\" --ignore-unknown',\n\t\t\t\"format:write\": \"pnpm format --write\",\n\t\t\tlint: \"eslint . .*js --max-warnings 0 --report-unused-disable-directives\",\n\t\t\t...(!options.excludeLintKnip && {\n\t\t\t\t\"lint:knip\": \"knip\",\n\t\t\t}),\n\t\t\t...(!options.excludeLintMd && {\n\t\t\t\t\"lint:md\":\n\t\t\t\t\t'markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line',\n\t\t\t}),\n\t\t\t...(!options.excludeLintPackageJson && {\n\t\t\t\t\"lint:package-json\": \"npmPkgJsonLint .\",\n\t\t\t}),\n\t\t\t...(!options.excludeLintPackages && {\n\t\t\t\t\"lint:packages\": \"pnpm dedupe --check\",\n\t\t\t}),\n\t\t\t...(!options.excludeLintSpelling && {\n\t\t\t\t\"lint:spelling\": 'cspell \"**\" \".github/**/*\"',\n\t\t\t}),\n\t\t\tprepare: \"husky install\",\n\t\t\t...(!options.excludeReleases && {\n\t\t\t\t\"should-semantic-release\": \"should-semantic-release --verbose\",\n\t\t\t}),\n\t\t\t...(!options.excludeReleases && { test: \"vitest\" }),\n\t\t\ttsc: \"tsc\",\n\t\t},\n\t\ttype: \"module\",\n\t});\n}\n\nfunction copyDevDependencies(existingPackageJson: object) {\n\tconst devDependencies =\n\t\t\"devDependencies\" in existingPackageJson\n\t\t\t? (existingPackageJson.devDependencies as Record<string, string>)\n\t\t\t: {};\n\n\tfor (const devDependencyToRemove of devDependenciesToRemove) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\tdelete devDependencies[devDependencyToRemove];\n\t}\n\n\treturn devDependencies;\n}\n"],"mappings":"AAAA,SAAS,0BAA0B;AAEnC,SAAS,kBAAkB;AAE3B,MAAM,0BAA0B;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,eAAsB,iBAAiB,SAAkB;AACxD,QAAM,sBACH,MAAM,mBAAmB,gBAAgB,KAAwB,CAAC;AAErE,SAAO,MAAM,WAAW;AAAA;AAAA,IAEvB,SAAS;AAAA;AAAA,IAGT,GAAG;AAAA,IAEH,QAAQ,EAAE,OAAO,QAAQ,OAAO,MAAM,QAAQ,OAAO;AAAA,IACrD,aAAa,QAAQ;AAAA;AAAA,IAGrB,iBAAiB,oBAAoB,mBAAmB;AAAA;AAAA,IAGxD,cAAc;AAAA,IACd,OAAO;AAAA,IACP,gBAAgB;AAAA,IAChB,OAAO;AAAA;AAAA,IAGP,SAAS;AAAA,MACR,MAAM;AAAA,IACP;AAAA,IACA,OAAO,CAAC,QAAQ,gBAAgB,cAAc,WAAW;AAAA,IACzD,SAAS;AAAA,IACT,eAAe;AAAA,MACd,KAAK;AAAA,IACN;AAAA,IACA,MAAM;AAAA,IACN,MAAM,QAAQ;AAAA,IACd,gBAAgB;AAAA,IAChB,eAAe;AAAA,MACd,YAAY;AAAA,IACb;AAAA,IACA,YAAY;AAAA,MACX,MAAM;AAAA,MACN,KAAK,sBAAsB,QAAQ,KAAK,IAAI,QAAQ,UAAU;AAAA,IAC/D;AAAA,IACA,SAAS;AAAA,MACR,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,MAAM;AAAA,MACN,GAAI,CAAC,QAAQ,mBAAmB;AAAA,QAC/B,aAAa;AAAA,MACd;AAAA,MACA,GAAI,CAAC,QAAQ,iBAAiB;AAAA,QAC7B,WACC;AAAA,MACF;AAAA,MACA,GAAI,CAAC,QAAQ,0BAA0B;AAAA,QACtC,qBAAqB;AAAA,MACtB;AAAA,MACA,GAAI,CAAC,QAAQ,uBAAuB;AAAA,QACnC,iBAAiB;AAAA,MAClB;AAAA,MACA,GAAI,CAAC,QAAQ,uBAAuB;AAAA,QACnC,iBAAiB;AAAA,MAClB;AAAA,MACA,SAAS;AAAA,MACT,GAAI,CAAC,QAAQ,mBAAmB;AAAA,QAC/B,2BAA2B;AAAA,MAC5B;AAAA,MACA,GAAI,CAAC,QAAQ,mBAAmB,EAAE,MAAM,SAAS;AAAA,MACjD,KAAK;AAAA,IACN;AAAA,IACA,MAAM;AAAA,EACP,CAAC;AACF;AAEA,SAAS,oBAAoB,qBAA6B;AACzD,QAAM,kBACL,qBAAqB,sBACjB,oBAAoB,kBACrB,CAAC;AAEL,aAAW,yBAAyB,yBAAyB;AAE5D,WAAO,gBAAgB,qBAAqB;AAAA,EAC7C;AAEA,SAAO;AACR;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/steps/writing/creation/writePackageJson.ts"],"sourcesContent":["import { readFileSafeAsJson } from \"../../../shared/readFileSafeAsJson.js\";\nimport { Options } from \"../../../shared/types.js\";\nimport { formatJson } from \"./formatters/formatJson.js\";\n\nconst devDependenciesToRemove = [\n\t\"@babel/core\",\n\t\"@babel/preset-env\",\n\t\"@babel/preset-react\",\n\t\"@babel/preset-typescript\",\n\t\"@swc/jest\",\n\t\"ava\",\n\t\"babel-jest\",\n\t\"commitlint\",\n\t\"cson-parser\",\n\t\"esbuild\",\n\t\"eslint-config-prettier\",\n\t\"eslint-plugin-prettier\",\n\t\"eslint-plugin-simple-import-sort\",\n\t\"eslint-plugin-typescript-sort-keys\",\n\t\"jasmine\",\n\t\"jest\",\n\t\"mocha\",\n\t\"npm-run-all\",\n\t\"pretty-quick\",\n];\n\nexport async function writePackageJson(options: Options) {\n\tconst existingPackageJson =\n\t\t((await readFileSafeAsJson(\"./package.json\")) as null | object) ?? {};\n\n\treturn await formatJson({\n\t\t// If we didn't already have a version, set it to 0.0.0\n\t\tversion: \"0.0.0\",\n\n\t\t// To start, copy over all existing package fields (e.g. \"dependencies\")\n\t\t...existingPackageJson,\n\n\t\tauthor: { email: options.email, name: options.author },\n\t\tdescription: options.description,\n\n\t\t// We copy all existing dev dependencies except those we know are not used anymore\n\t\tdevDependencies: copyDevDependencies(existingPackageJson),\n\n\t\t// Remove fields we know we don't want, such as old or redundant configs\n\t\teslintConfig: undefined,\n\t\thusky: undefined,\n\t\tprettierConfig: undefined,\n\t\ttypes: undefined,\n\n\t\t// The rest of the fields are ones we know from our template\n\t\tengines: {\n\t\t\tnode: \">=18\",\n\t\t},\n\t\tfiles: [\"lib/\", \"package.json\", \"LICENSE.md\", \"README.md\"],\n\t\tlicense: \"MIT\",\n\t\t\"lint-staged\": {\n\t\t\t\"*\": \"prettier --ignore-unknown --write\",\n\t\t},\n\t\tmain: \"./lib/index.js\",\n\t\tname: options.repository,\n\t\tpackageManager: \"pnpm@8.7.0\",\n\t\tpublishConfig: {\n\t\t\tprovenance: true,\n\t\t},\n\t\trepository: {\n\t\t\ttype: \"git\",\n\t\t\turl: `https://github.com/${options.owner}/${options.repository}`,\n\t\t},\n\t\tscripts: {\n\t\t\tbuild: \"tsup\",\n\t\t\tformat: 'prettier \"**/*\" --ignore-unknown',\n\t\t\t\"format:write\": \"pnpm format --write\",\n\t\t\tlint: \"eslint . .*js --max-warnings 0 --report-unused-disable-directives\",\n\t\t\t...(!options.excludeLintKnip && {\n\t\t\t\t\"lint:knip\": \"knip\",\n\t\t\t}),\n\t\t\t...(!options.excludeLintMd && {\n\t\t\t\t\"lint:md\":\n\t\t\t\t\t'markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line',\n\t\t\t}),\n\t\t\t...(!options.excludeLintPackageJson && {\n\t\t\t\t\"lint:package-json\": \"npmPkgJsonLint .\",\n\t\t\t}),\n\t\t\t...(!options.excludeLintPackages && {\n\t\t\t\t\"lint:packages\": \"pnpm dedupe --check\",\n\t\t\t}),\n\t\t\t...(!options.excludeLintSpelling && {\n\t\t\t\t\"lint:spelling\": 'cspell \"**\" \".github/**/*\"',\n\t\t\t}),\n\t\t\tprepare: \"husky install\",\n\t\t\t...(!options.excludeReleases && {\n\t\t\t\t\"should-semantic-release\": \"should-semantic-release --verbose\",\n\t\t\t}),\n\t\t\t...(!options.excludeReleases && { test: \"vitest\" }),\n\t\t\ttsc: \"tsc\",\n\t\t},\n\t\ttype: \"module\",\n\t});\n}\n\nfunction copyDevDependencies(existingPackageJson: object) {\n\tconst devDependencies =\n\t\t\"devDependencies\" in existingPackageJson\n\t\t\t? (existingPackageJson.devDependencies as Record<string, string>)\n\t\t\t: {};\n\n\tfor (const devDependencyToRemove of devDependenciesToRemove) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\tdelete devDependencies[devDependencyToRemove];\n\t}\n\n\treturn devDependencies;\n}\n"],"mappings":"AAAA,SAAS,0BAA0B;AAEnC,SAAS,kBAAkB;AAE3B,MAAM,0BAA0B;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAA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GAAI,CAAC,QAAQ,uBAAuB;AAAA,QACnC,iBAAiB;AAAA,MAClB;AAAA,MACA,SAAS;AAAA,MACT,GAAI,CAAC,QAAQ,mBAAmB;AAAA,QAC/B,2BAA2B;AAAA,MAC5B;AAAA,MACA,GAAI,CAAC,QAAQ,mBAAmB,EAAE,MAAM,SAAS;AAAA,MACjD,KAAK;AAAA,IACN;AAAA,IACA,MAAM;AAAA,EACP,CAAC;AACF;AAEA,SAAS,oBAAoB,qBAA6B;AACzD,QAAM,kBACL,qBAAqB,sBACjB,oBAAoB,kBACrB,CAAC;AAEL,aAAW,yBAAyB,yBAAyB;AAE5D,WAAO,gBAAgB,qBAAqB;AAAA,EAC7C;AAEA,SAAO;AACR;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-typescript-app",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.33",
|
|
4
4
|
"description": "Quickstart-friendly TypeScript template with comprehensive formatting, linting, releases, testing, and other great tooling built-in. ✨",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"git-remote-origin-url": "^4.0.0",
|
|
52
52
|
"git-url-parse": "^13.1.0",
|
|
53
53
|
"js-yaml": "^4.1.0",
|
|
54
|
+
"lazy-value": "^3.0.0",
|
|
54
55
|
"npm-user": "^5.0.1",
|
|
55
56
|
"octokit": "^3.1.0",
|
|
56
57
|
"prettier": "^3.0.2",
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
83
84
|
"eslint-plugin-perfectionist": "^1.5.1",
|
|
84
85
|
"eslint-plugin-regexp": "^1.15.0",
|
|
85
|
-
"eslint-plugin-vitest": "^0.
|
|
86
|
+
"eslint-plugin-vitest": "^0.3.0",
|
|
86
87
|
"eslint-plugin-yml": "^1.8.0",
|
|
87
88
|
"globby": "^13.2.2",
|
|
88
89
|
"husky": "^8.0.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/options/getOctokit.ts"],"sourcesContent":["import { $ } from \"execa\";\nimport { Octokit } from \"octokit\";\n\nexport async function getOctokit(): Promise<Octokit | undefined> {\n\ttry {\n\t\tawait $`gh auth status`;\n\t} catch (error) {\n\t\tthrow new Error(\"GitHub authentication failed.\", {\n\t\t\tcause: (error as Error).message,\n\t\t});\n\t}\n\n\tconst auth = (await $`gh auth token`).stdout.trim();\n\n\treturn new Octokit({ auth });\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB,SAAS,eAAe;AAExB,eAAsB,aAA2C;AAChE,MAAI;AACH,UAAM;AAAA,EACP,SAAS,OAAO;AACf,UAAM,IAAI,MAAM,iCAAiC;AAAA,MAChD,OAAQ,MAAgB;AAAA,IACzB,CAAC;AAAA,EACF;AAEA,QAAM,QAAQ,MAAM,kBAAkB,OAAO,KAAK;AAElD,SAAO,IAAI,QAAQ,EAAE,KAAK,CAAC;AAC5B;","names":[]}
|