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
@@ -0,0 +1,5 @@
1
+ import { TakeInput } from 'bingo';
2
+
3
+ declare function readEmailFromGit(take: TakeInput): Promise<string | undefined>;
4
+
5
+ export { readEmailFromGit };
@@ -0,0 +1,7 @@
1
+ import { inputFromScript } from "input-from-script";
2
+ async function readEmailFromGit(take) {
3
+ return (await take(inputFromScript, { command: "git config --get user.email" })).stdout?.toString();
4
+ }
5
+ export {
6
+ readEmailFromGit
7
+ };
@@ -0,0 +1,7 @@
1
+ import { UserInfo } from 'npm-user';
2
+
3
+ declare function readEmailFromNpm(getNpmDefaults: () => Promise<undefined | UserInfo>, getPackageAuthor: () => Promise<{
4
+ email: string | undefined;
5
+ }>): Promise<string | undefined>;
6
+
7
+ export { readEmailFromNpm };
@@ -0,0 +1,6 @@
1
+ async function readEmailFromNpm(getNpmDefaults, getPackageAuthor) {
2
+ return (await getNpmDefaults())?.email ?? (await getPackageAuthor()).email;
3
+ }
4
+ export {
5
+ readEmailFromNpm
6
+ };
@@ -1,9 +1,4 @@
1
- import { UserInfo } from 'npm-user';
2
-
3
- declare function readEmails(npmDefaults: () => Promise<undefined | UserInfo>, packageAuthor: () => Promise<{
4
- author: string | undefined;
5
- email: string | undefined;
6
- }>): Promise<{
1
+ declare function readEmails(getEmailFromCodeOfConduct: () => Promise<string | undefined>, getEmailFromGit: () => Promise<string | undefined>, getEmailFromNpm: () => Promise<string | undefined>): Promise<{
7
2
  github: string;
8
3
  npm: string;
9
4
  } | undefined>;
@@ -1,11 +1,6 @@
1
- import { $ } from "execa";
2
- import { tryCatchAsync } from "../utils/tryCatchAsync.js";
3
- import { readGitHubEmail } from "./readGitHubEmail.js";
4
- async function readEmails(npmDefaults, packageAuthor) {
5
- const github = await readGitHubEmail() ?? await tryCatchAsync(
6
- async () => (await $`git config --get user.email`).stdout
7
- );
8
- const npm = ((await npmDefaults())?.email ?? (await packageAuthor()).email) || github;
1
+ async function readEmails(getEmailFromCodeOfConduct, getEmailFromGit, getEmailFromNpm) {
2
+ const github = await getEmailFromCodeOfConduct() ?? await getEmailFromGit();
3
+ const npm = await getEmailFromNpm() ?? github;
9
4
  return npm ? { github: github || npm, npm } : void 0;
10
5
  }
11
6
  export {
@@ -0,0 +1,3 @@
1
+ declare function readEmoji(getDescription: () => Promise<string | undefined>): Promise<string>;
2
+
3
+ export { readEmoji };
@@ -0,0 +1,6 @@
1
+ async function readEmoji(getDescription) {
2
+ return (await getDescription())?.match(/\p{Extended_Pictographic}/gu)?.at(-1) ?? "\u{1F496}";
3
+ }
4
+ export {
5
+ readEmoji
6
+ };
@@ -0,0 +1,9 @@
1
+ import { TakeInput } from 'bingo';
2
+
3
+ declare function readExistingLabels(take: TakeInput, getOwner: () => Promise<string | undefined>, getRepository: () => Promise<string | undefined>): Promise<{
4
+ color: string;
5
+ description: string;
6
+ name: string;
7
+ }[]>;
8
+
9
+ export { readExistingLabels };
@@ -1,6 +1,7 @@
1
1
  import { githubDefaultLabels } from "github-default-labels";
2
2
  import { inputFromOctokit } from "../inputs/inputFromOctokit.js";
3
- async function getExistingLabels(take, owner, repository) {
3
+ async function readExistingLabels(take, getOwner, getRepository) {
4
+ const [owner, repository] = await Promise.all([getOwner(), getRepository()]);
4
5
  const existingLabelsActual = owner && repository && await take(inputFromOctokit, {
5
6
  endpoint: "GET /repos/{owner}/{repo}/labels",
6
7
  options: {
@@ -18,5 +19,5 @@ async function getExistingLabels(take, owner, repository) {
18
19
  return githubDefaultLabels;
19
20
  }
20
21
  export {
21
- getExistingLabels
22
+ readExistingLabels
22
23
  };
@@ -0,0 +1,3 @@
1
+ declare function readExplainer(getReadme: () => Promise<string>): Promise<string[] | undefined>;
2
+
3
+ export { readExplainer };
@@ -0,0 +1,12 @@
1
+ async function readExplainer(getReadme) {
2
+ const readme = await getReadme();
3
+ const indexOfH2 = readme.indexOf("##");
4
+ if (indexOfH2 === -1) {
5
+ return void 0;
6
+ }
7
+ const lastTag = readme.slice(0, indexOfH2).lastIndexOf(">");
8
+ return readme.slice(lastTag + 1, indexOfH2).split("\n").map((line) => line.trim()).filter(Boolean);
9
+ }
10
+ export {
11
+ readExplainer
12
+ };
@@ -1,3 +1,5 @@
1
- declare function readFunding(): Promise<string | undefined>;
1
+ import { TakeInput } from 'bingo';
2
+
3
+ declare function readFunding(take: TakeInput): Promise<string | undefined>;
2
4
 
3
5
  export { readFunding };
@@ -1,9 +1,9 @@
1
- import fs from "node:fs/promises";
2
- import { tryCatchAsync } from "../utils/tryCatchAsync.js";
3
- async function readFunding() {
4
- return await tryCatchAsync(
5
- async () => (await fs.readFile(".github/FUNDING.yml")).toString().split(":")[1]?.trim()
6
- );
1
+ import { inputFromFile } from "input-from-file";
2
+ import { swallowError } from "../utils/swallowError.js";
3
+ async function readFunding(take) {
4
+ return swallowError(
5
+ await take(inputFromFile, { filePath: ".github/FUNDING.yml" })
6
+ )?.split(":")[1]?.trim();
7
7
  }
8
8
  export {
9
9
  readFunding
@@ -0,0 +1,5 @@
1
+ import gitUrlParse from 'git-url-parse';
2
+
3
+ declare function readGitDefaults(): Promise<gitUrlParse.GitUrl | undefined>;
4
+
5
+ export { readGitDefaults };
@@ -0,0 +1,12 @@
1
+ import gitRemoteOriginUrl from "git-remote-origin-url";
2
+ import gitUrlParse from "git-url-parse";
3
+ async function readGitDefaults() {
4
+ try {
5
+ return gitUrlParse(await gitRemoteOriginUrl());
6
+ } catch {
7
+ return void 0;
8
+ }
9
+ }
10
+ export {
11
+ readGitDefaults
12
+ };
@@ -1,4 +1,6 @@
1
- declare function readGuide(): Promise<{
1
+ import { TakeInput } from 'bingo';
2
+
3
+ declare function readGuide(take: TakeInput): Promise<{
2
4
  href: string;
3
5
  title: string;
4
6
  } | undefined>;
@@ -1,6 +1,11 @@
1
- import { readFileSafe } from "./readFileSafe.js";
2
- async function readGuide() {
3
- const development = await readFileSafe(".github/DEVELOPMENT.md", "");
1
+ import { inputFromFile } from "input-from-file";
2
+ async function readGuide(take) {
3
+ const development = await take(inputFromFile, {
4
+ filePath: ".github/DEVELOPMENT.md"
5
+ });
6
+ if (development instanceof Error) {
7
+ return void 0;
8
+ }
4
9
  const tag = /> .*guided walkthrough, see \[((?!\[).+)\]\((.+)\)/i.exec(
5
10
  development
6
11
  );
@@ -0,0 +1,8 @@
1
+ declare function readLogo(getReadme: () => Promise<string>): Promise<{
2
+ height?: number;
3
+ width?: number;
4
+ alt: string;
5
+ src: string;
6
+ } | undefined>;
7
+
8
+ export { readLogo };
@@ -0,0 +1,19 @@
1
+ import { readLogoSizing } from "./readLogoSizing.js";
2
+ async function readLogo(getReadme) {
3
+ const tag = /\n<img.+src=.+>/.exec(await getReadme())?.[0];
4
+ if (!tag) {
5
+ return void 0;
6
+ }
7
+ const src = /src\s*=(.+)['"/]>/.exec(tag)?.[1]?.split(/\s*\w+=/)[0].replaceAll(/^['"]|['"]$/g, "");
8
+ if (!src) {
9
+ return void 0;
10
+ }
11
+ return {
12
+ alt: /alt=['"](.+)['"]\s*src=/.exec(tag)?.[1].split(/['"]?\s*\w+=/)[0] ?? "Project logo",
13
+ src,
14
+ ...readLogoSizing(src)
15
+ };
16
+ }
17
+ export {
18
+ readLogo
19
+ };
@@ -0,0 +1,8 @@
1
+ import { PartialPackageData } from '../types.js';
2
+
3
+ declare function readNode(getNvmrc: () => Promise<Error | string>, getPackageDataFull: () => Promise<PartialPackageData>): Promise<{
4
+ minimum: string;
5
+ pinned: string;
6
+ }>;
7
+
8
+ export { readNode };
@@ -0,0 +1,12 @@
1
+ import { defaults } from "../constants.js";
2
+ import { swallowError } from "../utils/swallowError.js";
3
+ async function readNode(getNvmrc, getPackageDataFull) {
4
+ const { engines } = await getPackageDataFull();
5
+ return {
6
+ minimum: (engines?.node && /[\d+.]+/.exec(engines.node))?.[0] ?? defaults.node.minimum,
7
+ pinned: swallowError(await getNvmrc())?.trim() || defaults.node.pinned
8
+ };
9
+ }
10
+ export {
11
+ readNode
12
+ };
@@ -0,0 +1,6 @@
1
+ import * as npm_user from 'npm-user';
2
+ import { ExecaError, Result } from 'execa';
3
+
4
+ declare function readNpmDefaults(getNpmWhoami: () => Promise<ExecaError | Result | undefined>): Promise<npm_user.UserInfo | undefined>;
5
+
6
+ export { readNpmDefaults };
@@ -0,0 +1,9 @@
1
+ import npmUser from "npm-user";
2
+ import { swallowErrorAsync } from "../utils/swallowErrorAsync.js";
3
+ async function readNpmDefaults(getNpmWhoami) {
4
+ const whoami = await getNpmWhoami();
5
+ return typeof whoami?.stdout === "string" ? await swallowErrorAsync(npmUser(whoami.stdout)) : void 0;
6
+ }
7
+ export {
8
+ readNpmDefaults
9
+ };
@@ -0,0 +1,8 @@
1
+ import { TakeInput } from 'bingo';
2
+ import { GitUrl } from 'git-url-parse';
3
+
4
+ declare function readOwner(take: TakeInput, getGitDefaults: () => Promise<GitUrl | undefined>, getPackageAuthor: () => Promise<{
5
+ author?: string;
6
+ }>): Promise<string | undefined>;
7
+
8
+ export { readOwner };
@@ -0,0 +1,9 @@
1
+ import { inputFromScript } from "input-from-script";
2
+ async function readOwner(take, getGitDefaults, getPackageAuthor) {
3
+ return (await getGitDefaults())?.organization ?? (await getPackageAuthor()).author ?? (await take(inputFromScript, {
4
+ command: "gh config get user -h github.com"
5
+ })).stdout?.toString();
6
+ }
7
+ export {
8
+ readOwner
9
+ };
@@ -0,0 +1,8 @@
1
+ import { PartialPackageData } from '../types.js';
2
+
3
+ declare function readPackageAuthor(getPackageDataFull: () => Promise<PartialPackageData>): Promise<{
4
+ author: string | undefined;
5
+ email: string | undefined;
6
+ }>;
7
+
8
+ export { readPackageAuthor };
@@ -1,5 +1,6 @@
1
1
  import parse from "parse-author";
2
- function parsePackageAuthor(packageData) {
2
+ async function readPackageAuthor(getPackageDataFull) {
3
+ const packageData = await getPackageDataFull();
3
4
  let packageAuthor;
4
5
  let packageEmail;
5
6
  if (typeof packageData.author === "string") {
@@ -16,5 +17,5 @@ function parsePackageAuthor(packageData) {
16
17
  };
17
18
  }
18
19
  export {
19
- parsePackageAuthor
20
+ readPackageAuthor
20
21
  };
@@ -1,5 +1,9 @@
1
1
  import { PartialPackageData } from '../types.js';
2
2
 
3
- declare function readPackageData(): Promise<PartialPackageData>;
3
+ declare function readPackageData(getPackageDataFull: () => Promise<PartialPackageData>): Promise<{
4
+ dependencies: Record<string, string> | undefined;
5
+ devDependencies: Record<string, string> | undefined;
6
+ scripts: Record<string, string> | undefined;
7
+ }>;
4
8
 
5
9
  export { readPackageData };
@@ -1,6 +1,10 @@
1
- import { readFileSafe } from "./readFileSafe.js";
2
- async function readPackageData() {
3
- return JSON.parse(await readFileSafe("./package.json", "{}")) ?? {};
1
+ async function readPackageData(getPackageDataFull) {
2
+ const original = await getPackageDataFull();
3
+ return {
4
+ dependencies: original.dependencies,
5
+ devDependencies: original.devDependencies,
6
+ scripts: original.scripts
7
+ };
4
8
  }
5
9
  export {
6
10
  readPackageData
@@ -0,0 +1,6 @@
1
+ import { TakeInput } from 'bingo';
2
+ import { PartialPackageData } from '../types.js';
3
+
4
+ declare function readPackageDataFull(take: TakeInput): Promise<PartialPackageData>;
5
+
6
+ export { readPackageDataFull };
@@ -0,0 +1,9 @@
1
+ import { inputFromFileJSON } from "input-from-file-json";
2
+ async function readPackageDataFull(take) {
3
+ return await take(inputFromFileJSON, {
4
+ filePath: "./package.json"
5
+ }) ?? {};
6
+ }
7
+ export {
8
+ readPackageDataFull
9
+ };
@@ -0,0 +1,9 @@
1
+ import { GitUrl } from 'git-url-parse';
2
+ import { PartialPackageData } from '../types.js';
3
+
4
+ declare function readRepository(getGitDefaults: () => Promise<GitUrl | undefined>, getPackageDataFull: () => Promise<PartialPackageData>, options: {
5
+ directory?: string;
6
+ repository?: string;
7
+ }): Promise<string | undefined>;
8
+
9
+ export { readRepository };
@@ -0,0 +1,6 @@
1
+ async function readRepository(getGitDefaults, getPackageDataFull, options) {
2
+ return options.repository ?? (await getGitDefaults())?.name ?? (await getPackageDataFull()).name ?? options.directory;
3
+ }
4
+ export {
5
+ readRepository
6
+ };
@@ -0,0 +1,5 @@
1
+ import { TakeInput } from 'bingo';
2
+
3
+ declare function readRulesetId(take: TakeInput, getOwner: () => Promise<string | undefined>, getRepository: () => Promise<string | undefined>): Promise<string | undefined>;
4
+
5
+ export { readRulesetId };
@@ -0,0 +1,16 @@
1
+ import { inputFromOctokit } from "../inputs/inputFromOctokit.js";
2
+ async function readRulesetId(take, getOwner, getRepository) {
3
+ const rulesets = await take(inputFromOctokit, {
4
+ endpoint: "GET /repos/{owner}/{repo}/rulesets",
5
+ options: {
6
+ owner: await getOwner(),
7
+ repo: await getRepository()
8
+ }
9
+ });
10
+ return rulesets?.find(
11
+ (ruleset) => ruleset.name === "Branch protection for main"
12
+ )?.id;
13
+ }
14
+ export {
15
+ readRulesetId
16
+ };
@@ -0,0 +1,3 @@
1
+ declare function readTitle(getReadme: () => Promise<string>, getRepository: () => Promise<string | undefined>): Promise<string | undefined>;
2
+
3
+ export { readTitle };
@@ -0,0 +1,13 @@
1
+ import { titleCase } from "title-case";
2
+ async function readTitle(getReadme, getRepository) {
3
+ const text = await getReadme();
4
+ const fromText = (/^<h1\s+align="center">(.+)<\/h1>/.exec(text) ?? /^# (.+)/.exec(text))?.[1];
5
+ if (fromText) {
6
+ return fromText;
7
+ }
8
+ const repositoryValue = await getRepository();
9
+ return repositoryValue && titleCase(repositoryValue).replaceAll("Eslint", "ESLint").replaceAll("Typescript", "TypeScript").replaceAll("-", " ");
10
+ }
11
+ export {
12
+ readTitle
13
+ };
@@ -0,0 +1,3 @@
1
+ declare function readUsage(getEmoji: () => Promise<string>, getReadme: () => Promise<string>, getRepository: () => Promise<string | undefined>): Promise<string>;
2
+
3
+ export { readUsage };
@@ -0,0 +1,14 @@
1
+ import { readUsageFromReadme } from "./readUsageFromReadme.js";
2
+ async function readUsage(getEmoji, getReadme, getRepository) {
3
+ return readUsageFromReadme(await getReadme()) ?? `\`\`\`shell
4
+ npm i ${await getRepository()}
5
+ \`\`\`
6
+ \`\`\`ts
7
+ import { greet } from "${await getRepository()}";
8
+
9
+ greet("Hello, world! ${await getEmoji()}");
10
+ \`\`\``;
11
+ }
12
+ export {
13
+ readUsage
14
+ };
@@ -0,0 +1,3 @@
1
+ declare function readUsageFromReadme(readme: string): string | undefined;
2
+
3
+ export { readUsageFromReadme };
@@ -1,6 +1,6 @@
1
1
  const startDevelopment = "## Development";
2
2
  const startUsage = "## Usage";
3
- function getUsageFromReadme(readme) {
3
+ function readUsageFromReadme(readme) {
4
4
  const indexOfUsage = readme.indexOf(startUsage);
5
5
  if (indexOfUsage === -1) {
6
6
  return void 0;
@@ -16,5 +16,5 @@ function getUsageFromReadme(readme) {
16
16
  return usage ? usage : void 0;
17
17
  }
18
18
  export {
19
- getUsageFromReadme
19
+ readUsageFromReadme
20
20
  };
@@ -43,6 +43,7 @@ declare const presetCommon: bingo_stratum.Preset<{
43
43
  github: string;
44
44
  npm: string;
45
45
  }>;
46
+ emoji: zod.ZodOptional<zod.ZodString>;
46
47
  existingLabels: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
47
48
  color: zod.ZodString;
48
49
  description: zod.ZodString;
@@ -43,6 +43,7 @@ declare const presetEverything: bingo_stratum.Preset<{
43
43
  github: string;
44
44
  npm: string;
45
45
  }>;
46
+ emoji: zod.ZodOptional<zod.ZodString>;
46
47
  existingLabels: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
47
48
  color: zod.ZodString;
48
49
  description: zod.ZodString;
@@ -47,6 +47,7 @@ declare const presets: {
47
47
  github: string;
48
48
  npm: string;
49
49
  }>;
50
+ emoji: zod.ZodOptional<zod.ZodString>;
50
51
  existingLabels: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
51
52
  color: zod.ZodString;
52
53
  description: zod.ZodString;
@@ -162,6 +163,7 @@ declare const presets: {
162
163
  github: string;
163
164
  npm: string;
164
165
  }>;
166
+ emoji: zod.ZodOptional<zod.ZodString>;
165
167
  existingLabels: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
166
168
  color: zod.ZodString;
167
169
  description: zod.ZodString;
@@ -277,6 +279,7 @@ declare const presets: {
277
279
  github: string;
278
280
  npm: string;
279
281
  }>;
282
+ emoji: zod.ZodOptional<zod.ZodString>;
280
283
  existingLabels: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
281
284
  color: zod.ZodString;
282
285
  description: zod.ZodString;
@@ -43,6 +43,7 @@ declare const presetMinimal: bingo_stratum.Preset<{
43
43
  github: string;
44
44
  npm: string;
45
45
  }>;
46
+ emoji: zod.ZodOptional<zod.ZodString>;
46
47
  existingLabels: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
47
48
  color: zod.ZodString;
48
49
  description: zod.ZodString;
package/lib/template.d.ts CHANGED
@@ -43,6 +43,7 @@ declare const template: bingo_stratum_lib_types_templates_js.StratumTemplate<{
43
43
  github: string;
44
44
  npm: string;
45
45
  }>;
46
+ emoji: zod.ZodOptional<zod.ZodString>;
46
47
  existingLabels: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
47
48
  color: zod.ZodString;
48
49
  description: zod.ZodString;
@@ -0,0 +1,3 @@
1
+ declare function swallowErrorAsync<T>(task: Promise<T>): Promise<T | undefined>;
2
+
3
+ export { swallowErrorAsync };
@@ -0,0 +1,10 @@
1
+ async function swallowErrorAsync(task) {
2
+ try {
3
+ return await task;
4
+ } catch {
5
+ return void 0;
6
+ }
7
+ }
8
+ export {
9
+ swallowErrorAsync
10
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-typescript-app",
3
- "version": "2.5.0",
3
+ "version": "2.6.1",
4
4
  "description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁",
5
5
  "repository": {
6
6
  "type": "git",
@@ -90,7 +90,7 @@
90
90
  "eslint-plugin-markdown": "5.1.0",
91
91
  "eslint-plugin-n": "17.16.2",
92
92
  "eslint-plugin-package-json": "0.26.2",
93
- "eslint-plugin-perfectionist": "4.9.0",
93
+ "eslint-plugin-perfectionist": "4.10.0",
94
94
  "eslint-plugin-regexp": "2.7.0",
95
95
  "eslint-plugin-yml": "1.17.0",
96
96
  "husky": "9.1.7",
@@ -110,7 +110,7 @@
110
110
  "typescript-eslint": "8.26.0",
111
111
  "vitest": "3.0.7"
112
112
  },
113
- "packageManager": "pnpm@10.5.2",
113
+ "packageManager": "pnpm@10.6.0",
114
114
  "engines": {
115
115
  "node": ">=18.3.0"
116
116
  },
@@ -1,9 +0,0 @@
1
- import { TakeInput } from 'bingo';
2
-
3
- declare function getExistingLabels(take: TakeInput, owner: string | undefined, repository: string | undefined): Promise<{
4
- color: string;
5
- description: string;
6
- name: string;
7
- }[]>;
8
-
9
- export { getExistingLabels };
@@ -1,3 +0,0 @@
1
- declare function getUsageFromReadme(readme: string): string | undefined;
2
-
3
- export { getUsageFromReadme };
@@ -1,8 +0,0 @@
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 };
@@ -1,13 +0,0 @@
1
- declare function readDefaultsFromReadme(readme: () => Promise<string>, repository: () => Promise<string | undefined>): {
2
- explainer: () => Promise<string[] | undefined>;
3
- logo: () => Promise<{
4
- height?: number;
5
- width?: number;
6
- alt: string;
7
- src: string;
8
- } | undefined>;
9
- title: () => Promise<string | undefined>;
10
- usage: () => Promise<string>;
11
- };
12
-
13
- export { readDefaultsFromReadme };