create-typescript-app 1.76.0 → 1.77.1

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 (285) hide show
  1. package/README.md +1 -1
  2. package/lib/bin/promptForMode.js +2 -1
  3. package/lib/bin/promptForMode.js.map +1 -1
  4. package/lib/create/createWithOptions.d.ts +3 -4
  5. package/lib/create/createWithOptions.js +19 -12
  6. package/lib/create/createWithOptions.js.map +1 -1
  7. package/lib/index.d.ts +45 -0
  8. package/lib/index.js +5 -0
  9. package/lib/index.js.map +1 -1
  10. package/lib/initialize/initializeWithOptions.d.ts +3 -4
  11. package/lib/initialize/initializeWithOptions.js +4 -4
  12. package/lib/initialize/initializeWithOptions.js.map +1 -1
  13. package/lib/migrate/migrateWithOptions.d.ts +3 -4
  14. package/lib/migrate/migrateWithOptions.js +8 -5
  15. package/lib/migrate/migrateWithOptions.js.map +1 -1
  16. package/lib/next/base.d.ts +101 -0
  17. package/lib/next/base.js +144 -0
  18. package/lib/next/base.js.map +1 -0
  19. package/lib/next/blocks/blockAllContributors.d.ts +48 -0
  20. package/lib/next/blocks/blockAllContributors.js +60 -0
  21. package/lib/next/blocks/blockAllContributors.js.map +1 -0
  22. package/lib/next/blocks/blockAreTheTypesWrong.d.ts +48 -0
  23. package/lib/next/blocks/blockAreTheTypesWrong.js +29 -0
  24. package/lib/next/blocks/blockAreTheTypesWrong.js.map +1 -0
  25. package/lib/next/blocks/blockCSpell.d.ts +51 -0
  26. package/lib/next/blocks/blockCSpell.js +72 -0
  27. package/lib/next/blocks/blockCSpell.js.map +1 -0
  28. package/lib/next/blocks/blockContributingDocs.d.ts +48 -0
  29. package/lib/next/blocks/blockContributingDocs.js +127 -0
  30. package/lib/next/blocks/blockContributingDocs.js.map +1 -0
  31. package/lib/next/blocks/blockContributorCovenant.d.ts +48 -0
  32. package/lib/next/blocks/blockContributorCovenant.js +162 -0
  33. package/lib/next/blocks/blockContributorCovenant.js.map +1 -0
  34. package/lib/next/blocks/blockDevelopmentDocs.d.ts +62 -0
  35. package/lib/next/blocks/blockDevelopmentDocs.js +92 -0
  36. package/lib/next/blocks/blockDevelopmentDocs.js.map +1 -0
  37. package/lib/next/blocks/blockESLint.d.ts +73 -0
  38. package/lib/next/blocks/blockESLint.js +242 -0
  39. package/lib/next/blocks/blockESLint.js.map +1 -0
  40. package/lib/next/blocks/blockESLintComments.d.ts +48 -0
  41. package/lib/next/blocks/blockESLintComments.js +26 -0
  42. package/lib/next/blocks/blockESLintComments.js.map +1 -0
  43. package/lib/next/blocks/blockESLintJSDoc.d.ts +48 -0
  44. package/lib/next/blocks/blockESLintJSDoc.js +25 -0
  45. package/lib/next/blocks/blockESLintJSDoc.js.map +1 -0
  46. package/lib/next/blocks/blockESLintJSONC.d.ts +48 -0
  47. package/lib/next/blocks/blockESLintJSONC.js +21 -0
  48. package/lib/next/blocks/blockESLintJSONC.js.map +1 -0
  49. package/lib/next/blocks/blockESLintMarkdown.d.ts +48 -0
  50. package/lib/next/blocks/blockESLintMarkdown.js +27 -0
  51. package/lib/next/blocks/blockESLintMarkdown.js.map +1 -0
  52. package/lib/next/blocks/blockESLintMoreStyling.d.ts +48 -0
  53. package/lib/next/blocks/blockESLintMoreStyling.js +34 -0
  54. package/lib/next/blocks/blockESLintMoreStyling.js.map +1 -0
  55. package/lib/next/blocks/blockESLintNode.d.ts +48 -0
  56. package/lib/next/blocks/blockESLintNode.js +33 -0
  57. package/lib/next/blocks/blockESLintNode.js.map +1 -0
  58. package/lib/next/blocks/blockESLintPackageJson.d.ts +48 -0
  59. package/lib/next/blocks/blockESLintPackageJson.js +26 -0
  60. package/lib/next/blocks/blockESLintPackageJson.js.map +1 -0
  61. package/lib/next/blocks/blockESLintPerfectionist.d.ts +48 -0
  62. package/lib/next/blocks/blockESLintPerfectionist.js +32 -0
  63. package/lib/next/blocks/blockESLintPerfectionist.js.map +1 -0
  64. package/lib/next/blocks/blockESLintRegexp.d.ts +48 -0
  65. package/lib/next/blocks/blockESLintRegexp.js +23 -0
  66. package/lib/next/blocks/blockESLintRegexp.js.map +1 -0
  67. package/lib/next/blocks/blockESLintYML.d.ts +48 -0
  68. package/lib/next/blocks/blockESLintYML.js +46 -0
  69. package/lib/next/blocks/blockESLintYML.js.map +1 -0
  70. package/lib/next/blocks/blockExampleFiles.d.ts +50 -0
  71. package/lib/next/blocks/blockExampleFiles.js +25 -0
  72. package/lib/next/blocks/blockExampleFiles.js.map +1 -0
  73. package/lib/next/blocks/blockFunding.d.ts +48 -0
  74. package/lib/next/blocks/blockFunding.js +20 -0
  75. package/lib/next/blocks/blockFunding.js.map +1 -0
  76. package/lib/next/blocks/blockGitHubActionsCI.d.ts +60 -0
  77. package/lib/next/blocks/blockGitHubActionsCI.js +133 -0
  78. package/lib/next/blocks/blockGitHubActionsCI.js.map +1 -0
  79. package/lib/next/blocks/blockGitHubIssueTemplates.d.ts +48 -0
  80. package/lib/next/blocks/blockGitHubIssueTemplates.js +217 -0
  81. package/lib/next/blocks/blockGitHubIssueTemplates.js.map +1 -0
  82. package/lib/next/blocks/blockGitHubPRTemplate.d.ts +48 -0
  83. package/lib/next/blocks/blockGitHubPRTemplate.js +32 -0
  84. package/lib/next/blocks/blockGitHubPRTemplate.js.map +1 -0
  85. package/lib/next/blocks/blockGitignore.d.ts +50 -0
  86. package/lib/next/blocks/blockGitignore.js +23 -0
  87. package/lib/next/blocks/blockGitignore.js.map +1 -0
  88. package/lib/next/blocks/blockKnip.d.ts +48 -0
  89. package/lib/next/blocks/blockKnip.js +58 -0
  90. package/lib/next/blocks/blockKnip.js.map +1 -0
  91. package/lib/next/blocks/blockMITLicense.d.ts +48 -0
  92. package/lib/next/blocks/blockMITLicense.js +46 -0
  93. package/lib/next/blocks/blockMITLicense.js.map +1 -0
  94. package/lib/next/blocks/blockMarkdownlint.d.ts +50 -0
  95. package/lib/next/blocks/blockMarkdownlint.js +77 -0
  96. package/lib/next/blocks/blockMarkdownlint.js.map +1 -0
  97. package/lib/next/blocks/blockNvmrc.d.ts +48 -0
  98. package/lib/next/blocks/blockNvmrc.js +26 -0
  99. package/lib/next/blocks/blockNvmrc.js.map +1 -0
  100. package/lib/next/blocks/blockPRCompliance.d.ts +48 -0
  101. package/lib/next/blocks/blockPRCompliance.js +48 -0
  102. package/lib/next/blocks/blockPRCompliance.js.map +1 -0
  103. package/lib/next/blocks/blockPackageJson.d.ts +57 -0
  104. package/lib/next/blocks/blockPackageJson.js +92 -0
  105. package/lib/next/blocks/blockPackageJson.js.map +1 -0
  106. package/lib/next/blocks/blockPnpmDedupe.d.ts +48 -0
  107. package/lib/next/blocks/blockPnpmDedupe.js +46 -0
  108. package/lib/next/blocks/blockPnpmDedupe.js.map +1 -0
  109. package/lib/next/blocks/blockPrettier.d.ts +57 -0
  110. package/lib/next/blocks/blockPrettier.js +114 -0
  111. package/lib/next/blocks/blockPrettier.js.map +1 -0
  112. package/lib/next/blocks/blockPrettierPluginCurly.d.ts +48 -0
  113. package/lib/next/blocks/blockPrettierPluginCurly.js +20 -0
  114. package/lib/next/blocks/blockPrettierPluginCurly.js.map +1 -0
  115. package/lib/next/blocks/blockPrettierPluginPackageJson.d.ts +48 -0
  116. package/lib/next/blocks/blockPrettierPluginPackageJson.js +20 -0
  117. package/lib/next/blocks/blockPrettierPluginPackageJson.js.map +1 -0
  118. package/lib/next/blocks/blockPrettierPluginSh.d.ts +48 -0
  119. package/lib/next/blocks/blockPrettierPluginSh.js +20 -0
  120. package/lib/next/blocks/blockPrettierPluginSh.js.map +1 -0
  121. package/lib/next/blocks/blockREADME.d.ts +50 -0
  122. package/lib/next/blocks/blockREADME.js +63 -0
  123. package/lib/next/blocks/blockREADME.js.map +1 -0
  124. package/lib/next/blocks/blockReleaseIt.d.ts +48 -0
  125. package/lib/next/blocks/blockReleaseIt.js +131 -0
  126. package/lib/next/blocks/blockReleaseIt.js.map +1 -0
  127. package/lib/next/blocks/blockRenovate.d.ts +48 -0
  128. package/lib/next/blocks/blockRenovate.js +34 -0
  129. package/lib/next/blocks/blockRenovate.js.map +1 -0
  130. package/lib/next/blocks/blockRepositoryBranchProtection.d.ts +50 -0
  131. package/lib/next/blocks/blockRepositoryBranchProtection.js +49 -0
  132. package/lib/next/blocks/blockRepositoryBranchProtection.js.map +1 -0
  133. package/lib/next/blocks/blockRepositoryLabels.d.ts +48 -0
  134. package/lib/next/blocks/blockRepositoryLabels.js +18 -0
  135. package/lib/next/blocks/blockRepositoryLabels.js.map +1 -0
  136. package/lib/next/blocks/blockRepositorySettings.d.ts +48 -0
  137. package/lib/next/blocks/blockRepositorySettings.js +42 -0
  138. package/lib/next/blocks/blockRepositorySettings.js.map +1 -0
  139. package/lib/next/blocks/blockSecurityDocs.d.ts +48 -0
  140. package/lib/next/blocks/blockSecurityDocs.js +28 -0
  141. package/lib/next/blocks/blockSecurityDocs.js.map +1 -0
  142. package/lib/next/blocks/blockTSup.d.ts +50 -0
  143. package/lib/next/blocks/blockTSup.js +95 -0
  144. package/lib/next/blocks/blockTSup.js.map +1 -0
  145. package/lib/next/blocks/blockTemplatedBy.d.ts +48 -0
  146. package/lib/next/blocks/blockTemplatedBy.js +30 -0
  147. package/lib/next/blocks/blockTemplatedBy.js.map +1 -0
  148. package/lib/next/blocks/blockTypeScript.d.ts +48 -0
  149. package/lib/next/blocks/blockTypeScript.js +137 -0
  150. package/lib/next/blocks/blockTypeScript.js.map +1 -0
  151. package/lib/next/blocks/blockVSCode.d.ts +57 -0
  152. package/lib/next/blocks/blockVSCode.js +91 -0
  153. package/lib/next/blocks/blockVSCode.js.map +1 -0
  154. package/lib/next/blocks/blockVitest.d.ts +55 -0
  155. package/lib/next/blocks/blockVitest.js +217 -0
  156. package/lib/next/blocks/blockVitest.js.map +1 -0
  157. package/lib/next/blocks/index.d.ts +43 -0
  158. package/lib/next/blocks/index.js +43 -0
  159. package/lib/next/blocks/index.js.map +1 -0
  160. package/lib/next/blocks/options.fakes.d.ts +13 -0
  161. package/lib/next/blocks/options.fakes.js +15 -0
  162. package/lib/next/blocks/options.fakes.js.map +1 -0
  163. package/lib/next/blocks/packageData.d.ts +5 -0
  164. package/lib/next/blocks/packageData.js +25 -0
  165. package/lib/next/blocks/packageData.js.map +1 -0
  166. package/lib/next/blocks/phases.d.ts +9 -0
  167. package/lib/next/blocks/phases.js +11 -0
  168. package/lib/next/blocks/phases.js.map +1 -0
  169. package/lib/next/presetCommon.d.ts +99 -0
  170. package/lib/next/presetCommon.js +21 -0
  171. package/lib/next/presetCommon.js.map +1 -0
  172. package/lib/next/presetEverything.d.ts +99 -0
  173. package/lib/next/presetEverything.js +59 -0
  174. package/lib/next/presetEverything.js.map +1 -0
  175. package/lib/next/presetMinimal.d.ts +99 -0
  176. package/lib/next/presetMinimal.js +53 -0
  177. package/lib/next/presetMinimal.js.map +1 -0
  178. package/lib/next/runCreateEnginePreset.d.ts +7 -0
  179. package/lib/next/runCreateEnginePreset.js +20 -0
  180. package/lib/next/runCreateEnginePreset.js.map +1 -0
  181. package/lib/next/template.d.ts +99 -0
  182. package/lib/next/template.js +21 -0
  183. package/lib/next/template.js.map +1 -0
  184. package/lib/next/utils/sortObject.d.ts +5 -0
  185. package/lib/next/utils/sortObject.js +9 -0
  186. package/lib/next/utils/sortObject.js.map +1 -0
  187. package/lib/next/utils/swallowError.d.ts +3 -0
  188. package/lib/next/utils/swallowError.js +7 -0
  189. package/lib/next/utils/swallowError.js.map +1 -0
  190. package/lib/shared/isUsingCreateEngine.d.ts +3 -0
  191. package/lib/shared/isUsingCreateEngine.js +7 -0
  192. package/lib/shared/isUsingCreateEngine.js.map +1 -0
  193. package/lib/shared/options/createOptionDefaults/index.d.ts +2 -4
  194. package/lib/shared/options/createOptionDefaults/index.js +4 -13
  195. package/lib/shared/options/createOptionDefaults/index.js.map +1 -1
  196. package/lib/shared/options/createOptionDefaults/readDefaultsFromReadme.js +4 -1
  197. package/lib/shared/options/createOptionDefaults/readDefaultsFromReadme.js.map +1 -1
  198. package/lib/shared/options/createOptionDefaults/readEmails.d.ts +11 -0
  199. package/lib/shared/options/createOptionDefaults/readEmails.js +14 -0
  200. package/lib/shared/options/createOptionDefaults/readEmails.js.map +1 -0
  201. package/lib/shared/options/createOptionDefaults/readFunding.d.ts +3 -0
  202. package/lib/shared/options/createOptionDefaults/readFunding.js +11 -0
  203. package/lib/shared/options/createOptionDefaults/readFunding.js.map +1 -0
  204. package/lib/shared/options/createOptionDefaults/readGuide.d.ts +6 -0
  205. package/lib/shared/options/createOptionDefaults/readGuide.js +18 -0
  206. package/lib/shared/options/createOptionDefaults/readGuide.js.map +1 -0
  207. package/lib/shared/options/ensureRepositoryExists.d.ts +3 -4
  208. package/lib/shared/options/ensureRepositoryExists.js +9 -8
  209. package/lib/shared/options/ensureRepositoryExists.js.map +1 -1
  210. package/lib/shared/options/readOptions.d.ts +5 -6
  211. package/lib/shared/options/readOptions.js +7 -4
  212. package/lib/shared/options/readOptions.js.map +1 -1
  213. package/lib/shared/types.d.ts +7 -0
  214. package/lib/steps/addOwnerAsAllContributor.js.map +1 -1
  215. package/lib/steps/clearUnnecessaryFiles.js +0 -1
  216. package/lib/steps/clearUnnecessaryFiles.js.map +1 -1
  217. package/lib/steps/finalizeDependencies.js +5 -7
  218. package/lib/steps/finalizeDependencies.js.map +1 -1
  219. package/lib/steps/initializeGitHubRepository/index.js +7 -2
  220. package/lib/steps/initializeGitHubRepository/index.js.map +1 -1
  221. package/lib/steps/initializeGitHubRepository/outcomeLabels.d.ts +13 -0
  222. package/lib/steps/initializeGitHubRepository/{labels/outcomeLabels.js → outcomeLabels.js} +4 -1
  223. package/lib/steps/initializeGitHubRepository/outcomeLabels.js.map +1 -0
  224. package/lib/steps/removeSetupScripts.js +9 -3
  225. package/lib/steps/removeSetupScripts.js.map +1 -1
  226. package/lib/steps/uninstallPackages.js +14 -5
  227. package/lib/steps/uninstallPackages.js.map +1 -1
  228. package/lib/steps/writing/creation/createCSpellConfig.d.ts +7 -0
  229. package/lib/steps/writing/creation/createCSpellConfig.js +27 -0
  230. package/lib/steps/writing/creation/createCSpellConfig.js.map +1 -0
  231. package/lib/steps/writing/creation/createDotGitignore.js +7 -5
  232. package/lib/steps/writing/creation/createDotGitignore.js.map +1 -1
  233. package/lib/steps/writing/creation/createESLintConfig.js +1 -3
  234. package/lib/steps/writing/creation/createESLintConfig.js.map +1 -1
  235. package/lib/steps/writing/creation/createTsupConfig.js +10 -10
  236. package/lib/steps/writing/creation/createTsupConfig.js.map +1 -1
  237. package/lib/steps/writing/creation/dotGitHub/createDevelopment/index.js +31 -16
  238. package/lib/steps/writing/creation/dotGitHub/createDevelopment/index.js.map +1 -1
  239. package/lib/steps/writing/creation/dotGitHub/createDevelopment/splitIntoSections.js +1 -1
  240. package/lib/steps/writing/creation/dotGitHub/createDevelopment/splitIntoSections.js.map +1 -1
  241. package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.js +5 -5
  242. package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.js.map +1 -1
  243. package/lib/steps/writing/creation/dotGitHub/createMultiWorkflowFile.d.ts +3 -1
  244. package/lib/steps/writing/creation/dotGitHub/createMultiWorkflowFile.js.map +1 -1
  245. package/lib/steps/writing/creation/dotGitHub/createWorkflows.js +5 -1
  246. package/lib/steps/writing/creation/dotGitHub/createWorkflows.js.map +1 -1
  247. package/lib/steps/writing/creation/formatters/formatIgnoreFile.d.ts +1 -1
  248. package/lib/steps/writing/creation/formatters/formatIgnoreFile.js +1 -1
  249. package/lib/steps/writing/creation/formatters/formatIgnoreFile.js.map +1 -1
  250. package/lib/steps/writing/creation/formatters/formatTypeScript.js +1 -1
  251. package/lib/steps/writing/creation/formatters/formatTypeScript.js.map +1 -1
  252. package/lib/steps/writing/creation/formatters/formatYaml.js +3 -1
  253. package/lib/steps/writing/creation/formatters/formatYaml.js.map +1 -1
  254. package/lib/steps/writing/creation/index.d.ts +1 -1
  255. package/lib/steps/writing/creation/index.js +48 -1
  256. package/lib/steps/writing/creation/index.js.map +1 -1
  257. package/lib/steps/writing/creation/rootFiles.js +4 -14
  258. package/lib/steps/writing/creation/rootFiles.js.map +1 -1
  259. package/lib/steps/writing/creation/writeAllContributorsRC.js +1 -9
  260. package/lib/steps/writing/creation/writeAllContributorsRC.js.map +1 -1
  261. package/lib/steps/writing/creation/writePackageJson.js +69 -62
  262. package/lib/steps/writing/creation/writePackageJson.js.map +1 -1
  263. package/lib/steps/writing/types.d.ts +1 -1
  264. package/lib/steps/writing/writeStructure.js +9 -1
  265. package/lib/steps/writing/writeStructure.js.map +1 -1
  266. package/lib/steps/writing/writeStructureWorker.js +1 -1
  267. package/lib/steps/writing/writeStructureWorker.js.map +1 -1
  268. package/package.json +35 -28
  269. package/lib/shared/options/createOptionDefaults/readDefaultsFromDevelopment.d.ts +0 -8
  270. package/lib/shared/options/createOptionDefaults/readDefaultsFromDevelopment.js +0 -22
  271. package/lib/shared/options/createOptionDefaults/readDefaultsFromDevelopment.js.map +0 -1
  272. package/lib/shared/options/getGitHub.d.ts +0 -9
  273. package/lib/shared/options/getGitHub.js +0 -17
  274. package/lib/shared/options/getGitHub.js.map +0 -1
  275. package/lib/steps/detectExistingContributors.d.ts +0 -7
  276. package/lib/steps/detectExistingContributors.js +0 -19
  277. package/lib/steps/detectExistingContributors.js.map +0 -1
  278. package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabels.d.ts +0 -8
  279. package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabels.js +0 -14
  280. package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabels.js.map +0 -1
  281. package/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.d.ts +0 -8
  282. package/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.js +0 -63
  283. package/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.js.map +0 -1
  284. package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.d.ts +0 -7
  285. package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.js.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <h1 align="center">Create TypeScript App</h1>
