create-typescript-app 0.1.2 → 1.29.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/LICENSE.md +17 -5
  2. package/README.md +118 -0
  3. package/bin/index.js +4 -0
  4. package/lib/bin/index.d.ts +3 -0
  5. package/lib/bin/index.js +52 -0
  6. package/lib/bin/index.js.map +1 -0
  7. package/lib/bin/mode.d.ts +4 -0
  8. package/lib/bin/mode.js +43 -0
  9. package/lib/bin/mode.js.map +1 -0
  10. package/lib/create/createRerunSuggestion.d.ts +6 -0
  11. package/lib/create/createRerunSuggestion.js +17 -0
  12. package/lib/create/createRerunSuggestion.js.map +1 -0
  13. package/lib/create/createWithOptions.d.ts +9 -0
  14. package/lib/create/createWithOptions.js +62 -0
  15. package/lib/create/createWithOptions.js.map +1 -0
  16. package/lib/create/index.d.ts +3 -0
  17. package/lib/create/index.js +64 -0
  18. package/lib/create/index.js.map +1 -0
  19. package/lib/greet.d.ts +5 -0
  20. package/lib/greet.js +14 -0
  21. package/lib/greet.js.map +1 -0
  22. package/lib/index.d.ts +2 -0
  23. package/lib/index.js +3 -0
  24. package/lib/index.js.map +1 -0
  25. package/lib/initialize/index.d.ts +3 -0
  26. package/lib/initialize/index.js +32 -0
  27. package/lib/initialize/index.js.map +1 -0
  28. package/lib/initialize/initializeWithOptions.d.ts +7 -0
  29. package/lib/initialize/initializeWithOptions.js +60 -0
  30. package/lib/initialize/initializeWithOptions.js.map +1 -0
  31. package/lib/migrate/index.d.ts +3 -0
  32. package/lib/migrate/index.js +29 -0
  33. package/lib/migrate/index.js.map +1 -0
  34. package/lib/migrate/migrateWithOptions.d.ts +7 -0
  35. package/lib/migrate/migrateWithOptions.js +67 -0
  36. package/lib/migrate/migrateWithOptions.js.map +1 -0
  37. package/lib/shared/cli/lines.d.ts +5 -0
  38. package/lib/shared/cli/lines.js +17 -0
  39. package/lib/shared/cli/lines.js.map +1 -0
  40. package/lib/shared/cli/lowerFirst.d.ts +3 -0
  41. package/lib/shared/cli/lowerFirst.js +7 -0
  42. package/lib/shared/cli/lowerFirst.js.map +1 -0
  43. package/lib/shared/cli/outro.d.ts +7 -0
  44. package/lib/shared/cli/outro.js +21 -0
  45. package/lib/shared/cli/outro.js.map +1 -0
  46. package/lib/shared/cli/spinners.d.ts +6 -0
  47. package/lib/shared/cli/spinners.js +49 -0
  48. package/lib/shared/cli/spinners.js.map +1 -0
  49. package/lib/shared/cli/startLineWithDots.d.ts +3 -0
  50. package/lib/shared/cli/startLineWithDots.js +31 -0
  51. package/lib/shared/cli/startLineWithDots.js.map +1 -0
  52. package/lib/shared/doesRepositoryExist.d.ts +9 -0
  53. package/lib/shared/doesRepositoryExist.js +18 -0
  54. package/lib/shared/doesRepositoryExist.js.map +1 -0
  55. package/lib/shared/ensureGitRepository.d.ts +3 -0
  56. package/lib/shared/ensureGitRepository.js +12 -0
  57. package/lib/shared/ensureGitRepository.js.map +1 -0
  58. package/lib/shared/getGitHubUserAsAllContributor.d.ts +3 -0
  59. package/lib/shared/getGitHubUserAsAllContributor.js +31 -0
  60. package/lib/shared/getGitHubUserAsAllContributor.js.map +1 -0
  61. package/lib/shared/options/args.d.ts +85 -0
  62. package/lib/shared/options/args.js +33 -0
  63. package/lib/shared/options/args.js.map +1 -0
  64. package/lib/shared/options/augmentOptionsWithExcludes.d.ts +5 -0
  65. package/lib/shared/options/augmentOptionsWithExcludes.js +126 -0
  66. package/lib/shared/options/augmentOptionsWithExcludes.js.map +1 -0
  67. package/lib/shared/options/ensureRepositoryExists.d.ts +11 -0
  68. package/lib/shared/options/ensureRepositoryExists.js +58 -0
  69. package/lib/shared/options/ensureRepositoryExists.js.map +1 -0
  70. package/lib/shared/options/getOctokit.d.ts +5 -0
  71. package/lib/shared/options/getOctokit.js +17 -0
  72. package/lib/shared/options/getOctokit.js.map +1 -0
  73. package/lib/shared/options/getPrefillOrPromptedOption.d.ts +3 -0
  74. package/lib/shared/options/getPrefillOrPromptedOption.js +23 -0
  75. package/lib/shared/options/getPrefillOrPromptedOption.js.map +1 -0
  76. package/lib/shared/options/optionalDefault.d.ts +3 -0
  77. package/lib/shared/options/optionalDefault.js +13 -0
  78. package/lib/shared/options/optionalDefault.js.map +1 -0
  79. package/lib/shared/options/readGitAndNpmDefaults/index.d.ts +11 -0
  80. package/lib/shared/options/readGitAndNpmDefaults/index.js +36 -0
  81. package/lib/shared/options/readGitAndNpmDefaults/index.js.map +1 -0
  82. package/lib/shared/options/readGitAndNpmDefaults/parsePackageAuthor.d.ts +8 -0
  83. package/lib/shared/options/readGitAndNpmDefaults/parsePackageAuthor.js +14 -0
  84. package/lib/shared/options/readGitAndNpmDefaults/parsePackageAuthor.js.map +1 -0
  85. package/lib/shared/options/readGitAndNpmDefaults/readTitleFromReadme.d.ts +3 -0
  86. package/lib/shared/options/readGitAndNpmDefaults/readTitleFromReadme.js +8 -0
  87. package/lib/shared/options/readGitAndNpmDefaults/readTitleFromReadme.js.map +1 -0
  88. package/lib/shared/options/readOptions.d.ts +10 -0
  89. package/lib/shared/options/readOptions.js +83 -0
  90. package/lib/shared/options/readOptions.js.map +1 -0
  91. package/lib/shared/packages.d.ts +6 -0
  92. package/lib/shared/packages.js +20 -0
  93. package/lib/shared/packages.js.map +1 -0
  94. package/lib/shared/prompts.d.ts +4 -0
  95. package/lib/shared/prompts.js +16 -0
  96. package/lib/shared/prompts.js.map +1 -0
  97. package/lib/shared/readFileAsJson.d.ts +3 -0
  98. package/lib/shared/readFileAsJson.js +15 -0
  99. package/lib/shared/readFileAsJson.js.map +1 -0
  100. package/lib/shared/readFileSafe.d.ts +3 -0
  101. package/lib/shared/readFileSafe.js +12 -0
  102. package/lib/shared/readFileSafe.js.map +1 -0
  103. package/lib/shared/readFileSafeAsJson.d.ts +3 -0
  104. package/lib/shared/readFileSafeAsJson.js +8 -0
  105. package/lib/shared/readFileSafeAsJson.js.map +1 -0
  106. package/lib/shared/runOrRestore.d.ts +7 -0
  107. package/lib/shared/runOrRestore.js +41 -0
  108. package/lib/shared/runOrRestore.js.map +1 -0
  109. package/lib/shared/tryCatchAsync.d.ts +3 -0
  110. package/lib/shared/tryCatchAsync.js +11 -0
  111. package/lib/shared/tryCatchAsync.js.map +1 -0
  112. package/lib/shared/types.d.ts +54 -0
  113. package/lib/shared/types.js +1 -0
  114. package/lib/shared/types.js.map +1 -0
  115. package/lib/steps/addOwnerAsAllContributor.d.ts +3 -0
  116. package/lib/steps/addOwnerAsAllContributor.js +41 -0
  117. package/lib/steps/addOwnerAsAllContributor.js.map +1 -0
  118. package/lib/steps/addToolAllContributors.d.ts +3 -0
  119. package/lib/steps/addToolAllContributors.js +12 -0
  120. package/lib/steps/addToolAllContributors.js.map +1 -0
  121. package/lib/steps/clearChangelog.d.ts +3 -0
  122. package/lib/steps/clearChangelog.js +12 -0
  123. package/lib/steps/clearChangelog.js.map +1 -0
  124. package/lib/steps/clearUnnecessaryFiles.d.ts +3 -0
  125. package/lib/steps/clearUnnecessaryFiles.js +33 -0
  126. package/lib/steps/clearUnnecessaryFiles.js.map +1 -0
  127. package/lib/steps/detectExistingContributors.d.ts +3 -0
  128. package/lib/steps/detectExistingContributors.js +16 -0
  129. package/lib/steps/detectExistingContributors.js.map +1 -0
  130. package/lib/steps/finalizeDependencies.d.ts +5 -0
  131. package/lib/steps/finalizeDependencies.js +59 -0
  132. package/lib/steps/finalizeDependencies.js.map +1 -0
  133. package/lib/steps/initializeGitHubRepository/index.d.ts +6 -0
  134. package/lib/steps/initializeGitHubRepository/index.js +14 -0
  135. package/lib/steps/initializeGitHubRepository/index.js.map +1 -0
  136. package/lib/steps/initializeGitHubRepository/initializeBranchProtectionSettings.d.ts +6 -0
  137. package/lib/steps/initializeGitHubRepository/initializeBranchProtectionSettings.js +46 -0
  138. package/lib/steps/initializeGitHubRepository/initializeBranchProtectionSettings.js.map +1 -0
  139. package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabel.d.ts +3 -0
  140. package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabel.js +14 -0
  141. package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabel.js.map +1 -0
  142. package/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.d.ts +3 -0
  143. package/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.js +31 -0
  144. package/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.js.map +1 -0
  145. package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.d.ts +7 -0
  146. package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.js +86 -0
  147. package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.js.map +1 -0
  148. package/lib/steps/initializeGitRemote.d.ts +6 -0
  149. package/lib/steps/initializeGitRemote.js +15 -0
  150. package/lib/steps/initializeGitRemote.js.map +1 -0
  151. package/lib/steps/initializeRepositorySettings.d.ts +7 -0
  152. package/lib/steps/initializeRepositorySettings.js +27 -0
  153. package/lib/steps/initializeRepositorySettings.js.map +1 -0
  154. package/lib/steps/removeSetupScripts.d.ts +3 -0
  155. package/lib/steps/removeSetupScripts.js +23 -0
  156. package/lib/steps/removeSetupScripts.js.map +1 -0
  157. package/lib/steps/resetGitTags.d.ts +3 -0
  158. package/lib/steps/resetGitTags.js +12 -0
  159. package/lib/steps/resetGitTags.js.map +1 -0
  160. package/lib/steps/runCommands.d.ts +3 -0
  161. package/lib/steps/runCommands.js +33 -0
  162. package/lib/steps/runCommands.js.map +1 -0
  163. package/lib/steps/uninstallPackages.d.ts +3 -0
  164. package/lib/steps/uninstallPackages.js +41 -0
  165. package/lib/steps/uninstallPackages.js.map +1 -0
  166. package/lib/steps/updateAllContributorsTable.d.ts +5 -0
  167. package/lib/steps/updateAllContributorsTable.js +27 -0
  168. package/lib/steps/updateAllContributorsTable.js.map +1 -0
  169. package/lib/steps/updateLocalFiles.d.ts +5 -0
  170. package/lib/steps/updateLocalFiles.js +58 -0
  171. package/lib/steps/updateLocalFiles.js.map +1 -0
  172. package/lib/steps/updateReadme.d.ts +4 -0
  173. package/lib/steps/updateReadme.js +17 -0
  174. package/lib/steps/updateReadme.js.map +1 -0
  175. package/lib/steps/writeReadme.d.ts +5 -0
  176. package/lib/steps/writeReadme.js +87 -0
  177. package/lib/steps/writeReadme.js.map +1 -0
  178. package/lib/steps/writing/creation/createESLintRC.d.ts +5 -0
  179. package/lib/steps/writing/creation/createESLintRC.js +163 -0
  180. package/lib/steps/writing/creation/createESLintRC.js.map +1 -0
  181. package/lib/steps/writing/creation/dotGitHub/actions.d.ts +7 -0
  182. package/lib/steps/writing/creation/dotGitHub/actions.js +29 -0
  183. package/lib/steps/writing/creation/dotGitHub/actions.js.map +1 -0
  184. package/lib/steps/writing/creation/dotGitHub/createDevelopment.d.ts +5 -0
  185. package/lib/steps/writing/creation/dotGitHub/createDevelopment.js +96 -0
  186. package/lib/steps/writing/creation/dotGitHub/createDevelopment.js.map +1 -0
  187. package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.d.ts +14 -0
  188. package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.js +282 -0
  189. package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.js.map +1 -0
  190. package/lib/steps/writing/creation/dotGitHub/createWorkflowFile.d.ts +49 -0
  191. package/lib/steps/writing/creation/dotGitHub/createWorkflowFile.js +34 -0
  192. package/lib/steps/writing/creation/dotGitHub/createWorkflowFile.js.map +1 -0
  193. package/lib/steps/writing/creation/dotGitHub/index.d.ts +41 -0
  194. package/lib/steps/writing/creation/dotGitHub/index.js +16 -0
  195. package/lib/steps/writing/creation/dotGitHub/index.js.map +1 -0
  196. package/lib/steps/writing/creation/dotGitHub/issueTemplate.d.ts +10 -0
  197. package/lib/steps/writing/creation/dotGitHub/issueTemplate.js +202 -0
  198. package/lib/steps/writing/creation/dotGitHub/issueTemplate.js.map +1 -0
  199. package/lib/steps/writing/creation/dotGitHub/workflows.d.ts +20 -0
  200. package/lib/steps/writing/creation/dotGitHub/workflows.js +280 -0
  201. package/lib/steps/writing/creation/dotGitHub/workflows.js.map +1 -0
  202. package/lib/steps/writing/creation/dotHusky.d.ts +6 -0
  203. package/lib/steps/writing/creation/dotHusky.js +15 -0
  204. package/lib/steps/writing/creation/dotHusky.js.map +1 -0
  205. package/lib/steps/writing/creation/dotVSCode.d.ts +9 -0
  206. package/lib/steps/writing/creation/dotVSCode.js +55 -0
  207. package/lib/steps/writing/creation/dotVSCode.js.map +1 -0
  208. package/lib/steps/writing/creation/formatters/formatIgnoreFile.d.ts +3 -0
  209. package/lib/steps/writing/creation/formatters/formatIgnoreFile.js +7 -0
  210. package/lib/steps/writing/creation/formatters/formatIgnoreFile.js.map +1 -0
  211. package/lib/steps/writing/creation/formatters/formatJson.d.ts +3 -0
  212. package/lib/steps/writing/creation/formatters/formatJson.js +17 -0
  213. package/lib/steps/writing/creation/formatters/formatJson.js.map +1 -0
  214. package/lib/steps/writing/creation/formatters/formatTypeScript.d.ts +3 -0
  215. package/lib/steps/writing/creation/formatters/formatTypeScript.js +8 -0
  216. package/lib/steps/writing/creation/formatters/formatTypeScript.js.map +1 -0
  217. package/lib/steps/writing/creation/formatters/formatYaml.d.ts +3 -0
  218. package/lib/steps/writing/creation/formatters/formatYaml.js +23 -0
  219. package/lib/steps/writing/creation/formatters/formatYaml.js.map +1 -0
  220. package/lib/steps/writing/creation/index.d.ts +6 -0
  221. package/lib/steps/writing/creation/index.js +18 -0
  222. package/lib/steps/writing/creation/index.js.map +1 -0
  223. package/lib/steps/writing/creation/rootFiles.d.ts +25 -0
  224. package/lib/steps/writing/creation/rootFiles.js +202 -0
  225. package/lib/steps/writing/creation/rootFiles.js.map +1 -0
  226. package/lib/steps/writing/creation/src.d.ts +10 -0
  227. package/lib/steps/writing/creation/src.js +90 -0
  228. package/lib/steps/writing/creation/src.js.map +1 -0
  229. package/lib/steps/writing/creation/writeAllContributorsRC.d.ts +5 -0
  230. package/lib/steps/writing/creation/writeAllContributorsRC.js +25 -0
  231. package/lib/steps/writing/creation/writeAllContributorsRC.js.map +1 -0
  232. package/lib/steps/writing/creation/writePackageJson.d.ts +5 -0
  233. package/lib/steps/writing/creation/writePackageJson.js +98 -0
  234. package/lib/steps/writing/creation/writePackageJson.js.map +1 -0
  235. package/lib/steps/writing/types.d.ts +5 -0
  236. package/lib/steps/writing/types.js +1 -0
  237. package/lib/steps/writing/types.js.map +1 -0
  238. package/lib/steps/writing/writeStructure.d.ts +5 -0
  239. package/lib/steps/writing/writeStructure.js +11 -0
  240. package/lib/steps/writing/writeStructure.js.map +1 -0
  241. package/lib/steps/writing/writeStructureWorker.d.ts +5 -0
  242. package/lib/steps/writing/writeStructureWorker.js +47 -0
  243. package/lib/steps/writing/writeStructureWorker.js.map +1 -0
  244. package/lib/types.d.ts +7 -0
  245. package/lib/types.js +1 -0
  246. package/lib/types.js.map +1 -0
  247. package/package.json +112 -23
  248. package/.vscode/settings.json +0 -3
  249. package/dist/src/cli.d.ts +0 -0
  250. package/dist/src/cli.js +0 -2
  251. package/dist/src/cli.js.map +0 -1
  252. package/dist/src/index.d.ts +0 -1
  253. package/dist/src/index.js +0 -54
  254. package/dist/src/index.js.map +0 -1
  255. package/dist/template/src/cli.d.ts +0 -0
  256. package/dist/template/src/cli.js +0 -2
  257. package/dist/template/src/cli.js.map +0 -1
  258. package/dist/template/src/index.d.ts +0 -0
  259. package/dist/template/src/index.js +0 -2
  260. package/dist/template/src/index.js.map +0 -1
  261. package/src/cli.ts +0 -0
  262. package/src/index.ts +0 -58
  263. package/src/types.d.ts +0 -10
  264. package/template/.vscode/settings.json +0 -3
  265. package/template/README.md +0 -28
  266. package/template/package.json +0 -34
  267. package/template/src/cli.ts +0 -0
  268. package/template/src/index.ts +0 -0
  269. package/template/tsconfig.json +0 -15
  270. package/template/tslint.json +0 -48
  271. package/tsconfig.json +0 -15
  272. package/tslint.json +0 -48
