create-typescript-app 2.5.0 → 2.6.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 (129) hide show
  1. package/README.md +3 -3
  2. package/lib/base.d.ts +7 -6
  3. package/lib/base.js +122 -96
  4. package/lib/blocks/blockAllContributors.d.ts +1 -0
  5. package/lib/blocks/blockAreTheTypesWrong.d.ts +1 -0
  6. package/lib/blocks/blockCSpell.d.ts +1 -0
  7. package/lib/blocks/blockCodecov.d.ts +1 -0
  8. package/lib/blocks/blockContributingDocs.d.ts +1 -0
  9. package/lib/blocks/blockContributingDocs.js +2 -2
  10. package/lib/blocks/blockContributorCovenant.d.ts +1 -0
  11. package/lib/blocks/blockDevelopmentDocs.d.ts +1 -0
  12. package/lib/blocks/blockESLint.d.ts +1 -0
  13. package/lib/blocks/blockESLintComments.d.ts +1 -0
  14. package/lib/blocks/blockESLintJSDoc.d.ts +1 -0
  15. package/lib/blocks/blockESLintJSONC.d.ts +1 -0
  16. package/lib/blocks/blockESLintMarkdown.d.ts +1 -0
  17. package/lib/blocks/blockESLintMoreStyling.d.ts +1 -0
  18. package/lib/blocks/blockESLintNode.d.ts +1 -0
  19. package/lib/blocks/blockESLintNode.js +2 -9
  20. package/lib/blocks/blockESLintPackageJson.d.ts +1 -0
  21. package/lib/blocks/blockESLintPerfectionist.d.ts +1 -0
  22. package/lib/blocks/blockESLintRegexp.d.ts +1 -0
  23. package/lib/blocks/blockESLintYML.d.ts +1 -0
  24. package/lib/blocks/blockExampleFiles.d.ts +1 -0
  25. package/lib/blocks/blockFunding.d.ts +1 -0
  26. package/lib/blocks/blockGitHubActionsCI.d.ts +1 -0
  27. package/lib/blocks/blockGitHubApps.d.ts +1 -0
  28. package/lib/blocks/blockGitHubIssueTemplates.d.ts +1 -0
  29. package/lib/blocks/blockGitHubPRTemplate.d.ts +1 -0
  30. package/lib/blocks/blockGitHubPRTemplate.js +1 -1
  31. package/lib/blocks/blockGitignore.d.ts +1 -0
  32. package/lib/blocks/blockKnip.d.ts +1 -0
  33. package/lib/blocks/blockMITLicense.d.ts +1 -0
  34. package/lib/blocks/blockMarkdownlint.d.ts +1 -0
  35. package/lib/blocks/blockNvmrc.d.ts +1 -0
  36. package/lib/blocks/blockPRCompliance.d.ts +1 -0
  37. package/lib/blocks/blockPackageJson.d.ts +1 -0
  38. package/lib/blocks/blockPnpmDedupe.d.ts +1 -0
  39. package/lib/blocks/blockPrettier.d.ts +1 -0
  40. package/lib/blocks/blockPrettierPluginCurly.d.ts +1 -0
  41. package/lib/blocks/blockPrettierPluginPackageJson.d.ts +1 -0
  42. package/lib/blocks/blockPrettierPluginSh.d.ts +1 -0
  43. package/lib/blocks/blockREADME.d.ts +1 -0
  44. package/lib/blocks/blockREADME.js +1 -1
  45. package/lib/blocks/blockReleaseIt.d.ts +1 -0
  46. package/lib/blocks/blockRenovate.d.ts +1 -0
  47. package/lib/blocks/blockRepositoryBranchRuleset.d.ts +1 -0
  48. package/lib/blocks/blockRepositoryLabels.d.ts +1 -0
  49. package/lib/blocks/blockRepositorySecrets.d.ts +1 -0
  50. package/lib/blocks/blockRepositorySettings.d.ts +1 -0
  51. package/lib/blocks/blockSecurityDocs.d.ts +1 -0
  52. package/lib/blocks/blockTSup.d.ts +1 -0
  53. package/lib/blocks/blockTemplatedWith.d.ts +1 -0
  54. package/lib/blocks/blockTypeScript.d.ts +1 -0
  55. package/lib/blocks/blockVSCode.d.ts +1 -0
  56. package/lib/blocks/blockVitest.d.ts +1 -0
  57. package/lib/blocks/index.d.ts +43 -0
  58. package/lib/blocks/options.fakes.d.ts +1 -0
  59. package/lib/blocks/options.fakes.js +1 -0
  60. package/lib/constants.d.ts +8 -0
  61. package/lib/constants.js +9 -0
  62. package/lib/data/packageData.d.ts +3 -3
  63. package/lib/index.d.ts +2 -0
  64. package/lib/inputs/inputFromOctokit.js +1 -0
  65. package/lib/options/readAuthor.d.ts +7 -0
  66. package/lib/options/readAuthor.js +6 -0
  67. package/lib/options/readEmailFromCodeOfConduct.d.ts +5 -0
  68. package/lib/options/readEmailFromCodeOfConduct.js +10 -0
  69. package/lib/options/readEmailFromGit.d.ts +5 -0
  70. package/lib/options/readEmailFromGit.js +7 -0
  71. package/lib/options/readEmailFromNpm.d.ts +7 -0
  72. package/lib/options/readEmailFromNpm.js +6 -0
  73. package/lib/options/readEmails.d.ts +1 -6
  74. package/lib/options/readEmails.js +3 -8
  75. package/lib/options/readEmoji.d.ts +3 -0
  76. package/lib/options/readEmoji.js +6 -0
  77. package/lib/options/readExistingLabels.d.ts +9 -0
  78. package/lib/options/{getExistingLabels.js → readExistingLabels.js} +3 -2
  79. package/lib/options/readExplainer.d.ts +3 -0
  80. package/lib/options/readExplainer.js +12 -0
  81. package/lib/options/readFunding.d.ts +3 -1
  82. package/lib/options/readFunding.js +6 -6
  83. package/lib/options/readGitDefaults.d.ts +5 -0
  84. package/lib/options/readGitDefaults.js +12 -0
  85. package/lib/options/readGuide.d.ts +3 -1
  86. package/lib/options/readGuide.js +8 -3
  87. package/lib/options/readLogo.d.ts +8 -0
  88. package/lib/options/readLogo.js +19 -0
  89. package/lib/options/readNode.d.ts +8 -0
  90. package/lib/options/readNode.js +12 -0
  91. package/lib/options/readNpmDefaults.d.ts +6 -0
  92. package/lib/options/readNpmDefaults.js +9 -0
  93. package/lib/options/readOwner.d.ts +8 -0
  94. package/lib/options/readOwner.js +9 -0
  95. package/lib/options/readPackageAuthor.d.ts +8 -0
  96. package/lib/options/{parsePackageAuthor.js → readPackageAuthor.js} +3 -2
  97. package/lib/options/readPackageData.d.ts +5 -1
  98. package/lib/options/readPackageData.js +7 -3
  99. package/lib/options/readPackageDataFull.d.ts +6 -0
  100. package/lib/options/readPackageDataFull.js +9 -0
  101. package/lib/options/readRepository.d.ts +9 -0
  102. package/lib/options/readRepository.js +6 -0
  103. package/lib/options/readRulesetId.d.ts +5 -0
  104. package/lib/options/readRulesetId.js +16 -0
  105. package/lib/options/readTitle.d.ts +3 -0
  106. package/lib/options/readTitle.js +13 -0
  107. package/lib/options/readUsage.d.ts +3 -0
  108. package/lib/options/readUsage.js +14 -0
  109. package/lib/options/readUsageFromReadme.d.ts +3 -0
  110. package/lib/options/{getUsageFromReadme.js → readUsageFromReadme.js} +2 -2
  111. package/lib/presets/common.d.ts +1 -0
  112. package/lib/presets/everything.d.ts +1 -0
  113. package/lib/presets/index.d.ts +3 -0
  114. package/lib/presets/minimal.d.ts +1 -0
  115. package/lib/template.d.ts +1 -0
  116. package/lib/utils/swallowErrorAsync.d.ts +3 -0
  117. package/lib/utils/swallowErrorAsync.js +10 -0
  118. package/package.json +3 -3
  119. package/lib/options/getExistingLabels.d.ts +0 -9
  120. package/lib/options/getUsageFromReadme.d.ts +0 -3
  121. package/lib/options/parsePackageAuthor.d.ts +0 -8
  122. package/lib/options/readDefaultsFromReadme.d.ts +0 -13
  123. package/lib/options/readDefaultsFromReadme.js +0 -57
  124. package/lib/options/readGitHubEmail.d.ts +0 -3
  125. package/lib/options/readGitHubEmail.js +0 -11
  126. package/lib/utils/tryCatchAsync.d.ts +0 -3
  127. package/lib/utils/tryCatchAsync.js +0 -10
  128. package/lib/utils/tryCatchLazyValueAsync.d.ts +0 -3
  129. package/lib/utils/tryCatchLazyValueAsync.js +0 -8