2
2
 
3
- <p align="center">Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 💝</p>
3
+ <p align="center">Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. ❤️‍🔥</p>
4
4
 
5
5
  <p align="center">
6
6
  <!-- prettier-ignore-start -->
@@ -4,6 +4,7 @@ import * as fs from "fs/promises";
4
4
  import path from "node:path";
5
5
  import * as process from "node:process";
6
6
  import { logLine } from "../shared/cli/lines.js";
7
+ import { isUsingCreateEngine } from "../shared/isUsingCreateEngine.js";
7
8
  import { filterPromptCancel } from "../shared/prompts.js";
8
9
  const allowedModes = ["create", "initialize", "migrate"];
9
10
  async function promptForMode(auto, input) {
@@ -25,7 +26,7 @@ async function promptForMode(auto, input) {
25
26
  return { mode: input };
26
27
  }
27
28
  const dir = await fs.readdir(".");
28
- if (dir.length === 0) {
29
+ if (dir.length === 0 && !isUsingCreateEngine()) {
29
30
  const mode = filterPromptCancel(
30
31
  await prompts.select({
31
32
  message: chalk.blue("How would you like to use the template?"),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bin/promptForMode.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport chalk from \"chalk\";\nimport * as fs from \"fs/promises\";\nimport path from \"node:path\";\nimport * as process from \"node:process\";\n\nimport { logLine } from \"../shared/cli/lines.js\";\nimport { filterPromptCancel } from \"../shared/prompts.js\";\nimport { Mode, PromptedOptions } from \"../shared/types.js\";\n\nconst allowedModes = [\"create\", \"initialize\", \"migrate\"] satisfies Mode[];\n\nexport interface PromptedMode {\n\tmode: Error | Mode | undefined;\n\toptions?: PromptedOptions;\n}\n\nexport async function promptForMode(\n\tauto: boolean,\n\tinput: boolean | string | undefined,\n): Promise<PromptedMode> {\n\tif (auto && input !== \"migrate\") {\n\t\treturn {\n\t\t\tmode: new Error(\"--auto can only be used with --mode migrate.\"),\n\t\t};\n\t}\n\n\tif (input) {\n\t\tif (!isMode(input)) {\n\t\t\treturn {\n\t\t\t\tmode: new Error(\n\t\t\t\t\t`Unknown --mode: ${input}. Allowed modes are: ${allowedModes.join(\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\n\t\treturn { mode: input };\n\t}\n\n\tconst dir = await fs.readdir(\".\");\n\n\tif (dir.length === 0) {\n\t\tconst mode = filterPromptCancel(\n\t\t\t(await prompts.select({\n\t\t\t\tmessage: chalk.blue(\"How would you like to use the template?\"),\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: label(\n\t\t\t\t\t\t\t\"create\",\n\t\t\t\t\t\t\t\"a new repository in the current empty directory\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: \"create-current\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: label(\"create\", \"a new repository in a new child directory\"),\n\t\t\t\t\t\tvalue: \"create-child\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t})) as string,\n\t\t);\n\n\t\tconst directory = path.basename(process.cwd());\n\n\t\treturn {\n\t\t\tmode: \"create\",\n\t\t\t...(mode === \"create-current\" && {\n\t\t\t\toptions: {\n\t\t\t\t\tdirectory: \".\",\n\t\t\t\t\trepository: directory,\n\t\t\t\t},\n\t\t\t}),\n\t\t};\n\t}\n\n\tif (dir.includes(\".git\")) {\n\t\treturn {\n\t\t\tmode: filterPromptCancel(\n\t\t\t\t(await prompts.select({\n\t\t\t\t\tinitialValue: \"migrate\" as Mode,\n\t\t\t\t\tmessage: chalk.blue(\"How would you like to use the template?\"),\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: label(\"create\", \"a new repository in a child directory\"),\n\t\t\t\t\t\t\tvalue: \"create\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: label(\n\t\t\t\t\t\t\t\t\"initialize\",\n\t\t\t\t\t\t\t\t\"a freshly cloned repository in the current directory\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tvalue: \"initialize\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: label(\n\t\t\t\t\t\t\t\t\"migrate\",\n\t\t\t\t\t\t\t\t\"the existing repository in the current directory\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tvalue: \"migrate\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t})) as Mode | symbol,\n\t\t\t),\n\t\t};\n\t}\n\n\tlogLine();\n\tlogLine(\n\t\tchalk.gray(\n\t\t\t\"Defaulting to --mode create because the directory contains children and isn't a Git repository.\",\n\t\t),\n\t);\n\n\treturn {\n\t\tmode: \"create\",\n\t};\n}\n\nfunction isMode(input: boolean | string): input is Mode {\n\treturn allowedModes.includes(input as Mode);\n}\n\nfunction label(base: string, text: string) {\n\treturn `${chalk.bold(base)} ${text}`;\n}\n"],"mappings":"AAAA,YAAY,aAAa;AACzB,OAAO,WAAW;AAClB,YAAY,QAAQ;AACpB,OAAO,UAAU;AACjB,YAAY,aAAa;AAEzB,SAAS,eAAe;AACxB,SAAS,0BAA0B;AAGnC,MAAM,eAAe,CAAC,UAAU,cAAc,SAAS;AAOvD,eAAsB,cACrB,MACA,OACwB;AACxB,MAAI,QAAQ,UAAU,WAAW;AAChC,WAAO;AAAA,MACN,MAAM,IAAI,MAAM,8CAA8C;AAAA,IAC/D;AAAA,EACD;AAEA,MAAI,OAAO;AACV,QAAI,CAAC,OAAO,KAAK,GAAG;AACnB,aAAO;AAAA,QACN,MAAM,IAAI;AAAA,UACT,mBAAmB,KAAK,wBAAwB,aAAa;AAAA,YAC5D;AAAA,UACD,CAAC;AAAA,QACF;AAAA,MACD;AAAA,IACD;AAEA,WAAO,EAAE,MAAM,MAAM;AAAA,EACtB;AAEA,QAAM,MAAM,MAAM,GAAG,QAAQ,GAAG;AAEhC,MAAI,IAAI,WAAW,GAAG;AACrB,UAA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AAI,CAAC,IAAI,IAAI;AACnC;","names":[]}
1
+ {"version":3,"sources":["../../src/bin/promptForMode.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport chalk from \"chalk\";\nimport * as fs from \"fs/promises\";\nimport path from \"node:path\";\nimport * as process from \"node:process\";\n\nimport { logLine } from \"../shared/cli/lines.js\";\nimport { isUsingCreateEngine } from \"../shared/isUsingCreateEngine.js\";\nimport { filterPromptCancel } from \"../shared/prompts.js\";\nimport { Mode, PromptedOptions } from \"../shared/types.js\";\n\nconst allowedModes = [\"create\", \"initialize\", \"migrate\"] satisfies Mode[];\n\nexport interface PromptedMode {\n\tmode: Error | Mode | undefined;\n\toptions?: PromptedOptions;\n}\n\nexport async function promptForMode(\n\tauto: boolean,\n\tinput: boolean | string | undefined,\n): Promise<PromptedMode> {\n\tif (auto && input !== \"migrate\") {\n\t\treturn {\n\t\t\tmode: new Error(\"--auto can only be used with --mode migrate.\"),\n\t\t};\n\t}\n\n\tif (input) {\n\t\tif (!isMode(input)) {\n\t\t\treturn {\n\t\t\t\tmode: new Error(\n\t\t\t\t\t`Unknown --mode: ${input}. Allowed modes are: ${allowedModes.join(\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\n\t\treturn { mode: input };\n\t}\n\n\tconst dir = await fs.readdir(\".\");\n\n\tif (dir.length === 0 && !isUsingCreateEngine()) {\n\t\tconst mode = filterPromptCancel(\n\t\t\t(await prompts.select({\n\t\t\t\tmessage: chalk.blue(\"How would you like to use the template?\"),\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: label(\n\t\t\t\t\t\t\t\"create\",\n\t\t\t\t\t\t\t\"a new repository in the current empty directory\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: \"create-current\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: label(\"create\", \"a new repository in a new child directory\"),\n\t\t\t\t\t\tvalue: \"create-child\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t})) as string,\n\t\t);\n\n\t\tconst directory = path.basename(process.cwd());\n\n\t\treturn {\n\t\t\tmode: \"create\",\n\t\t\t...(mode === \"create-current\" && {\n\t\t\t\toptions: {\n\t\t\t\t\tdirectory: \".\",\n\t\t\t\t\trepository: directory,\n\t\t\t\t},\n\t\t\t}),\n\t\t};\n\t}\n\n\tif (dir.includes(\".git\")) {\n\t\treturn {\n\t\t\tmode: filterPromptCancel(\n\t\t\t\t(await prompts.select({\n\t\t\t\t\tinitialValue: \"migrate\" as Mode,\n\t\t\t\t\tmessage: chalk.blue(\"How would you like to use the template?\"),\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: label(\"create\", \"a new repository in a child directory\"),\n\t\t\t\t\t\t\tvalue: \"create\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: label(\n\t\t\t\t\t\t\t\t\"initialize\",\n\t\t\t\t\t\t\t\t\"a freshly cloned repository in the current directory\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tvalue: \"initialize\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: label(\n\t\t\t\t\t\t\t\t\"migrate\",\n\t\t\t\t\t\t\t\t\"the existing repository in the current directory\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tvalue: \"migrate\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t})) as Mode | symbol,\n\t\t\t),\n\t\t};\n\t}\n\n\tlogLine();\n\tlogLine(\n\t\tchalk.gray(\n\t\t\t\"Defaulting to --mode create because the directory contains children and isn't a Git repository.\",\n\t\t),\n\t);\n\n\treturn {\n\t\tmode: \"create\",\n\t};\n}\n\nfunction isMode(input: boolean | string): input is Mode {\n\treturn allowedModes.includes(input as Mode);\n}\n\nfunction label(base: string, text: string) {\n\treturn `${chalk.bold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GAAG;AACzB,WAAO;AAAA,MACN,MAAM;AAAA,QACJ,MAAM,QAAQ,OAAO;AAAA,UACrB,cAAc;AAAA,UACd,SAAS,MAAM,KAAK,yCAAyC;AAAA,UAC7D,SAAS;AAAA,YACR;AAAA,cACC,OAAO,MAAM,UAAU,uCAAuC;AAAA,cAC9D,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,OAAO;AAAA,gBACN;AAAA,gBACA;AAAA,cACD;AAAA,cACA,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,OAAO;AAAA,gBACN;AAAA,gBACA;AAAA,cACD;AAAA,cACA,OAAO;AAAA,YACR;AAAA,UACD;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAEA,UAAQ;AACR;AAAA,IACC,MAAM;AAAA,MACL;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;AAEA,SAAS,OAAO,OAAwC;AACvD,SAAO,aAAa,SAAS,KAAa;AAC3C;AAEA,SAAS,MAAM,MAAc,MAAc;AAC1C,SAAO,GAAG,MAAM,KAAK,IAAI,CAAC,IAAI,IAAI;AACnC;","names":[]}
@@ -1,11 +1,10 @@
1
- import { GitHubAndOptions } from '../shared/options/readOptions.js';
1
+ import { OctokitAndOptions } from '../shared/options/readOptions.js';
2
+ import 'octokit';
2
3
  import 'zod';
3
4
  import '../shared/types.js';
4
5
  import '../shared/codes.js';
5
- import '../shared/options/getGitHub.js';
6
- import 'octokit';
7
6
 
8
- declare function createWithOptions({ github, options }: GitHubAndOptions): Promise<{
7
+ declare function createWithOptions({ octokit, options, }: OctokitAndOptions): Promise<{
9
8
  sentToGitHub: boolean | undefined;
10
9
  }>;
11
10
 
@@ -1,16 +1,29 @@
1
1
  import { $ } from "execa";
2
- import { withSpinner, withSpinners } from "../shared/cli/spinners.js";
2
+ import { runCreateEnginePreset } from "../next/runCreateEnginePreset.js";
3
+ import {
4
+ withSpinner,
5
+ withSpinners
6
+ } from "../shared/cli/spinners.js";
3
7
  import { createCleanupCommands } from "../shared/createCleanupCommands.js";
4
8
  import { doesRepositoryExist } from "../shared/doesRepositoryExist.js";
9
+ import { isUsingCreateEngine } from "../shared/isUsingCreateEngine.js";
5
10
  import { addToolAllContributors } from "../steps/addToolAllContributors.js";
6
11
  import { clearLocalGitTags } from "../steps/clearLocalGitTags.js";
7
12
  import { finalizeDependencies } from "../steps/finalizeDependencies.js";
8
13
  import { initializeGitHubRepository } from "../steps/initializeGitHubRepository/index.js";
9
- import { populateCSpellDictionary } from "../steps/populateCSpellDictionary.js";
10
14
  import { runCleanup } from "../steps/runCleanup.js";
11
15
  import { writeReadme } from "../steps/writeReadme/index.js";
12
16
  import { writeStructure } from "../steps/writing/writeStructure.js";
13
- async function createWithOptions({ github, options }) {
17
+ async function createWithOptions({
18
+ octokit,
19
+ options
20
+ }) {
21
+ if (isUsingCreateEngine()) {
22
+ await withSpinner("Creating repository", async () => {
23
+ await runCreateEnginePreset(options);
24
+ });
25
+ return { sentToGitHub: false };
26
+ }
14
27
  await withSpinners("Creating repository structure", [
15
28
  [
16
29
  "Writing structure",
@@ -27,7 +40,7 @@ async function createWithOptions({ github, options }) {
27
40
  ]);
28
41
  if (!options.excludeAllContributors && !options.skipAllContributorsApi) {
29
42
  await withSpinner("Adding contributors to table", async () => {
30
- await addToolAllContributors(github?.octokit, options);
43
+ await addToolAllContributors(octokit, options);
31
44
  });
32
45
  }
33
46
  if (!options.skipInstall) {
@@ -35,23 +48,17 @@ async function createWithOptions({ github, options }) {
35
48
  "Installing packages",
36
49
  async () => finalizeDependencies(options)
37
50
  );
38
- if (!options.excludeLintSpelling) {
39
- await withSpinner(
40
- "Populating CSpell dictionary",
41
- populateCSpellDictionary
42
- );
43
- }
44
51
  await runCleanup(createCleanupCommands(options.bin), options.mode);
45
52
  }
46
53
  await withSpinner("Clearing any local Git tags", clearLocalGitTags);
47
- const sendToGitHub = github && await doesRepositoryExist(github.octokit, options);
54
+ const sendToGitHub = octokit && await doesRepositoryExist(octokit, options);
48
55
  if (sendToGitHub) {
49
56
  await withSpinner("Initializing GitHub repository", async () => {
50
57
  await $`git remote add origin https://github.com/${options.owner}/${options.repository}`;
51
58
  await $`git add -A`;
52
59
  await $`git commit --message ${"feat: initialized repo \u2728"} --no-gpg-sign`;
53
60
  await $`git push -u origin main --force`;
54
- await initializeGitHubRepository(github.octokit, options);
61
+ await initializeGitHubRepository(octokit, options);
55
62
  });
56
63
  }
57
64
  return { sentToGitHub: sendToGitHub };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/create/createWithOptions.ts"],"sourcesContent":["import { $ } from \"execa\";\n\nimport { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { createCleanupCommands } from \"../shared/createCleanupCommands.js\";\nimport { doesRepositoryExist } from \"../shared/doesRepositoryExist.js\";\nimport { GitHubAndOptions } from \"../shared/options/readOptions.js\";\nimport { addToolAllContributors } from \"../steps/addToolAllContributors.js\";\nimport { clearLocalGitTags } from \"../steps/clearLocalGitTags.js\";\nimport { finalizeDependencies } from \"../steps/finalizeDependencies.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { populateCSpellDictionary } from \"../steps/populateCSpellDictionary.js\";\nimport { runCleanup } from \"../steps/runCleanup.js\";\nimport { writeReadme } from \"../steps/writeReadme/index.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.excludeAllContributors && !options.skipAllContributorsApi) {\n\t\tawait withSpinner(\"Adding contributors to table\", async () => {\n\t\t\tawait addToolAllContributors(github?.octokit, 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\n\t\tif (!options.excludeLintSpelling) {\n\t\t\tawait withSpinner(\n\t\t\t\t\"Populating CSpell dictionary\",\n\t\t\t\tpopulateCSpellDictionary,\n\t\t\t);\n\t\t}\n\n\t\tawait runCleanup(createCleanupCommands(options.bin), options.mode);\n\t}\n\n\tawait withSpinner(\"Clearing any local Git tags\", clearLocalGitTags);\n\n\tconst sendToGitHub =\n\t\tgithub && (await doesRepositoryExist(github.octokit, options));\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 ✨\"} --no-gpg-sign`;\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,SAAS,SAAS;AAElB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AAEpC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,kCAAkC;AAC3C,SAAS,gCAAgC;AACzC,SAAS,kBAAkB;AAC3B,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,0BAA0B,CAAC,QAAQ,wBAAwB;AACvE,UAAM,YAAY,gCAAgC,YAAY;AAC7D,YAAM,uBAAuB,QAAQ,SAAS,OAAO;AAAA,IACtD,CAAC;AAAA,EACF;AAEA,MAAI,CAAC,QAAQ,aAAa;AACzB,UAAM;AAAA,MAAY;AAAA,MAAuB,YACxC,qBAAqB,OAAO;AAAA,IAC7B;AAEA,QAAI,CAAC,QAAQ,qBAAqB;AACjC,YAAM;AAAA,QACL;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAEA,UAAM,WAAW,sBAAsB,QAAQ,GAAG,GAAG,QAAQ,IAAI;AAAA,EAClE;AAEA,QAAM,YAAY,+BAA+B,iBAAiB;AAElE,QAAM,eACL,UAAW,MAAM,oBAAoB,OAAO,SAAS,OAAO;AAE7D,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
+ {"version":3,"sources":["../../src/create/createWithOptions.ts"],"sourcesContent":["import { $ } from \"execa\";\n\nimport { runCreateEnginePreset } from \"../next/runCreateEnginePreset.js\";\nimport {\n\tLabeledSpinnerTask,\n\twithSpinner,\n\twithSpinners,\n} from \"../shared/cli/spinners.js\";\nimport { createCleanupCommands } from \"../shared/createCleanupCommands.js\";\nimport { doesRepositoryExist } from \"../shared/doesRepositoryExist.js\";\nimport { isUsingCreateEngine } from \"../shared/isUsingCreateEngine.js\";\nimport { OctokitAndOptions } from \"../shared/options/readOptions.js\";\nimport { addToolAllContributors } from \"../steps/addToolAllContributors.js\";\nimport { clearLocalGitTags } from \"../steps/clearLocalGitTags.js\";\nimport { finalizeDependencies } from \"../steps/finalizeDependencies.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { runCleanup } from \"../steps/runCleanup.js\";\nimport { writeReadme } from \"../steps/writeReadme/index.js\";\nimport { writeStructure } from \"../steps/writing/writeStructure.js\";\n\nexport async function createWithOptions({\n\toctokit,\n\toptions,\n}: OctokitAndOptions) {\n\tif (isUsingCreateEngine()) {\n\t\tawait withSpinner(\"Creating repository\", async () => {\n\t\t\tawait runCreateEnginePreset(options);\n\t\t});\n\t\treturn { sentToGitHub: false };\n\t}\n\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] satisfies LabeledSpinnerTask<void>,\n\t]);\n\n\tif (!options.excludeAllContributors && !options.skipAllContributorsApi) {\n\t\tawait withSpinner(\"Adding contributors to table\", async () => {\n\t\t\tawait addToolAllContributors(octokit, 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\n\t\tawait runCleanup(createCleanupCommands(options.bin), options.mode);\n\t}\n\n\tawait withSpinner(\"Clearing any local Git tags\", clearLocalGitTags);\n\n\tconst sendToGitHub = octokit && (await doesRepositoryExist(octokit, options));\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 ✨\"} --no-gpg-sign`;\n\t\t\tawait $`git push -u origin main --force`;\n\t\t\tawait initializeGitHubRepository(octokit, options);\n\t\t});\n\t}\n\n\treturn { sentToGitHub: sendToGitHub };\n}\n"],"mappings":"AAAA,SAAS,SAAS;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B,+BAA0B;AACzD,YAAM;AACN,YAAM,2BAA2B,SAAS,OAAO;AAAA,IAClD,CAAC;AAAA,EACF;AAEA,SAAO,EAAE,cAAc,aAAa;AACrC;","names":[]}
package/lib/index.d.ts CHANGED
@@ -1,2 +1,47 @@
1
1
  export { greet } from './greet.js';
2
+ export { blockAllContributors } from './next/blocks/blockAllContributors.js';
3
+ export { blockAreTheTypesWrong } from './next/blocks/blockAreTheTypesWrong.js';
4
+ export { blockContributingDocs } from './next/blocks/blockContributingDocs.js';
5
+ export { blockContributorCovenant } from './next/blocks/blockContributorCovenant.js';
6
+ export { blockCSpell } from './next/blocks/blockCSpell.js';
7
+ export { blockDevelopmentDocs } from './next/blocks/blockDevelopmentDocs.js';
8
+ export { blockESLint } from './next/blocks/blockESLint.js';
9
+ export { blockESLintComments } from './next/blocks/blockESLintComments.js';
10
+ export { blockESLintJSDoc } from './next/blocks/blockESLintJSDoc.js';
11
+ export { blockESLintJSONC } from './next/blocks/blockESLintJSONC.js';
12
+ export { blockESLintMarkdown } from './next/blocks/blockESLintMarkdown.js';
13
+ export { blockESLintMoreStyling } from './next/blocks/blockESLintMoreStyling.js';
14
+ export { blockESLintNode } from './next/blocks/blockESLintNode.js';
15
+ export { blockESLintPackageJson } from './next/blocks/blockESLintPackageJson.js';
16
+ export { blockESLintPerfectionist } from './next/blocks/blockESLintPerfectionist.js';
17
+ export { blockESLintRegexp } from './next/blocks/blockESLintRegexp.js';
18
+ export { blockESLintYML } from './next/blocks/blockESLintYML.js';
19
+ export { blockFunding } from './next/blocks/blockFunding.js';
20
+ export { blockGitHubActionsCI } from './next/blocks/blockGitHubActionsCI.js';
21
+ export { blockGitHubIssueTemplates } from './next/blocks/blockGitHubIssueTemplates.js';
22
+ export { blockGitHubPRTemplate } from './next/blocks/blockGitHubPRTemplate.js';
23
+ export { blockGitignore } from './next/blocks/blockGitignore.js';
24
+ export { blockKnip } from './next/blocks/blockKnip.js';
25
+ export { blockMarkdownlint } from './next/blocks/blockMarkdownlint.js';
26
+ export { blockMITLicense } from './next/blocks/blockMITLicense.js';
27
+ export { blockNvmrc } from './next/blocks/blockNvmrc.js';
28
+ export { blockPackageJson } from './next/blocks/blockPackageJson.js';
29
+ export { blockPnpmDedupe } from './next/blocks/blockPnpmDedupe.js';
30
+ export { blockPRCompliance } from './next/blocks/blockPRCompliance.js';
31
+ export { blockPrettier } from './next/blocks/blockPrettier.js';
32
+ export { blockPrettierPluginCurly } from './next/blocks/blockPrettierPluginCurly.js';
33
+ export { blockPrettierPluginPackageJson } from './next/blocks/blockPrettierPluginPackageJson.js';
34
+ export { blockPrettierPluginSh } from './next/blocks/blockPrettierPluginSh.js';
35
+ export { blockREADME } from './next/blocks/blockREADME.js';
36
+ export { blockReleaseIt } from './next/blocks/blockReleaseIt.js';
37
+ export { blockRenovate } from './next/blocks/blockRenovate.js';
38
+ export { blockSecurityDocs } from './next/blocks/blockSecurityDocs.js';
39
+ export { blockTemplatedBy } from './next/blocks/blockTemplatedBy.js';
40
+ export { blockTSup } from './next/blocks/blockTSup.js';
41
+ export { blockTypeScript } from './next/blocks/blockTypeScript.js';
42
+ export { blockVitest } from './next/blocks/blockVitest.js';
43
+ export { blockVSCode } from './next/blocks/blockVSCode.js';
44
+ export { default } from './next/template.js';
2
45
  export { GreetOptions } from './types.js';
46
+ import 'create';
47
+ import 'zod';
package/lib/index.js CHANGED
@@ -1,3 +1,8 @@
1
1
  export * from "./greet.js";
2
+ export * from "./next/blocks/index.js";
3
+ import { default as default2 } from "./next/template.js";
2
4
  export * from "./types.js";
5
+ export {
6
+ default2 as default
7
+ };
3
8
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./greet.js\";\nexport * from \"./types.js\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./greet.js\";\n\n// If you're using create-typescript-app as a template, ignore these.\n// They're plumbing for the create engine. :)\nexport * from \"./next/blocks/index.js\";\nexport { default } from \"./next/template.js\";\n\nexport * from \"./types.js\";\n"],"mappings":"AAAA,cAAc;AAId,cAAc;AACd,SAAS,WAAAA,gBAAe;AAExB,cAAc;","names":["default"]}
@@ -1,10 +1,9 @@
1
- import { GitHubAndOptions } from '../shared/options/readOptions.js';
1
+ import { OctokitAndOptions } from '../shared/options/readOptions.js';
2
+ import 'octokit';
2
3
  import 'zod';
3
4
  import '../shared/types.js';
4
5
  import '../shared/codes.js';
5
- import '../shared/options/getGitHub.js';
6
- import 'octokit';
7
6
 
8
- declare function initializeWithOptions({ github, options, }: GitHubAndOptions): Promise<void>;
7
+ declare function initializeWithOptions({ octokit, options, }: OctokitAndOptions): Promise<void>;
9
8
 
10
9
  export { initializeWithOptions };
@@ -11,7 +11,7 @@ import { updateAllContributorsTable } from "../steps/updateAllContributorsTable.
11
11
  import { updateLocalFiles } from "../steps/updateLocalFiles.js";
12
12
  import { updateReadme } from "../steps/updateReadme.js";
13
13
  async function initializeWithOptions({
14
- github,
14
+ octokit,
15
15
  options
16
16
  }) {
17
17
  await withSpinners("Initializing local files", [
@@ -38,12 +38,12 @@ async function initializeWithOptions({
38
38
  ]);
39
39
  if (!options.excludeAllContributors) {
40
40
  await withSpinner("Updating existing contributor details", async () => {
41
- await addOwnerAsAllContributor(github?.octokit, options);
41
+ await addOwnerAsAllContributor(octokit, options);
42
42
  });
43
43
  }
44
- if (github) {
44
+ if (octokit) {
45
45
  await withSpinner("Initializing GitHub repository", async () => {
46
- await initializeGitHubRepository(github.octokit, options);
46
+ await initializeGitHubRepository(octokit, options);
47
47
  });
48
48
  }
49
49
  if (!options.skipRemoval) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/initialize/initializeWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { createCleanupCommands } from \"../shared/createCleanupCommands.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 { runCleanup } from \"../steps/runCleanup.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[\n\t\t\t\"Updating README.md\",\n\t\t\tasync () => {\n\t\t\t\tawait updateReadme(options);\n\t\t\t},\n\t\t],\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.excludeAllContributors) {\n\t\tawait withSpinner(\"Updating existing contributor details\", async () => {\n\t\t\tawait addOwnerAsAllContributor(github?.octokit, options);\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(\"Uninstalling initialization-only packages\", async () =>\n\t\t\tuninstallPackages(options.offline),\n\t\t);\n\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;AAAA,EACD;AAEA,QAAM;AAAA,IACL,sBAAsB,QAAQ,KAAK,uBAAuB;AAAA,IAC1D,QAAQ;AAAA,EACT;AACD;","names":[]}
1
+ {"version":3,"sources":["../../src/initialize/initializeWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { createCleanupCommands } from \"../shared/createCleanupCommands.js\";\nimport { OctokitAndOptions } 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 { runCleanup } from \"../steps/runCleanup.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\toctokit,\n\toptions,\n}: OctokitAndOptions) {\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[\n\t\t\t\"Updating README.md\",\n\t\t\tasync () => {\n\t\t\t\tawait updateReadme(options);\n\t\t\t},\n\t\t],\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.excludeAllContributors) {\n\t\tawait withSpinner(\"Updating existing contributor details\", async () => {\n\t\t\tawait addOwnerAsAllContributor(octokit, options);\n\t\t});\n\t}\n\n\tif (octokit) {\n\t\tawait withSpinner(\"Initializing GitHub repository\", async () => {\n\t\t\tawait initializeGitHubRepository(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(\"Uninstalling initialization-only packages\", async () =>\n\t\t\tuninstallPackages(options.offline),\n\t\t);\n\t}\n\n\tawait runCleanup(\n\t\tcreateCleanupCommands(options.bin, \"pnpm dedupe --offline\"),\n\t\toptions.mode,\n\t);\n}\n"],"mappings":"AAAA,SAAS,aAAa,oBAAoB;AAC1C,SAAS,6BAA6B;AAEtC,SAAS,gCAAgC;AACzC,SAAS,sBAAsB;AAC/B,SAAS,kCAAkC;AAC3C,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAE7B,eAAsB,sBAAsB;AAAA,EAC3C;AAAA,EACA;AACD,GAAsB;AACrB,QAAM,aAAa,4BAA4B;AAAA,IAC9C;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,iBAAiB,OAAO;AAAA,MAC/B;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,aAAa,OAAO;AAAA,MAC3B;AAAA,IACD;AAAA,IACA,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,wBAAwB;AACpC,UAAM,YAAY,yCAAyC,YAAY;AACtE,YAAM,yBAAyB,SAAS,OAAO;AAAA,IAChD,CAAC;AAAA,EACF;AAEA,MAAI,SAAS;AACZ,UAAM,YAAY,kCAAkC,YAAY;AAC/D,YAAM,2BAA2B,SAAS,OAAO;AAAA,IAClD,CAAC;AAAA,EACF;AAEA,MAAI,CAAC,QAAQ,aAAa;AACzB,UAAM,YAAY,0BAA0B,kBAAkB;AAAA,EAC/D;AAEA,MAAI,CAAC,QAAQ,eAAe;AAC3B,UAAM;AAAA,MAAY;AAAA,MAA6C,YAC9D,kBAAkB,QAAQ,OAAO;AAAA,IAClC;AAAA,EACD;AAEA,QAAM;AAAA,IACL,sBAAsB,QAAQ,KAAK,uBAAuB;AAAA,IAC1D,QAAQ;AAAA,EACT;AACD;","names":[]}
@@ -1,10 +1,9 @@
1
- import { GitHubAndOptions } from '../shared/options/readOptions.js';
1
+ import { OctokitAndOptions } from '../shared/options/readOptions.js';
2
+ import 'octokit';
2
3
  import 'zod';
3
4
  import '../shared/types.js';
4
5
  import '../shared/codes.js';
5
- import '../shared/options/getGitHub.js';
6
- import 'octokit';
7
6
 
8
- declare function migrateWithOptions({ github, options, }: GitHubAndOptions): Promise<void>;
7
+ declare function migrateWithOptions({ octokit, options, }: OctokitAndOptions): Promise<void>;
9
8
 
10
9
  export { migrateWithOptions };
@@ -1,7 +1,7 @@
1
+ import { populateAllContributorsForRepository } from "populate-all-contributors-for-repository";
1
2
  import { withSpinner, withSpinners } from "../shared/cli/spinners.js";
2
3
  import { createCleanupCommands } from "../shared/createCleanupCommands.js";
3
4
  import { clearUnnecessaryFiles } from "../steps/clearUnnecessaryFiles.js";
4
- import { detectExistingContributors } from "../steps/detectExistingContributors.js";
5
5
  import { finalizeDependencies } from "../steps/finalizeDependencies.js";
6
6
  import { initializeGitHubRepository } from "../steps/initializeGitHubRepository/index.js";
7
7
  import { populateCSpellDictionary } from "../steps/populateCSpellDictionary.js";
@@ -11,7 +11,7 @@ import { updateLocalFiles } from "../steps/updateLocalFiles.js";
11
11
  import { writeReadme } from "../steps/writeReadme/index.js";
12
12
  import { writeStructure } from "../steps/writing/writeStructure.js";
13
13
  async function migrateWithOptions({
14
- github,
14
+ octokit,
15
15
  options
16
16
  }) {
17
17
  await withSpinners("Migrating repository structure", [
@@ -41,15 +41,18 @@ async function migrateWithOptions({
41
41
  }
42
42
  ]
43
43
  ]);
44
- if (github) {
44
+ if (octokit) {
45
45
  await withSpinner("Initializing GitHub repository", async () => {
46
- await initializeGitHubRepository(github.octokit, options);
46
+ await initializeGitHubRepository(octokit, options);
47
47
  });
48
48
  }
49
49
  if (!options.excludeAllContributors && !options.skipAllContributorsApi) {
50
50
  await withSpinner(
51
51
  "Detecting existing contributors",
52
- async () => detectExistingContributors(github?.auth, options)
52
+ async () => populateAllContributorsForRepository({
53
+ owner: options.owner,
54
+ repo: options.repository
55
+ })
53
56
  );
54
57
  }
55
58
  if (!options.skipInstall) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/migrate/migrateWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { createCleanupCommands } from \"../shared/createCleanupCommands.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 { populateCSpellDictionary } from \"../steps/populateCSpellDictionary.js\";\nimport { runCleanup } from \"../steps/runCleanup.js\";\nimport { updateAllContributorsTable } from \"../steps/updateAllContributorsTable.js\";\nimport { updateLocalFiles } from \"../steps/updateLocalFiles.js\";\nimport { writeReadme } from \"../steps/writeReadme/index.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.excludeAllContributors && !options.skipAllContributorsApi) {\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\tif (!options.excludeLintSpelling) {\n\t\tawait withSpinner(\"Populating CSpell dictionary\", populateCSpellDictionary);\n\t}\n\n\tawait runCleanup(createCleanupCommands(options.bin), options.mode);\n}\n"],"mappings":"AAAA,SAAS,aAAa,oBAAoB;AAC1C,SAAS,6BAA6B;AAEtC,SAAS,6BAA6B;AACtC,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AACrC,SAAS,kCAAkC;AAC3C,SAAS,gCAAgC;AACzC,SAAS,kBAAkB;AAC3B,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,0BAA0B,CAAC,QAAQ,wBAAwB;AACvE,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,MAAI,CAAC,QAAQ,qBAAqB;AACjC,UAAM,YAAY,gCAAgC,wBAAwB;AAAA,EAC3E;AAEA,QAAM,WAAW,sBAAsB,QAAQ,GAAG,GAAG,QAAQ,IAAI;AAClE;","names":[]}
1
+ {"version":3,"sources":["../../src/migrate/migrateWithOptions.ts"],"sourcesContent":["import { populateAllContributorsForRepository } from \"populate-all-contributors-for-repository\";\n\nimport { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { createCleanupCommands } from \"../shared/createCleanupCommands.js\";\nimport { OctokitAndOptions } from \"../shared/options/readOptions.js\";\nimport { clearUnnecessaryFiles } from \"../steps/clearUnnecessaryFiles.js\";\nimport { finalizeDependencies } from \"../steps/finalizeDependencies.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { populateCSpellDictionary } from \"../steps/populateCSpellDictionary.js\";\nimport { runCleanup } from \"../steps/runCleanup.js\";\nimport { updateAllContributorsTable } from \"../steps/updateAllContributorsTable.js\";\nimport { updateLocalFiles } from \"../steps/updateLocalFiles.js\";\nimport { writeReadme } from \"../steps/writeReadme/index.js\";\nimport { writeStructure } from \"../steps/writing/writeStructure.js\";\n\nexport async function migrateWithOptions({\n\toctokit,\n\toptions,\n}: OctokitAndOptions) {\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 (octokit) {\n\t\tawait withSpinner(\"Initializing GitHub repository\", async () => {\n\t\t\tawait initializeGitHubRepository(octokit, options);\n\t\t});\n\t}\n\n\tif (!options.excludeAllContributors && !options.skipAllContributorsApi) {\n\t\tawait withSpinner(\"Detecting existing contributors\", async () =>\n\t\t\tpopulateAllContributorsForRepository({\n\t\t\t\towner: options.owner,\n\t\t\t\trepo: options.repository,\n\t\t\t}),\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\tif (!options.excludeLintSpelling) {\n\t\tawait withSpinner(\"Populating CSpell dictionary\", populateCSpellDictionary);\n\t}\n\n\tawait runCleanup(createCleanupCommands(options.bin), options.mode);\n}\n"],"mappings":"AAAA,SAAS,4CAA4C;AAErD,SAAS,aAAa,oBAAoB;AAC1C,SAAS,6BAA6B;A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AAClE;","names":[]}
@@ -0,0 +1,101 @@
1
+ import * as create from 'create';
2
+ import { BaseOptionsFor } from 'create';
3
+ import { z } from 'zod';
4
+
5
+ declare const base: create.Base<{
6
+ access: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"public">, z.ZodLiteral<"restricted">]>>;
7
+ author: z.ZodOptional<z.ZodString>;
8
+ bin: z.ZodOptional<z.ZodString>;
9
+ contributors: z.ZodOptional<z.ZodArray<z.ZodObject<{
10
+ avatar_url: z.ZodString;
11
+ contributions: z.ZodArray<z.ZodString, "many">;
12
+ login: z.ZodString;
13
+ name: z.ZodString;
14
+ profile: z.ZodString;
15
+ }, "strip", z.ZodTypeAny, {
16
+ name: string;
17
+ avatar_url: string;
18
+ contributions: string[];
19
+ login: string;
20
+ profile: string;
21
+ }, {
22
+ name: string;
23
+ avatar_url: string;
24
+ contributions: string[];
25
+ login: string;
26
+ profile: string;
27
+ }>, "many">>;
28
+ description: z.ZodString;
29
+ documentation: z.ZodOptional<z.ZodString>;
30
+ email: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
31
+ github: z.ZodString;
32
+ npm: z.ZodString;
33
+ }, "strip", z.ZodTypeAny, {
34
+ github: string;
35
+ npm: string;
36
+ }, {
37
+ github: string;
38
+ npm: string;
39
+ }>]>, {
40
+ github: string;
41
+ npm: string;
42
+ }, string | {
43
+ github: string;
44
+ npm: string;
45
+ }>;
46
+ funding: z.ZodOptional<z.ZodString>;
47
+ guide: z.ZodOptional<z.ZodObject<{
48
+ href: z.ZodString;
49
+ title: z.ZodString;
50
+ }, "strip", z.ZodTypeAny, {
51
+ href: string;
52
+ title: string;
53
+ }, {
54
+ href: string;
55
+ title: string;
56
+ }>>;
57
+ hideTemplatedBy: z.ZodOptional<z.ZodBoolean>;
58
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
59
+ login: z.ZodOptional<z.ZodString>;
60
+ logo: z.ZodOptional<z.ZodObject<{
61
+ alt: z.ZodString;
62
+ src: z.ZodString;
63
+ }, "strip", z.ZodTypeAny, {
64
+ alt: string;
65
+ src: string;
66
+ }, {
67
+ alt: string;
68
+ src: string;
69
+ }>>;
70
+ node: z.ZodOptional<z.ZodObject<{
71
+ minimum: z.ZodString;
72
+ pinned: z.ZodOptional<z.ZodString>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ minimum: string;
75
+ pinned?: string | undefined;
76
+ }, {
77
+ minimum: string;
78
+ pinned?: string | undefined;
79
+ }>>;
80
+ owner: z.ZodString;
81
+ packageData: z.ZodOptional<z.ZodObject<{
82
+ dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
83
+ devDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
84
+ scripts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
85
+ }, "strip", z.ZodTypeAny, {
86
+ dependencies?: Record<string, string> | undefined;
87
+ devDependencies?: Record<string, string> | undefined;
88
+ scripts?: Record<string, string> | undefined;
89
+ }, {
90
+ dependencies?: Record<string, string> | undefined;
91
+ devDependencies?: Record<string, string> | undefined;
92
+ scripts?: Record<string, string> | undefined;
93
+ }>>;
94
+ preserveGeneratedFrom: z.ZodOptional<z.ZodBoolean>;
95
+ repository: z.ZodString;
96
+ title: z.ZodString;
97
+ version: z.ZodOptional<z.ZodString>;
98
+ }>;
99
+ type BaseOptions = BaseOptionsFor<typeof base>;
100
+
101
+ export { type BaseOptions, base };
@@ -0,0 +1,144 @@
1
+ import { createBase } from "create";
2
+ import { execaCommand } from "execa";
3
+ import gitRemoteOriginUrl from "git-remote-origin-url";
4
+ import gitUrlParse from "git-url-parse";
5
+ import { inputFromFile } from "input-from-file";
6
+ import { inputFromFileJSON } from "input-from-file-json";
7
+ import lazyValue from "lazy-value";
8
+ import npmUser from "npm-user";
9
+ import { z } from "zod";
10
+ import { parsePackageAuthor } from "../shared/options/createOptionDefaults/parsePackageAuthor.js";
11
+ import { readDefaultsFromReadme } from "../shared/options/createOptionDefaults/readDefaultsFromReadme.js";
12
+ import { readEmails } from "../shared/options/createOptionDefaults/readEmails.js";
13
+ import { readFunding } from "../shared/options/createOptionDefaults/readFunding.js";
14
+ import { readGuide } from "../shared/options/createOptionDefaults/readGuide.js";
15
+ import { readPackageData } from "../shared/packages.js";
16
+ import { tryCatchLazyValueAsync } from "../shared/tryCatchLazyValueAsync.js";
17
+ import { swallowError } from "./utils/swallowError.js";
18
+ const base = createBase({
19
+ options: {
20
+ access: z.union([z.literal("public"), z.literal("restricted")]).optional(),
21
+ author: z.string().optional(),
22
+ bin: z.string().optional(),
23
+ contributors: z.array(
24
+ z.object({
25
+ avatar_url: z.string(),
26
+ contributions: z.array(z.string()),
27
+ login: z.string(),
28
+ name: z.string(),
29
+ profile: z.string()
30
+ })
31
+ ).optional(),
32
+ description: z.string(),
33
+ documentation: z.string().optional(),
34
+ email: z.union([
35
+ z.string(),
36
+ z.object({
37
+ github: z.string(),
38
+ npm: z.string()
39
+ })
40
+ ]).transform(
41
+ (email) => typeof email === "string" ? { github: email, npm: email } : email
42
+ ),
43
+ funding: z.string().optional(),
44
+ guide: z.object({
45
+ href: z.string(),
46
+ title: z.string()
47
+ }).optional(),
48
+ hideTemplatedBy: z.boolean().optional(),
49
+ keywords: z.array(z.string()).optional(),
50
+ login: z.string().optional(),
51
+ logo: z.object({
52
+ alt: z.string(),
53
+ src: z.string()
54
+ }).optional(),
55
+ node: z.object({
56
+ minimum: z.string(),
57
+ pinned: z.string().optional()
58
+ }).optional(),
59
+ owner: z.string(),
60
+ packageData: z.object({
61
+ dependencies: z.record(z.string(), z.string()).optional(),
62
+ devDependencies: z.record(z.string(), z.string()).optional(),
63
+ scripts: z.record(z.string(), z.string()).optional()
64
+ }).optional(),
65
+ preserveGeneratedFrom: z.boolean().optional(),
66
+ repository: z.string(),
67
+ title: z.string(),
68
+ version: z.string().optional()
69
+ },
70
+ produce({ options, take }) {
71
+ const allContributors = lazyValue(async () => {
72
+ const contributions = await take(inputFromFileJSON, {
73
+ filePath: ".all-contributorsrc"
74
+ });
75
+ return contributions.contributors;
76
+ });
77
+ const documentation = lazyValue(
78
+ async () => swallowError(
79
+ await take(inputFromFile, {
80
+ filePath: ".github/DEVELOPMENT.md"
81
+ })
82
+ )
83
+ );
84
+ const nvmrc = lazyValue(
85
+ async () => await take(inputFromFile, {
86
+ filePath: ".nvmrc"
87
+ })
88
+ );
89
+ const gitDefaults = tryCatchLazyValueAsync(
90
+ async () => gitUrlParse(await gitRemoteOriginUrl())
91
+ );
92
+ const npmDefaults = tryCatchLazyValueAsync(async () => {
93
+ const whoami = (await execaCommand(`npm whoami`)).stdout;
94
+ return whoami ? await npmUser(whoami) : void 0;
95
+ });
96
+ const packageData = lazyValue(readPackageData);
97
+ const packageAuthor = lazyValue(
98
+ async () => parsePackageAuthor(await packageData())
99
+ );
100
+ const author = lazyValue(
101
+ async () => ((await packageAuthor()).author ?? (await npmDefaults())?.name ?? options.owner)?.toLowerCase()
102
+ );
103
+ const node = lazyValue(async () => {
104
+ const { engines } = await packageData();
105
+ return {
106
+ minimum: (engines?.node && /[\d+.]+/.exec(engines.node))?.[0] ?? "18.3.0",
107
+ pinned: swallowError(await nvmrc()) ?? "20.18.0"
108
+ };
109
+ });
110
+ const version = lazyValue(async () => (await packageData()).version);
111
+ return {
112
+ author,
113
+ bin: async () => (await packageData()).bin,
114
+ contributors: allContributors,
115
+ description: async () => (await packageData()).description,
116
+ documentation,
117
+ email: async () => readEmails(npmDefaults, packageAuthor),
118
+ funding: readFunding,
119
+ guide: readGuide,
120
+ login: author,
121
+ node,
122
+ owner: async () => (await gitDefaults())?.organization ?? (await packageAuthor()).author,
123
+ packageData: async () => {
124
+ const original = await packageData();
125
+ return {
126
+ dependencies: original.dependencies,
127
+ devDependencies: original.devDependencies,
128
+ scripts: original.scripts
129
+ };
130
+ },
131
+ repository: async () => options.repository ?? (await gitDefaults())?.name ?? (await packageData()).name,
132
+ ...readDefaultsFromReadme(),
133
+ version
134
+ };
135
+ },
136
+ template: {
137
+ owner: "JoshuaKGoldberg",
138
+ repository: "create-typescript-app"
139
+ }
140
+ });
141
+ export {
142
+ base
143
+ };
144
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/next/base.ts"],"sourcesContent":["import { BaseOptionsFor, createBase } from \"create\";\nimport { execaCommand } from \"execa\";\nimport gitRemoteOriginUrl from \"git-remote-origin-url\";\nimport gitUrlParse from \"git-url-parse\";\nimport { inputFromFile } from \"input-from-file\";\nimport { inputFromFileJSON } from \"input-from-file-json\";\nimport lazyValue from \"lazy-value\";\nimport npmUser from \"npm-user\";\nimport { z } from \"zod\";\n\nimport { parsePackageAuthor } from \"../shared/options/createOptionDefaults/parsePackageAuthor.js\";\nimport { readDefaultsFromReadme } from \"../shared/options/createOptionDefaults/readDefaultsFromReadme.js\";\nimport { readEmails } from \"../shared/options/createOptionDefaults/readEmails.js\";\nimport { readFunding } from \"../shared/options/createOptionDefaults/readFunding.js\";\nimport { readGuide } from \"../shared/options/createOptionDefaults/readGuide.js\";\nimport { readPackageData } from \"../shared/packages.js\";\nimport { tryCatchLazyValueAsync } from \"../shared/tryCatchLazyValueAsync.js\";\nimport { AllContributorsData } from \"../shared/types.js\";\nimport { swallowError } from \"./utils/swallowError.js\";\n\nexport const base = createBase({\n\toptions: {\n\t\taccess: z.union([z.literal(\"public\"), z.literal(\"restricted\")]).optional(),\n\t\tauthor: z.string().optional(),\n\t\tbin: z.string().optional(),\n\t\tcontributors: z\n\t\t\t.array(\n\t\t\t\tz.object({\n\t\t\t\t\tavatar_url: z.string(),\n\t\t\t\t\tcontributions: z.array(z.string()),\n\t\t\t\t\tlogin: z.string(),\n\t\t\t\t\tname: z.string(),\n\t\t\t\t\tprofile: z.string(),\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.optional(),\n\t\tdescription: z.string(),\n\t\tdocumentation: z.string().optional(),\n\t\temail: z\n\t\t\t.union([\n\t\t\t\tz.string(),\n\t\t\t\tz.object({\n\t\t\t\t\tgithub: z.string(),\n\t\t\t\t\tnpm: z.string(),\n\t\t\t\t}),\n\t\t\t])\n\t\t\t.transform((email) =>\n\t\t\t\ttypeof email === \"string\" ? { github: email, npm: email } : email,\n\t\t\t),\n\t\tfunding: z.string().optional(),\n\t\tguide: z\n\t\t\t.object({\n\t\t\t\thref: z.string(),\n\t\t\t\ttitle: z.string(),\n\t\t\t})\n\t\t\t.optional(),\n\t\thideTemplatedBy: z.boolean().optional(),\n\t\tkeywords: z.array(z.string()).optional(),\n\t\tlogin: z.string().optional(),\n\t\tlogo: z\n\t\t\t.object({\n\t\t\t\talt: z.string(),\n\t\t\t\tsrc: z.string(),\n\t\t\t})\n\t\t\t.optional(),\n\t\tnode: z\n\t\t\t.object({\n\t\t\t\tminimum: z.string(),\n\t\t\t\tpinned: z.string().optional(),\n\t\t\t})\n\t\t\t.optional(),\n\t\towner: z.string(),\n\t\tpackageData: z\n\t\t\t.object({\n\t\t\t\tdependencies: z.record(z.string(), z.string()).optional(),\n\t\t\t\tdevDependencies: z.record(z.string(), z.string()).optional(),\n\t\t\t\tscripts: z.record(z.string(), z.string()).optional(),\n\t\t\t})\n\t\t\t.optional(),\n\t\tpreserveGeneratedFrom: z.boolean().optional(),\n\t\trepository: z.string(),\n\t\ttitle: z.string(),\n\t\tversion: z.string().optional(),\n\t},\n\tproduce({ options, take }) {\n\t\tconst allContributors = lazyValue(async () => {\n\t\t\tconst contributions = (await take(inputFromFileJSON, {\n\t\t\t\tfilePath: \".all-contributorsrc\",\n\t\t\t})) as AllContributorsData;\n\n\t\t\treturn contributions.contributors;\n\t\t});\n\n\t\tconst documentation = lazyValue(async () =>\n\t\t\tswallowError(\n\t\t\t\tawait take(inputFromFile, {\n\t\t\t\t\tfilePath: \".github/DEVELOPMENT.md\",\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\n\t\tconst nvmrc = lazyValue(\n\t\t\tasync () =>\n\t\t\t\tawait take(inputFromFile, {\n\t\t\t\t\tfilePath: \".nvmrc\",\n\t\t\t\t}),\n\t\t);\n\n\t\t// TODO: Make these all use take\n\n\t\tconst gitDefaults = tryCatchLazyValueAsync(async () =>\n\t\t\tgitUrlParse(await gitRemoteOriginUrl()),\n\t\t);\n\n\t\tconst npmDefaults = tryCatchLazyValueAsync(async () => {\n\t\t\tconst whoami = (await execaCommand(`npm whoami`)).stdout;\n\t\t\treturn whoami ? await npmUser(whoami) : undefined;\n\t\t});\n\n\t\tconst packageData = lazyValue(readPackageData);\n\t\tconst packageAuthor = lazyValue(async () =>\n\t\t\tparsePackageAuthor(await packageData()),\n\t\t);\n\n\t\tconst author = lazyValue(async () =>\n\t\t\t(\n\t\t\t\t(await packageAuthor()).author ??\n\t\t\t\t(await npmDefaults())?.name ??\n\t\t\t\toptions.owner\n\t\t\t)?.toLowerCase(),\n\t\t);\n\n\t\tconst node = lazyValue(async () => {\n\t\t\tconst { engines } = await packageData();\n\n\t\t\treturn {\n\t\t\t\tminimum:\n\t\t\t\t\t(engines?.node && /[\\d+.]+/.exec(engines.node))?.[0] ?? \"18.3.0\",\n\t\t\t\tpinned: swallowError(await nvmrc()) ?? \"20.18.0\",\n\t\t\t};\n\t\t});\n\n\t\tconst version = lazyValue(async () => (await packageData()).version);\n\n\t\treturn {\n\t\t\tauthor,\n\t\t\tbin: async () => (await packageData()).bin,\n\t\t\tcontributors: allContributors,\n\t\t\tdescription: async () => (await packageData()).description,\n\t\t\tdocumentation,\n\t\t\temail: async () => readEmails(npmDefaults, packageAuthor),\n\t\t\tfunding: readFunding,\n\t\t\tguide: readGuide,\n\t\t\tlogin: author,\n\t\t\tnode,\n\t\t\towner: async () =>\n\t\t\t\t(await gitDefaults())?.organization ?? (await packageAuthor()).author,\n\t\t\tpackageData: async () => {\n\t\t\t\tconst original = await packageData();\n\n\t\t\t\treturn {\n\t\t\t\t\tdependencies: original.dependencies,\n\t\t\t\t\tdevDependencies: original.devDependencies,\n\t\t\t\t\tscripts: original.scripts,\n\t\t\t\t};\n\t\t\t},\n\t\t\trepository: async () =>\n\t\t\t\toptions.repository ??\n\t\t\t\t(await gitDefaults())?.name ??\n\t\t\t\t(await packageData()).name,\n\t\t\t...readDefaultsFromReadme(),\n\t\t\tversion,\n\t\t};\n\t},\n\ttemplate: {\n\t\towner: \"JoshuaKGoldberg\",\n\t\trepository: \"create-typescript-app\",\n\t},\n});\n\nexport type BaseOptions = BaseOptionsFor<typeof base>;\n"],"mappings":"AAAA,SAAyB,kBAAkB;AAC3C,SAAS,oBAAoB;AAC7B,OAAO,wBAAwB;AAC/B,OAAO,iBAAiB;AACxB,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,OAAO,eAAe;AACtB,OAAO,aAAa;AACpB,SAAS,SAAS;AAElB,SAAS,0BAA0B;AACnC,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,SAAS,8BAA8B;AAEvC,SAAS,oBAAoB;AAEtB,MAAM,OAAO,WAAW;AAAA,EAC9B,SAAS;AAAA,IACR,QAAQ,EAAE,MAAM,CAAC,EAAE,QAAQ,QAAQ,GAAG,EAAE,QAAQ,YAAY,CAAC,CAAC,EAAE,SAAS;AAAA,IACzE,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,IAC5B,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA,IACzB,cAAc,EACZ;AAAA,MACA,EAAE,OAAO;AAAA,QACR,YAAY,EAAE,OAAO;AAAA,QACrB,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,QACjC,OAAO,EAAE,OAAO;AAAA,QAChB,MAAM,EAAE,OAAO;AAAA,QACf,SAAS,EAAE,OAAO;AAAA,MACnB,CAAC;AAAA,IACF,EACC,SAAS;AAAA,IACX,aAAa,EAAE,OAAO;AAAA,IACtB,eAAe,EAAE,OAAO,EAAE,SAAS;AAAA,IACnC,OAAO,EACL,MAAM;AAAA,MACN,EAAE,O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