@@ -0,0 +1,126 @@
1
+ import * as prompts from "@clack/prompts";
2
+ import { handlePromptCancel } from "../prompts.js";
3
+ const exclusionDescriptions = {
4
+ excludeCompliance: {
5
+ hint: "--exclude-compliance",
6
+ label: "Add a GitHub Actions workflow to verify that PRs match an expected format."
7
+ },
8
+ excludeContributors: {
9
+ hint: "--exclude-contributors",
10
+ label: "Add all-contributors to track contributions and display them in a README.md table."
11
+ },
12
+ excludeLintJson: {
13
+ hint: "--exclude-lint-json",
14
+ label: "Apply linting and sorting to *.json and *.jsonc files."
15
+ },
16
+ excludeLintKnip: {
17
+ hint: "--exclude-lint-knip",
18
+ label: "Add Knip to detect unused files, dependencies, and code exports."
19
+ },
20
+ excludeLintMd: {
21
+ hint: "--exclude-lint-md",
22
+ label: "Apply linting to *.md files."
23
+ },
24
+ excludeLintPackageJson: {
25
+ hint: "--exclude-lint-package-json",
26
+ label: "Add npm-package-json-lint to lint for package.json correctness."
27
+ },
28
+ excludeLintPackages: {
29
+ hint: "--exclude-lint-packages",
30
+ label: "Add a pnpm dedupe workflow to ensure packages aren't duplicated unnecessarily."
31
+ },
32
+ excludeLintPerfectionist: {
33
+ hint: "--exclude-lint-perfectionist",
34
+ label: "Apply eslint-plugin-perfectionist to ensure imports, keys, and so on are in sorted order."
35
+ },
36
+ excludeLintSpelling: {
37
+ hint: "--exclude-lint-spelling",
38
+ label: "Add cspell to spell check against dictionaries of known words."
39
+ },
40
+ excludeLintYml: {
41
+ hint: "--exclude-lint-yml",
42
+ label: "Apply linting and sorting to *.yaml and *.yml files."
43
+ },
44
+ excludeReleases: {
45
+ hint: "--exclude-releases",
46
+ label: "Add release-it to generate changelogs, package bumps, and publishes based on conventional commits."
47
+ },
48
+ excludeRenovate: {
49
+ hint: "--exclude-renovate",
50
+ label: "Add a Renovate config to dependencies up-to-date with PRs."
51
+ },
52
+ excludeTests: {
53
+ hint: "--exclude-tests",
54
+ label: "Add Vitest tooling for fast unit tests, configured with coverage tracking."
55
+ }
56
+ };
57
+ const exclusionKeys = Object.keys(exclusionDescriptions);
58
+ async function augmentOptionsWithExcludes(options) {
59
+ if (Object.keys(options).some(
60
+ (key) => key in exclusionDescriptions && options[key] !== void 0
61
+ )) {
62
+ return options;
63
+ }
64
+ const base = options.base ?? handlePromptCancel(
65
+ await prompts.select({
66
+ message: `How much tooling would you like the template to set up for you?`,
67
+ options: [
68
+ {
69
+ hint: "recommended",
70
+ label: "Everything! \u{1F64C}",
71
+ value: "everything"
72
+ },
73
+ {
74
+ label: "Just the bare essentials, please.",
75
+ value: "minimum"
76
+ },
77
+ {
78
+ label: "Allow me to customize.",
79
+ value: "prompt"
80
+ }
81
+ ]
82
+ })
83
+ );
84
+ switch (base) {
85
+ case "everything":
86
+ return options;
87
+ case "minimum":
88
+ return {
89
+ ...options,
90
+ ...Object.fromEntries(
91
+ exclusionKeys.map((exclusion) => [
92
+ exclusion,
93
+ options[exclusion] ?? true
94
+ ])
95
+ )
96
+ };
97
+ case "prompt":
98
+ const exclusionsNotEnabled = new Set(
99
+ handlePromptCancel(
100
+ await prompts.multiselect({
101
+ initialValues: exclusionKeys,
102
+ message: "Select the tooling portions you'd like to remove. All are enabled by default.",
103
+ options: Object.entries(exclusionDescriptions).map(
104
+ ([value, { hint, label }]) => ({
105
+ hint,
106
+ label,
107
+ value
108
+ })
109
+ )
110
+ })
111
+ )
112
+ );
113
+ return {
114
+ ...options,
115
+ ...Object.fromEntries(
116
+ exclusionKeys.map(
117
+ (exclusionKey) => [exclusionKey, !exclusionsNotEnabled.has(exclusionKey)]
118
+ )
119
+ )
120
+ };
121
+ }
122
+ }
123
+ export {
124
+ augmentOptionsWithExcludes
125
+ };
126
+ //# sourceMappingURL=augmentOptionsWithExcludes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/shared/options/augmentOptionsWithExcludes.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\n\nimport { handlePromptCancel } from \"../prompts.js\";\nimport { Options } from \"../types.js\";\n\ntype Base = \"everything\" | \"minimum\" | \"prompt\";\n\nconst exclusionDescriptions = {\n\texcludeCompliance: {\n\t\thint: \"--exclude-compliance\",\n\t\tlabel:\n\t\t\t\"Add a GitHub Actions workflow to verify that PRs match an expected format.\",\n\t},\n\texcludeContributors: {\n\t\thint: \"--exclude-contributors\",\n\t\tlabel:\n\t\t\t\"Add all-contributors to track contributions and display them in a README.md table.\",\n\t},\n\texcludeLintJson: {\n\t\thint: \"--exclude-lint-json\",\n\t\tlabel: \"Apply linting and sorting to *.json and *.jsonc files.\",\n\t},\n\texcludeLintKnip: {\n\t\thint: \"--exclude-lint-knip\",\n\t\tlabel: \"Add Knip to detect unused files, dependencies, and code exports.\",\n\t},\n\texcludeLintMd: {\n\t\thint: \"--exclude-lint-md\",\n\t\tlabel: \"Apply linting to *.md files.\",\n\t},\n\texcludeLintPackageJson: {\n\t\thint: \"--exclude-lint-package-json\",\n\t\tlabel: \"Add npm-package-json-lint to lint for package.json correctness.\",\n\t},\n\texcludeLintPackages: {\n\t\thint: \"--exclude-lint-packages\",\n\t\tlabel:\n\t\t\t\"Add a pnpm dedupe workflow to ensure packages aren't duplicated unnecessarily.\",\n\t},\n\texcludeLintPerfectionist: {\n\t\thint: \"--exclude-lint-perfectionist\",\n\t\tlabel:\n\t\t\t\"Apply eslint-plugin-perfectionist to ensure imports, keys, and so on are in sorted order.\",\n\t},\n\texcludeLintSpelling: {\n\t\thint: \"--exclude-lint-spelling\",\n\t\tlabel: \"Add cspell to spell check against dictionaries of known words.\",\n\t},\n\texcludeLintYml: {\n\t\thint: \"--exclude-lint-yml\",\n\t\tlabel: \"Apply linting and sorting to *.yaml and *.yml files.\",\n\t},\n\texcludeReleases: {\n\t\thint: \"--exclude-releases\",\n\t\tlabel:\n\t\t\t\"Add release-it to generate changelogs, package bumps, and publishes based on conventional commits.\",\n\t},\n\texcludeRenovate: {\n\t\thint: \"--exclude-renovate\",\n\t\tlabel: \"Add a Renovate config to dependencies up-to-date with PRs.\",\n\t},\n\texcludeTests: {\n\t\thint: \"--exclude-tests\",\n\t\tlabel:\n\t\t\t\"Add Vitest tooling for fast unit tests, configured with coverage tracking.\",\n\t},\n} as const;\n\ntype ExclusionKey = keyof typeof exclusionDescriptions;\n\nconst exclusionKeys = Object.keys(exclusionDescriptions) as ExclusionKey[];\n\nexport async function augmentOptionsWithExcludes(\n\toptions: Options,\n): Promise<Options> {\n\tif (\n\t\tObject.keys(options).some(\n\t\t\t(key) =>\n\t\t\t\tkey in exclusionDescriptions &&\n\t\t\t\toptions[key as keyof typeof options] !== undefined,\n\t\t)\n\t) {\n\t\treturn options;\n\t}\n\n\tconst base =\n\t\toptions.base ??\n\t\thandlePromptCancel<Base | symbol>(\n\t\t\tawait prompts.select({\n\t\t\t\tmessage: `How much tooling would you like the template to set up for you?`,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\thint: \"recommended\",\n\t\t\t\t\t\tlabel: \"Everything! 🙌\",\n\t\t\t\t\t\tvalue: \"everything\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"Just the bare essentials, please.\",\n\t\t\t\t\t\tvalue: \"minimum\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"Allow me to customize.\",\n\t\t\t\t\t\tvalue: \"prompt\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t);\n\n\tswitch (base) {\n\t\tcase \"everything\":\n\t\t\treturn options;\n\n\t\tcase \"minimum\":\n\t\t\treturn {\n\t\t\t\t...options,\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\texclusionKeys.map((exclusion) => [\n\t\t\t\t\t\texclusion,\n\t\t\t\t\t\toptions[exclusion] ?? true,\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t};\n\n\t\tcase \"prompt\":\n\t\t\tconst exclusionsNotEnabled = new Set(\n\t\t\t\thandlePromptCancel(\n\t\t\t\t\tawait prompts.multiselect({\n\t\t\t\t\t\tinitialValues: exclusionKeys,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\"Select the tooling portions you'd like to remove. All are enabled by default.\",\n\t\t\t\t\t\toptions: Object.entries(exclusionDescriptions).map(\n\t\t\t\t\t\t\t([value, { hint, label }]) => ({\n\t\t\t\t\t\t\t\thint,\n\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\tvalue: value as ExclusionKey,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\t...options,\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\texclusionKeys.map(\n\t\t\t\t\t\t(exclusionKey) =>\n\t\t\t\t\t\t\t[exclusionKey, !exclusionsNotEnabled.has(exclusionKey)] as const,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t};\n\t}\n}\n"],"mappings":"AAAA,YAAY,aAAa;AAEzB,SAAS,0BAA0B;AAKnC,MAAM,wBAAwB;AAAA,EAC7B,mBAAmB;AAAA,IAClB,MAAM;AAAA,IACN,OACC;AAAA,EACF;AAAA,EACA,qBAAqB;AAAA,IACpB,MAAM;AAAA,IACN,OACC;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IAChB,MAAM;AAAA,IACN,OAAO;AAAA,EACR;AAAA,EACA,iBAAiB;AAAA,IAChB,MAAM;AAAA,IACN,OAAO;AAAA,EACR;AAAA,EACA,eAAe;AAAA,IACd,MAAM;AAAA,IACN,OAAO;AAAA,EACR;AAAA,EACA,wBAAwB;AAAA,IACvB,MAAM;AAAA,IACN,OAAO;AAAA,EACR;AAAA,EACA,qBAAqB;AAAA,IACpB,MAAM;AAAA,IACN,OACC;AAAA,EACF;AAAA,EACA,0BAA0B;AAAA,IACzB,MAAM;AAAA,IACN,OACC;AAAA,EACF;AAAA,EACA,qBAAqB;AAAA,IACpB,MAAM;AAAA,IACN,OAAO;AAAA,EACR;AAAA,EACA,gBAAgB;AAAA,IACf,MAAM;AAAA,IACN,OAAO;AAAA,EACR;AAAA,EACA,iBAAiB;AAAA,IAChB,MAAM;AAAA,IACN,OACC;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IAChB,MAAM;AAAA,IACN,OAAO;AAAA,EACR;AAAA,EACA,cAAc;AAAA,IACb,MAAM;AAAA,IACN,OACC;AAAA,EACF;AACD;AAIA,MAAM,gBAAgB,OAAO,KAAK,qBAAqB;AAEvD,eAAsB,2BACrB,SACmB;AACnB,MACC,OAAO,KAAK,OAAO,EAAE;AAAA,IACpB,CAAC,QACA,OAAO,yBACP,QAAQ,GAA2B,MAAM;AAAA,EAC3C,GACC;AACD,WAAO;AAAA,EACR;AAEA,QAAM,OACL,QAAQ,QACR;AAAA,IACC,MAAM,QAAQ,OAAO;AAAA,MACpB,SAAS;AAAA,MACT,SAAS;AAAA,QACR;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,UACP,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,OAAO;AAAA,UACP,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,OAAO;AAAA,UACP,OAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF;AAED,UAAQ,MAAM;AAAA,IACb,KAAK;AACJ,aAAO;AAAA,IAER,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,GAAG,OAAO;AAAA,UACT,cAAc,IAAI,CAAC,cAAc;AAAA,YAChC;AAAA,YACA,QAAQ,SAAS,KAAK;AAAA,UACvB,CAAC;AAAA,QACF;AAAA,MACD;AAAA,IAED,KAAK;AACJ,YAAM,uBAAuB,IAAI;AAAA,QAChC;AAAA,UACC,MAAM,QAAQ,YAAY;AAAA,YACzB,eAAe;AAAA,YACf,SACC;AAAA,YACD,SAAS,OAAO,QAAQ,qBAAqB,EAAE;AAAA,cAC9C,CAAC,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC,OAAO;AAAA,gBAC9B;AAAA,gBACA;AAAA,gBACA;AAAA,cACD;AAAA,YACD;AAAA,UACD,CAAC;AAAA,QACF;AAAA,MACD;AAEA,aAAO;AAAA,QACN,GAAG;AAAA,QACH,GAAG,OAAO;AAAA,UACT,cAAc;AAAA,YACb,CAAC,iBACA,CAAC,cAAc,CAAC,qBAAqB,IAAI,YAAY,CAAC;AAAA,UACxD;AAAA,QACD;AAAA,MACD;AAAA,EACF;AACD;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { Octokit } from 'octokit';
2
+ import { Options } from '../types.js';
3
+
4
+ type EnsureRepositoryExistsOptions = Pick<Options, "createRepository" | "owner" | "repository">;
5
+ interface RepositoryExistsResult {
6
+ octokit: Octokit | undefined;
7
+ repository: string;
8
+ }
9
+ declare function ensureRepositoryExists(octokit: Octokit | undefined, options: EnsureRepositoryExistsOptions): Promise<RepositoryExistsResult>;
10
+
11
+ export { EnsureRepositoryExistsOptions, RepositoryExistsResult, ensureRepositoryExists };
@@ -0,0 +1,58 @@
1
+ import * as prompts from "@clack/prompts";
2
+ import { doesRepositoryExist } from "../doesRepositoryExist.js";
3
+ import { handleCancel, handlePromptCancel } from "../prompts.js";
4
+ async function ensureRepositoryExists(octokit, options) {
5
+ let { createRepository, repository } = options;
6
+ while (octokit) {
7
+ if (await doesRepositoryExist(octokit, options)) {
8
+ return { octokit, repository };
9
+ }
10
+ const selection = createRepository ? "create" : handlePromptCancel(
11
+ await prompts.select({
12
+ message: `Repository ${options.repository} doesn't seem to exist under ${options.owner}. What would you like to do?`,
13
+ options: [
14
+ { label: "Create a new repository", value: "create" },
15
+ {
16
+ label: "Switch to a different repository name",
17
+ value: "different"
18
+ },
19
+ {
20
+ label: "Keep changes local",
21
+ value: "local"
22
+ },
23
+ { label: "Bail out and maybe try again later", value: "bail" }
24
+ ]
25
+ })
26
+ );
27
+ createRepository = false;
28
+ switch (selection) {
29
+ case "bail":
30
+ handleCancel();
31
+ break;
32
+ case "create":
33
+ await octokit.rest.repos.createUsingTemplate({
34
+ name: repository,
35
+ owner: options.owner,
36
+ template_owner: "JoshuaKGoldberg",
37
+ template_repo: "create-typescript-app"
38
+ });
39
+ return { octokit, repository };
40
+ case "different":
41
+ const newRepository = handlePromptCancel(
42
+ await prompts.text({
43
+ message: `What would you like to call the repository?`
44
+ })
45
+ );
46
+ repository = newRepository;
47
+ break;
48
+ case "local":
49
+ octokit = void 0;
50
+ break;
51
+ }
52
+ }
53
+ return { octokit, repository };
54
+ }
55
+ export {
56
+ ensureRepositoryExists
57
+ };
58
+ //# sourceMappingURL=ensureRepositoryExists.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/shared/options/ensureRepositoryExists.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport { Octokit } from \"octokit\";\n\nimport { doesRepositoryExist } from \"../doesRepositoryExist.js\";\nimport { handleCancel, handlePromptCancel } from \"../prompts.js\";\nimport { Options } from \"../types.js\";\n\nexport type EnsureRepositoryExistsOptions = Pick<\n\tOptions,\n\t\"createRepository\" | \"owner\" | \"repository\"\n>;\n\nexport interface RepositoryExistsResult {\n\toctokit: Octokit | undefined;\n\trepository: string;\n}\n\nexport async function ensureRepositoryExists(\n\toctokit: Octokit | undefined,\n\toptions: EnsureRepositoryExistsOptions,\n): Promise<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 (octokit) {\n\t\tif (await doesRepositoryExist(octokit, options)) {\n\t\t\treturn { octokit, repository };\n\t\t}\n\n\t\tconst selection = createRepository\n\t\t\t? \"create\"\n\t\t\t: handlePromptCancel(\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 \"bail\":\n\t\t\t\thandleCancel();\n\t\t\t\tbreak;\n\n\t\t\tcase \"create\":\n\t\t\t\tawait 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 { octokit, repository };\n\n\t\t\tcase \"different\":\n\t\t\t\tconst newRepository = handlePromptCancel(\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\trepository = newRepository;\n\t\t\t\tbreak;\n\n\t\t\tcase \"local\":\n\t\t\t\toctokit = undefined;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn { octokit, repository };\n}\n"],"mappings":"AAAA,YAAY,aAAa;AAGzB,SAAS,2BAA2B;AACpC,SAAS,cAAc,0BAA0B;AAajD,eAAsB,uBACrB,SACA,SACkC;AAElC,MAAI,EAAE,kBAAkB,WAAW,IAAI;AAIvC,SAAO,SAAS;AACf,QAAI,MAAM,oBAAoB,SAAS,OAAO,GAAG;AAChD,aAAO,EAAE,SAAS,WAAW;AAAA,IAC9B;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;AACJ,qBAAa;AACb;AAAA,MAED,KAAK;AACJ,cAAM,QAAQ,KAAK,MAAM,oBAAoB;AAAA,UAC5C,MAAM;AAAA,UACN,OAAO,QAAQ;AAAA,UACf,gBAAgB;AAAA,UAChB,eAAe;AAAA,QAChB,CAAC;AACD,eAAO,EAAE,SAAS,WAAW;AAAA,MAE9B,KAAK;AACJ,cAAM,gBAAgB;AAAA,UACrB,MAAM,QAAQ,KAAK;AAAA,YAClB,SAAS;AAAA,UACV,CAAC;AAAA,QACF;AAEA,qBAAa;AACb;AAAA,MAED,KAAK;AACJ,kBAAU;AACV;AAAA,IACF;AAAA,EACD;AAEA,SAAO,EAAE,SAAS,WAAW;AAC9B;","names":[]}
@@ -0,0 +1,5 @@
1
+ import { Octokit } from 'octokit';
2
+
3
+ declare function getOctokit(): Promise<Octokit | undefined>;
4
+
5
+ export { getOctokit };
@@ -0,0 +1,17 @@
1
+ import { $ } from "execa";
2
+ import { Octokit } from "octokit";
3
+ async function getOctokit() {
4
+ try {
5
+ await $`gh auth status`;
6
+ } catch (error) {
7
+ throw new Error("GitHub authentication failed.", {
8
+ cause: error.message
9
+ });
10
+ }
11
+ const auth = (await $`gh auth token`).stdout.trim();
12
+ return new Octokit({ auth });
13
+ }
14
+ export {
15
+ getOctokit
16
+ };
17
+ //# sourceMappingURL=getOctokit.js.map
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1,3 @@
1
+ declare function getPrefillOrPromptedOption(existingValue: string | undefined, message: string, placeholder?: string): Promise<string>;
2
+
3
+ export { getPrefillOrPromptedOption };
@@ -0,0 +1,23 @@
1
+ import * as prompts from "@clack/prompts";
2
+ import { handlePromptCancel } from "../prompts.js";
3
+ async function getPrefillOrPromptedOption(existingValue, message, placeholder) {
4
+ if (existingValue) {
5
+ return existingValue;
6
+ }
7
+ const value = handlePromptCancel(
8
+ await prompts.text({
9
+ message,
10
+ placeholder,
11
+ validate: (val) => {
12
+ if (val.length === 0) {
13
+ return "Please enter a value.";
14
+ }
15
+ }
16
+ })
17
+ );
18
+ return value;
19
+ }
20
+ export {
21
+ getPrefillOrPromptedOption
22
+ };
23
+ //# sourceMappingURL=getPrefillOrPromptedOption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/shared/options/getPrefillOrPromptedOption.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\n\nimport { handlePromptCancel } from \"../prompts.js\";\n\nexport async function getPrefillOrPromptedOption(\n\texistingValue: string | undefined,\n\tmessage: string,\n\tplaceholder?: string,\n) {\n\tif (existingValue) {\n\t\treturn existingValue;\n\t}\n\n\tconst value = handlePromptCancel(\n\t\tawait prompts.text({\n\t\t\tmessage,\n\t\t\tplaceholder,\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,aACC;AACD,MAAI,eAAe;AAClB,WAAO;AAAA,EACR;AAEA,QAAM,QAAQ;AAAA,IACb,MAAM,QAAQ,KAAK;AAAA,MAClB;AAAA,MACA;AAAA,MACA,UAAU,CAAC,QAAQ;AAClB,YAAI,IAAI,WAAW,GAAG;AACrB,iBAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF;AAEA,SAAO;AACR;","names":[]}
@@ -0,0 +1,3 @@
1
+ declare function optionalDefault<T extends boolean | number | string>(value: T | undefined, getDefault?: (() => Promise<T | undefined>) | T | undefined): Promise<T | undefined>;
2
+
3
+ export { optionalDefault };
@@ -0,0 +1,13 @@
1
+ async function optionalDefault(value, getDefault) {
2
+ if (value !== void 0) {
3
+ return value;
4
+ }
5
+ if (typeof getDefault === "function") {
6
+ return await getDefault();
7
+ }
8
+ return getDefault;
9
+ }
10
+ export {
11
+ optionalDefault
12
+ };
13
+ //# sourceMappingURL=optionalDefault.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/shared/options/optionalDefault.ts"],"sourcesContent":["export async function optionalDefault<T extends boolean | number | string>(\n\tvalue: T | undefined,\n\tgetDefault?: (() => Promise<T | undefined>) | T | undefined,\n) {\n\tif (value !== undefined) {\n\t\treturn value;\n\t}\n\n\tif (typeof getDefault === \"function\") {\n\t\treturn await getDefault();\n\t}\n\n\treturn getDefault;\n}\n"],"mappings":"AAAA,eAAsB,gBACrB,OACA,YACC;AACD,MAAI,UAAU,QAAW;AACxB,WAAO;AAAA,EACR;AAEA,MAAI,OAAO,eAAe,YAAY;AACrC,WAAO,MAAM,WAAW;AAAA,EACzB;AAEA,SAAO;AACR;","names":[]}
@@ -0,0 +1,11 @@
1
+ declare function getGitAndNpmDefaults(): Promise<{
2
+ author: string | undefined;
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
+ }>;
10
+
11
+ export { getGitAndNpmDefaults };
@@ -0,0 +1,36 @@
1
+ import { $ } from "execa";
2
+ import gitRemoteOriginUrl from "git-remote-origin-url";
3
+ import gitUrlParse from "git-url-parse";
4
+ import fs from "node:fs/promises";
5
+ import npmUser from "npm-user";
6
+ import { readPackageData } from "../../packages.js";
7
+ import { tryCatchAsync } from "../../tryCatchAsync.js";
8
+ import { parsePackageAuthor } from "./parsePackageAuthor.js";
9
+ import { readTitleFromReadme } from "./readTitleFromReadme.js";
10
+ async function getGitAndNpmDefaults() {
11
+ const gitDefaults = await tryCatchAsync(
12
+ async () => gitUrlParse(await gitRemoteOriginUrl())
13
+ );
14
+ const npmDefaults = await tryCatchAsync(
15
+ async () => await npmUser((await $`npm whoami`).stdout)
16
+ );
17
+ const packageData = await readPackageData();
18
+ const packageAuthor = parsePackageAuthor(packageData);
19
+ return {
20
+ author: packageAuthor.author ?? npmDefaults?.name,
21
+ description: packageData.description,
22
+ email: npmDefaults?.email ?? packageAuthor.email ?? await tryCatchAsync(
23
+ async () => (await $`git config --get user.email`).stdout
24
+ ),
25
+ funding: await tryCatchAsync(
26
+ async () => (await fs.readFile(".github/FUNDING.yml")).toString().split(":")[1]?.trim()
27
+ ),
28
+ owner: gitDefaults?.organization ?? packageAuthor.author,
29
+ repository: gitDefaults?.name ?? packageData.name,
30
+ title: await readTitleFromReadme()
31
+ };
32
+ }
33
+ export {
34
+ getGitAndNpmDefaults
35
+ };
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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 async function getGitAndNpmDefaults() {\n\tconst gitDefaults = await tryCatchAsync(async () =>\n\t\tgitUrlParse(await gitRemoteOriginUrl()),\n\t);\n\n\tconst npmDefaults = await tryCatchAsync(\n\t\tasync () => await npmUser((await $`npm whoami`).stdout),\n\t);\n\n\tconst packageData = await readPackageData();\n\tconst packageAuthor = parsePackageAuthor(packageData);\n\n\treturn {\n\t\tauthor: packageAuthor.author ?? npmDefaults?.name,\n\t\tdescription: packageData.description,\n\t\temail:\n\t\t\tnpmDefaults?.email ??\n\t\t\tpackageAuthor.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: await tryCatchAsync(\n\t\t\tasync () =>\n\t\t\t\t(await fs.readFile(\".github/FUNDING.yml\"))\n\t\t\t\t\t.toString()\n\t\t\t\t\t.split(\":\")[1]\n\t\t\t\t\t?.trim(),\n\t\t),\n\t\towner: gitDefaults?.organization ?? packageAuthor.author,\n\t\trepository: gitDefaults?.name ?? packageData.name,\n\t\ttitle: await readTitleFromReadme(),\n\t};\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB,OAAO,wBAAwB;AAC/B,OAAO,iBAAiB;AACxB,OAAO,QAAQ;AACf,OAAO,aAAa;AAEpB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AAEpC,eAAsB,uBAAuB;AAC5C,QAAM,cAAc,MAAM;AAAA,IAAc,YACvC,YAAY,MAAM,mBAAmB,CAAC;AAAA,EACvC;AAEA,QAAM,cAAc,MAAM;AAAA,IACzB,YAAY,MAAM,SAAS,MAAM,eAAe,MAAM;AAAA,EACvD;AAEA,QAAM,cAAc,MAAM,gBAAgB;AAC1C,QAAM,gBAAgB,mBAAmB,WAAW;AAEpD,SAAO;AAAA,IACN,QAAQ,cAAc,UAAU,aAAa;AAAA,IAC7C,aAAa,YAAY;AAAA,IACzB,OACC,aAAa,SACb,cAAc,SACb,MAAM;AAAA,MACN,aAAa,MAAM,gCAAgC;AAAA,IACpD;AAAA,IACD,SAAS,MAAM;AAAA,MACd,aACE,MAAM,GAAG,SAAS,qBAAqB,GACtC,SAAS,EACT,MAAM,GAAG,EAAE,CAAC,GACX,KAAK;AAAA,IACV;AAAA,IACA,OAAO,aAAa,gBAAgB,cAAc;AAAA,IAClD,YAAY,aAAa,QAAQ,YAAY;AAAA,IAC7C,OAAO,MAAM,oBAAoB;AAAA,EAClC;AACD;","names":[]}
@@ -0,0 +1,8 @@
1
+ import { PartialPackageData } from '../../types.js';
2
+
3
+ declare function parsePackageAuthor(packageData: PartialPackageData): {
4
+ author: string | undefined;
5
+ email: string | undefined;
6
+ };
7
+
8
+ export { parsePackageAuthor };
@@ -0,0 +1,14 @@
1
+ function parsePackageAuthor(packageData) {
2
+ const [packageAuthor, packageEmail] = typeof packageData.author === "string" ? [
3
+ packageData.author.split("<")[0].trim(),
4
+ packageData.author.split(/<|>/)[1]?.trim()
5
+ ] : [packageData.author?.name, packageData.author?.email];
6
+ return {
7
+ author: packageAuthor,
8
+ email: packageEmail
9
+ };
10
+ }
11
+ export {
12
+ parsePackageAuthor
13
+ };
14
+ //# sourceMappingURL=parsePackageAuthor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/shared/options/readGitAndNpmDefaults/parsePackageAuthor.ts"],"sourcesContent":["import { PartialPackageData } from \"../../types.js\";\n\nexport function parsePackageAuthor(packageData: PartialPackageData) {\n\tconst [packageAuthor, packageEmail] =\n\t\ttypeof packageData.author === \"string\"\n\t\t\t? [\n\t\t\t\t\tpackageData.author.split(\"<\")[0].trim(),\n\t\t\t\t\tpackageData.author.split(/<|>/)[1]?.trim(),\n\t\t\t ]\n\t\t\t: [packageData.author?.name, packageData.author?.email];\n\n\treturn {\n\t\tauthor: packageAuthor,\n\t\temail: packageEmail,\n\t};\n}\n"],"mappings":"AAEO,SAAS,mBAAmB,aAAiC;AACnE,QAAM,CAAC,eAAe,YAAY,IACjC,OAAO,YAAY,WAAW,WAC3B;AAAA,IACA,YAAY,OAAO,MAAM,GAAG,EAAE,CAAC,EAAE,KAAK;AAAA,IACtC,YAAY,OAAO,MAAM,KAAK,EAAE,CAAC,GAAG,KAAK;AAAA,EACzC,IACA,CAAC,YAAY,QAAQ,MAAM,YAAY,QAAQ,KAAK;AAExD,SAAO;AAAA,IACN,QAAQ;AAAA,IACR,OAAO;AAAA,EACR;AACD;","names":[]}
@@ -0,0 +1,3 @@
1
+ declare function readTitleFromReadme(): Promise<string | undefined>;
2
+
3
+ export { readTitleFromReadme };
@@ -0,0 +1,8 @@
1
+ import { readFileSafe } from "../../readFileSafe.js";
2
+ async function readTitleFromReadme() {
3
+ return (await readFileSafe("./README.md", "")).match(/^(?:# |<h1\s+align="center">)(.*?)(?:<\/h1>)?$/i)?.[1]?.trim().replace(/<[^>]+(?:>|$)/g, "");
4
+ }
5
+ export {
6
+ readTitleFromReadme
7
+ };
8
+ //# sourceMappingURL=readTitleFromReadme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/shared/options/readGitAndNpmDefaults/readTitleFromReadme.ts"],"sourcesContent":["import { readFileSafe } from \"../../readFileSafe.js\";\n\nexport async function readTitleFromReadme() {\n\treturn (await readFileSafe(\"./README.md\", \"\"))\n\t\t.match(/^(?:# |<h1\\s+align=\"center\">)(.*?)(?:<\\/h1>)?$/i)?.[1]\n\t\t?.trim()\n\t\t.replace(/<[^>]+(?:>|$)/g, \"\");\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,eAAsB,sBAAsB;AAC3C,UAAQ,MAAM,aAAa,eAAe,EAAE,GAC1C,MAAM,iDAAiD,IAAI,CAAC,GAC3D,KAAK,EACN,QAAQ,kBAAkB,EAAE;AAC/B;","names":[]}
@@ -0,0 +1,10 @@
1
+ import { Octokit } from 'octokit';
2
+ import { Options } from '../types.js';
3
+
4
+ interface OctokitAndOptions {
5
+ octokit: Octokit | undefined;
6
+ options: Options;
7
+ }
8
+ declare function readOptions(args: string[]): Promise<OctokitAndOptions>;
9
+
10
+ export { OctokitAndOptions, readOptions };
@@ -0,0 +1,83 @@
1
+ import { parseArgs } from "node:util";
2
+ import { titleCase } from "title-case";
3
+ import { withSpinner } from "../cli/spinners.js";
4
+ import { allArgOptions } from "./args.js";
5
+ import { augmentOptionsWithExcludes } from "./augmentOptionsWithExcludes.js";
6
+ import { ensureRepositoryExists } from "./ensureRepositoryExists.js";
7
+ import { getOctokit } from "./getOctokit.js";
8
+ import { getPrefillOrPromptedOption } from "./getPrefillOrPromptedOption.js";
9
+ import { optionalDefault } from "./optionalDefault.js";
10
+ import { getGitAndNpmDefaults } from "./readGitAndNpmDefaults/index.js";
11
+ async function readOptions(args) {
12
+ const defaults = await getGitAndNpmDefaults();
13
+ const { values } = parseArgs({
14
+ args,
15
+ options: allArgOptions,
16
+ strict: false,
17
+ tokens: true
18
+ });
19
+ const owner = await getPrefillOrPromptedOption(
20
+ values.owner,
21
+ "What organization or user will the repository be under?",
22
+ defaults.owner
23
+ );
24
+ const { octokit, repository } = await ensureRepositoryExists(
25
+ values["skip-github-api"] ? void 0 : await withSpinner("Checking GitHub authentication", getOctokit),
26
+ {
27
+ createRepository: values["create-repository"],
28
+ owner,
29
+ repository: await getPrefillOrPromptedOption(
30
+ values.repository,
31
+ "What will the kebab-case name of the repository be?",
32
+ defaults.repository
33
+ )
34
+ }
35
+ );
36
+ return {
37
+ octokit,
38
+ options: await augmentOptionsWithExcludes({
39
+ author: values.author ?? defaults.author ?? owner.toLowerCase(),
40
+ base: values.base,
41
+ createRepository: values["create-repository"],
42
+ description: await getPrefillOrPromptedOption(
43
+ values.description,
44
+ "How would you describe the new package?",
45
+ defaults.description ?? "A very lovely package. Hooray!"
46
+ ),
47
+ email: values.email ?? defaults.email,
48
+ excludeCompliance: values["exclude-compliance"],
49
+ excludeContributors: values["exclude-contributors"],
50
+ excludeLintJson: values["exclude-lint-json"],
51
+ excludeLintKnip: values["exclude-lint-knip"],
52
+ excludeLintMd: values["exclude-lint-md"],
53
+ excludeLintPackageJson: values["exclude-lint-package-json"],
54
+ excludeLintPackages: values["exclude-lint-packages"],
55
+ excludeLintPerfectionist: values["exclude-lint-perfectionist"],
56
+ excludeLintSpelling: values["exclude-lint-spelling"],
57
+ excludeLintYml: values["exclude-lint-yml"],
58
+ excludeReleases: values["exclude-releases"],
59
+ excludeRenovate: values["exclude-renovate"],
60
+ excludeTests: values["unit-tests"],
61
+ funding: await optionalDefault(
62
+ values.funding,
63
+ defaults.funding
64
+ ),
65
+ owner,
66
+ repository,
67
+ skipGitHubApi: !!values["skip-github-api"],
68
+ skipInstall: !!values["skip-install"],
69
+ skipRemoval: !!values["skip-removal"],
70
+ skipRestore: values["skip-restore"],
71
+ skipUninstall: !!values["skip-uninstall"],
72
+ title: await getPrefillOrPromptedOption(
73
+ values.title,
74
+ "What will the Title Case title of the repository be?",
75
+ defaults.title ?? titleCase(repository).replaceAll("-", " ")
76
+ )
77
+ })
78
+ };
79
+ }
80
+ export {
81
+ readOptions
82
+ };
83
+ //# sourceMappingURL=readOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/shared/options/readOptions.ts"],"sourcesContent":["import { parseArgs } from \"node:util\";\nimport { Octokit } from \"octokit\";\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 { getOctokit } from \"./getOctokit.js\";\nimport { getPrefillOrPromptedOption } from \"./getPrefillOrPromptedOption.js\";\nimport { optionalDefault } from \"./optionalDefault.js\";\nimport { getGitAndNpmDefaults } from \"./readGitAndNpmDefaults/index.js\";\n\nexport interface OctokitAndOptions {\n\toctokit: Octokit | undefined;\n\toptions: Options;\n}\n\nexport async function readOptions(args: string[]): Promise<OctokitAndOptions> {\n\tconst defaults = await 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 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\n\tconst { octokit, repository } = await ensureRepositoryExists(\n\t\tvalues[\"skip-github-api\"]\n\t\t\t? undefined\n\t\t\t: await withSpinner(\"Checking GitHub authentication\", getOctokit),\n\t\t{\n\t\t\tcreateRepository: values[\"create-repository\"] as boolean | undefined,\n\t\t\towner,\n\t\t\trepository: await getPrefillOrPromptedOption(\n\t\t\t\tvalues.repository as string | undefined,\n\t\t\t\t\"What will the kebab-case name of the repository be?\",\n\t\t\t\tdefaults.repository,\n\t\t\t),\n\t\t},\n\t);\n\n\treturn {\n\t\toctokit,\n\t\toptions: await augmentOptionsWithExcludes({\n\t\t\tauthor:\n\t\t\t\t(values.author as string | undefined) ??\n\t\t\t\tdefaults.author ??\n\t\t\t\towner.toLowerCase(),\n\t\t\tbase: values.base as InputBase,\n\t\t\tcreateRepository: values[\"create-repository\"] as boolean | undefined,\n\t\t\tdescription: await getPrefillOrPromptedOption(\n\t\t\t\tvalues.description as string | undefined,\n\t\t\t\t\"How would you describe the new package?\",\n\t\t\t\tdefaults.description ?? \"A very lovely package. Hooray!\",\n\t\t\t),\n\t\t\temail: (values.email as string | undefined) ?? defaults.email,\n\t\t\texcludeCompliance: values[\"exclude-compliance\"] as boolean | undefined,\n\t\t\texcludeContributors: values[\"exclude-contributors\"] as\n\t\t\t\t| boolean\n\t\t\t\t| undefined,\n\t\t\texcludeLintJson: values[\"exclude-lint-json\"] as boolean | undefined,\n\t\t\texcludeLintKnip: values[\"exclude-lint-knip\"] as boolean | undefined,\n\t\t\texcludeLintMd: values[\"exclude-lint-md\"] as boolean | undefined,\n\t\t\texcludeLintPackageJson: values[\"exclude-lint-package-json\"] as\n\t\t\t\t| boolean\n\t\t\t\t| undefined,\n\t\t\texcludeLintPackages: values[\"exclude-lint-packages\"] as\n\t\t\t\t| boolean\n\t\t\t\t| undefined,\n\t\t\texcludeLintPerfectionist: values[\"exclude-lint-perfectionist\"] as\n\t\t\t\t| boolean\n\t\t\t\t| undefined,\n\t\t\texcludeLintSpelling: values[\"exclude-lint-spelling\"] as\n\t\t\t\t| boolean\n\t\t\t\t| undefined,\n\t\t\texcludeLintYml: values[\"exclude-lint-yml\"] as boolean | undefined,\n\t\t\texcludeReleases: values[\"exclude-releases\"] as boolean | undefined,\n\t\t\texcludeRenovate: values[\"exclude-renovate\"] as boolean | undefined,\n\t\t\texcludeTests: values[\"unit-tests\"] as boolean | undefined,\n\t\t\tfunding: await optionalDefault(\n\t\t\t\tvalues.funding as string | undefined,\n\t\t\t\tdefaults.funding,\n\t\t\t),\n\t\t\towner,\n\t\t\trepository: repository,\n\t\t\tskipGitHubApi: !!values[\"skip-github-api\"],\n\t\t\tskipInstall: !!values[\"skip-install\"],\n\t\t\tskipRemoval: !!values[\"skip-removal\"],\n\t\t\tskipRestore: values[\"skip-restore\"] as boolean | undefined,\n\t\t\tskipUninstall: !!values[\"skip-uninstall\"],\n\t\t\ttitle: await getPrefillOrPromptedOption(\n\t\t\t\tvalues.title as string | undefined,\n\t\t\t\t\"What will the Title Case title of the repository be?\",\n\t\t\t\tdefaults.title ?? titleCase(repository).replaceAll(\"-\", \" \"),\n\t\t\t),\n\t\t}),\n\t};\n}\n"],"mappings":"AAAA,SAAS,iBAAiB;AAE1B,SAAS,iBAAiB;AAE1B,SAAS,mBAAmB;AAE5B,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAC3C,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;AAC3B,SAAS,kCAAkC;AAC3C,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AAOrC,eAAsB,YAAY,MAA4C;AAC7E,QAAM,WAAW,MAAM,qBAAqB;AAC5C,QAAM,EAAE,OAAO,IAAI,UAAU;AAAA,IAC5B;AAAA,IACA,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,EACT,CAAC;AAED,QAAM,QAAQ,MAAM;AAAA,IACnB,OAAO;AAAA,IACP;AAAA,IACA,SAAS;AAAA,EACV;AAEA,QAAM,EAAE,SAAS,WAAW,IAAI,MAAM;AAAA,IACrC,OAAO,iBAAiB,IACrB,SACA,MAAM,YAAY,kCAAkC,UAAU;AAAA,IACjE;AAAA,MACC,kBAAkB,OAAO,mBAAmB;AAAA,MAC5C;AAAA,MACA,YAAY,MAAM;AAAA,QACjB,OAAO;AAAA,QACP;AAAA,QACA,SAAS;AAAA,MACV;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AAAA,IACN;AAAA,IACA,SAAS,MAAM,2BAA2B;AAAA,MACzC,QACE,OAAO,UACR,SAAS,UACT,MAAM,YAAY;AAAA,MACnB,MAAM,OAAO;AAAA,MACb,kBAAkB,OAAO,mBAAmB;AAAA,MAC5C,aAAa,MAAM;AAAA,QAClB,OAAO;AAAA,QACP;AAAA,QACA,SAAS,eAAe;AAAA,MACzB;AAAA,MACA,OAAQ,OAAO,SAAgC,SAAS;AAAA,MACxD,mBAAmB,OAAO,oBAAoB;AAAA,MAC9C,qBAAqB,OAAO,sBAAsB;AAAA,MAGlD,iBAAiB,OAAO,mBAAmB;AAAA,MAC3C,iBAAiB,OAAO,mBAAmB;AAAA,MAC3C,eAAe,OAAO,iBAAiB;AAAA,MACvC,wBAAwB,OAAO,2BAA2B;AAAA,MAG1D,qBAAqB,OAAO,uBAAuB;AAAA,MAGnD,0BAA0B,OAAO,4BAA4B;AAAA,MAG7D,qBAAqB,OAAO,uBAAuB;AAAA,MAGnD,gBAAgB,OAAO,kBAAkB;AAAA,MACzC,iBAAiB,OAAO,kBAAkB;AAAA,MAC1C,iBAAiB,OAAO,kBAAkB;AAAA,MAC1C,cAAc,OAAO,YAAY;AAAA,MACjC,SAAS,MAAM;AAAA,QACd,OAAO;AAAA,QACP,SAAS;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAe,CAAC,CAAC,OAAO,iBAAiB;AAAA,MACzC,aAAa,CAAC,CAAC,OAAO,cAAc;AAAA,MACpC,aAAa,CAAC,CAAC,OAAO,cAAc;AAAA,MACpC,aAAa,OAAO,cAAc;AAAA,MAClC,eAAe,CAAC,CAAC,OAAO,gBAAgB;AAAA,MACxC,OAAO,MAAM;AAAA,QACZ,OAAO;AAAA,QACP;AAAA,QACA,SAAS,SAAS,UAAU,UAAU,EAAE,WAAW,KAAK,GAAG;AAAA,MAC5D;AAAA,IACD,CAAC;AAAA,EACF;AACD;","names":[]}
@@ -0,0 +1,6 @@
1
+ import { PartialPackageData } from './types.js';
2
+
3
+ declare function readPackageData(): Promise<PartialPackageData>;
4
+ declare function removeDependencies(packageNames: string[], existing?: Record<string, string>, flags?: string): Promise<void>;
5
+
6
+ export { readPackageData, removeDependencies };
@@ -0,0 +1,20 @@
1
+ import { execaCommand } from "execa";
2
+ import { readFileSafe } from "./readFileSafe.js";
3
+ async function readPackageData() {
4
+ return JSON.parse(
5
+ await readFileSafe("./package.json", "{}")
6
+ );
7
+ }
8
+ async function removeDependencies(packageNames, existing = {}, flags = "") {
9
+ const present = packageNames.filter((packageName) => packageName in existing);
10
+ if (present.length) {
11
+ await execaCommand(
12
+ `pnpm remove ${present.join(" ")}${flags ? ` ${flags}` : ""}`
13
+ );
14
+ }
15
+ }
16
+ export {
17
+ readPackageData,
18
+ removeDependencies
19
+ };
20
+ //# sourceMappingURL=packages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/shared/packages.ts"],"sourcesContent":["import { execaCommand } from \"execa\";\n\nimport { readFileSafe } from \"./readFileSafe.js\";\nimport { PartialPackageData } from \"./types.js\";\n\nexport async function readPackageData() {\n\treturn JSON.parse(\n\t\tawait readFileSafe(\"./package.json\", \"{}\"),\n\t) as PartialPackageData;\n}\n\nexport async function removeDependencies(\n\tpackageNames: string[],\n\texisting: Record<string, string> = {},\n\tflags = \"\",\n) {\n\tconst present = packageNames.filter((packageName) => packageName in existing);\n\n\tif (present.length) {\n\t\tawait execaCommand(\n\t\t\t`pnpm remove ${present.join(\" \")}${flags ? ` ${flags}` : \"\"}`,\n\t\t);\n\t}\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,SAAS,oBAAoB;AAG7B,eAAsB,kBAAkB;AACvC,SAAO,KAAK;AAAA,IACX,MAAM,aAAa,kBAAkB,IAAI;AAAA,EAC1C;AACD;AAEA,eAAsB,mBACrB,cACA,WAAmC,CAAC,GACpC,QAAQ,IACP;AACD,QAAM,UAAU,aAAa,OAAO,CAAC,gBAAgB,eAAe,QAAQ;AAE5E,MAAI,QAAQ,QAAQ;AACnB,UAAM;AAAA,MACL,eAAe,QAAQ,KAAK,GAAG,CAAC,GAAG,QAAQ,IAAI,KAAK,KAAK,EAAE;AAAA,IAC5D;AAAA,EACD;AACD;","names":[]}
@@ -0,0 +1,4 @@
1
+ declare function handleCancel(): never;
2
+ declare function handlePromptCancel<Value>(value: Value): Exclude<Value, symbol>;
3
+
4
+ export { handleCancel, handlePromptCancel };
@@ -0,0 +1,16 @@
1
+ import * as prompts from "@clack/prompts";
2
+ function handleCancel() {
3
+ prompts.cancel("Operation cancelled. Exiting - maybe another time? \u{1F44B}");
4
+ process.exit(1);
5
+ }
6
+ function handlePromptCancel(value) {
7
+ if (prompts.isCancel(value)) {
8
+ handleCancel();
9
+ }
10
+ return value;
11
+ }
12
+ export {
13
+ handleCancel,
14
+ handlePromptCancel
15
+ };
16
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/shared/prompts.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\n\nexport function handleCancel(): never {\n\tprompts.cancel(\"Operation cancelled. Exiting - maybe another time? 👋\");\n\t// eslint-disable-next-line n/no-process-exit\n\tprocess.exit(1);\n}\n\nexport function handlePromptCancel<Value>(value: Value) {\n\tif (prompts.isCancel(value)) {\n\t\thandleCancel();\n\t}\n\n\treturn value as Exclude<Value, symbol>;\n}\n"],"mappings":"AAAA,YAAY,aAAa;AAElB,SAAS,eAAsB;AACrC,UAAQ,OAAO,8DAAuD;AAEtE,UAAQ,KAAK,CAAC;AACf;AAEO,SAAS,mBAA0B,OAAc;AACvD,MAAI,QAAQ,SAAS,KAAK,GAAG;AAC5B,iBAAa;AAAA,EACd;AAEA,SAAO;AACR;","names":[]}
@@ -0,0 +1,3 @@
1
+ declare function readFileAsJson(filePath: string): Promise<unknown>;
2
+
3
+ export { readFileAsJson };
@@ -0,0 +1,15 @@
1
+ import * as fs from "node:fs/promises";
2
+ async function readFileAsJson(filePath) {
3
+ try {
4
+ return JSON.parse((await fs.readFile(filePath)).toString());
5
+ } catch (error) {
6
+ throw new Error(
7
+ `Could not read file from ${filePath} as JSON. Please ensure the file exists and is valid JSON.`,
8
+ { cause: error }
9
+ );
10
+ }
11
+ }
12
+ export {
13
+ readFileAsJson
14
+ };
15
+ //# sourceMappingURL=readFileAsJson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/shared/readFileAsJson.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\n\nexport async function readFileAsJson(filePath: string) {\n\ttry {\n\t\treturn JSON.parse((await fs.readFile(filePath)).toString()) as unknown;\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Could not read file from ${filePath} as JSON. Please ensure the file exists and is valid JSON.`,\n\t\t\t{ cause: error },\n\t\t);\n\t}\n}\n"],"mappings":"AAAA,YAAY,QAAQ;AAEpB,eAAsB,eAAe,UAAkB;AACtD,MAAI;AACH,WAAO,KAAK,OAAO,MAAM,GAAG,SAAS,QAAQ,GAAG,SAAS,CAAC;AAAA,EAC3D,SAAS,OAAO;AACf,UAAM,IAAI;AAAA,MACT,4BAA4B,QAAQ;AAAA,MACpC,EAAE,OAAO,MAAM;AAAA,IAChB;AAAA,EACD;AACD;","names":[]}
@@ -0,0 +1,3 @@
1
+ declare function readFileSafe(filePath: string, fallback: string): Promise<string>;
2
+
3
+ export { readFileSafe };
@@ -0,0 +1,12 @@
1
+ import fs from "node:fs/promises";
2
+ async function readFileSafe(filePath, fallback) {
3
+ try {
4
+ return (await fs.readFile(filePath)).toString();
5
+ } catch {
6
+ return fallback;
7
+ }
8
+ }
9
+ export {
10
+ readFileSafe
11
+ };
12
+ //# sourceMappingURL=readFileSafe.js.map