@@ -1,57 +0,0 @@
1
- import lazyValue from "lazy-value";
2
- import { titleCase } from "title-case";
3
- import { getUsageFromReadme } from "./getUsageFromReadme.js";
4
- import { readLogoSizing } from "./readLogoSizing.js";
5
- function readDefaultsFromReadme(readme, repository) {
6
- const imageTag = lazyValue(
7
- async () => /\n<img.+src=.+>/.exec(await readme())?.[0]
8
- );
9
- return {
10
- explainer: async () => {
11
- const readmeText = await readme();
12
- const indexOfH2 = readmeText.indexOf("##");
13
- if (indexOfH2 === -1) {
14
- return void 0;
15
- }
16
- const lastTag = readmeText.slice(0, indexOfH2).lastIndexOf(">");
17
- return readmeText.slice(lastTag + 1, indexOfH2).split("\n").map((line) => line.trim()).filter(Boolean);
18
- },
19
- logo: async () => {
20
- const tag = await imageTag();
21
- if (!tag) {
22
- return void 0;
23
- }
24
- const src = /src\s*=(.+)['"/]>/.exec(tag)?.[1]?.split(/\s*\w+=/)[0].replaceAll(/^['"]|['"]$/g, "");
25
- if (!src) {
26
- return void 0;
27
- }
28
- return {
29
- alt: /alt=['"](.+)['"]\s*src=/.exec(tag)?.[1].split(/['"]?\s*\w+=/)[0] ?? "Project logo",
30
- src,
31
- ...readLogoSizing(src)
32
- };
33
- },
34
- title: async () => {
35
- const text = await readme();
36
- const fromText = (/^<h1\s+align="center">(.+)<\/h1>/.exec(text) ?? /^# (.+)/.exec(text))?.[1];
37
- if (fromText) {
38
- return fromText;
39
- }
40
- const repositoryValue = await repository();
41
- return repositoryValue && titleCase(repositoryValue).replaceAll("Eslint", "ESLint").replaceAll("Typescript", "TypeScript").replaceAll("-", " ");
42
- },
43
- usage: async () => {
44
- return getUsageFromReadme(await readme()) ?? `\`\`\`shell
45
- npm i ${await repository()}
46
- \`\`\`
47
- \`\`\`ts
48
- import { greet } from "${await repository()}";
49
-
50
- greet("Hello, world! \u{1F496}");
51
- \`\`\``;
52
- }
53
- };
54
- }
55
- export {
56
- readDefaultsFromReadme
57
- };
@@ -1,3 +0,0 @@
1
- declare function readGitHubEmail(): Promise<string | undefined>;
2
-
3
- export { readGitHubEmail };
@@ -1,11 +0,0 @@
1
- import { readFileSafe } from "./readFileSafe.js";
2
- async function readGitHubEmail() {
3
- const codeOfConduct = await readFileSafe(".github/CODE_OF_CONDUCT.md", "");
4
- if (!codeOfConduct.includes("Contributor Covenant Code of Conduct")) {
5
- return void 0;
6
- }
7
- return /for enforcement at[\r\n]+(.+)\.[\r\n]+All/.exec(codeOfConduct)?.[1];
8
- }
9
- export {
10
- readGitHubEmail
11
- };
@@ -1,3 +0,0 @@
1
- declare function tryCatchAsync<T>(get: () => Promise<T>): Promise<T | undefined>;
2
-
3
- export { tryCatchAsync };
@@ -1,10 +0,0 @@
1
- async function tryCatchAsync(get) {
2
- try {
3
- return await get();
4
- } catch {
5
- return void 0;
6
- }
7
- }
8
- export {
9
- tryCatchAsync
10
- };
@@ -1,3 +0,0 @@
1
- declare function tryCatchLazyValueAsync<T>(get: () => Promise<T>): () => Promise<T | undefined>;
2
-
3
- export { tryCatchLazyValueAsync };
@@ -1,8 +0,0 @@
1
- import lazyValue from "lazy-value";
2
- import { tryCatchAsync } from "./tryCatchAsync.js";
3
- function tryCatchLazyValueAsync(get) {
4
- return lazyValue(async () => await tryCatchAsync(get));
5
- }
6
- export {
7
- tryCatchLazyValueAsync
8
- };