create-typescript-app 2.15.1 → 2.15.3

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 (78) hide show
  1. package/README.md +2 -2
  2. package/lib/base.d.ts +1 -1
  3. package/lib/base.js +1 -1
  4. package/lib/blocks/bin/getPrimaryBin.d.ts +3 -0
  5. package/lib/blocks/bin/getPrimaryBin.js +6 -0
  6. package/lib/blocks/blockAllContributors.d.ts +1 -1
  7. package/lib/blocks/blockAllContributors.js +12 -4
  8. package/lib/blocks/blockAreTheTypesWrong.d.ts +1 -1
  9. package/lib/blocks/blockCSpell.d.ts +1 -1
  10. package/lib/blocks/blockCTATransitions.d.ts +1 -1
  11. package/lib/blocks/blockCodecov.d.ts +1 -1
  12. package/lib/blocks/blockCodecov.js +10 -0
  13. package/lib/blocks/blockContributingDocs.d.ts +1 -1
  14. package/lib/blocks/blockContributorCovenant.d.ts +1 -1
  15. package/lib/blocks/blockContributorCovenant.js +12 -0
  16. package/lib/blocks/blockDevelopmentDocs.d.ts +1 -1
  17. package/lib/blocks/blockESLint.d.ts +1 -1
  18. package/lib/blocks/blockESLintComments.d.ts +1 -1
  19. package/lib/blocks/blockESLintJSDoc.d.ts +1 -1
  20. package/lib/blocks/blockESLintJSONC.d.ts +1 -1
  21. package/lib/blocks/blockESLintMarkdown.d.ts +1 -1
  22. package/lib/blocks/blockESLintMoreStyling.d.ts +1 -1
  23. package/lib/blocks/blockESLintNode.d.ts +1 -1
  24. package/lib/blocks/blockESLintPackageJson.d.ts +1 -1
  25. package/lib/blocks/blockESLintPerfectionist.d.ts +1 -1
  26. package/lib/blocks/blockESLintRegexp.d.ts +1 -1
  27. package/lib/blocks/blockESLintYML.d.ts +1 -1
  28. package/lib/blocks/blockExampleFiles.d.ts +1 -1
  29. package/lib/blocks/blockFunding.d.ts +1 -1
  30. package/lib/blocks/blockGitHubActionsCI.d.ts +1 -1
  31. package/lib/blocks/blockGitHubApps.d.ts +1 -1
  32. package/lib/blocks/blockGitHubIssueTemplates.d.ts +1 -1
  33. package/lib/blocks/blockGitHubPRTemplate.d.ts +1 -1
  34. package/lib/blocks/blockGitignore.d.ts +1 -1
  35. package/lib/blocks/blockKnip.d.ts +1 -1
  36. package/lib/blocks/blockMITLicense.d.ts +1 -1
  37. package/lib/blocks/blockMITLicense.js +11 -1
  38. package/lib/blocks/blockMarkdownlint.d.ts +1 -1
  39. package/lib/blocks/blockNcc.d.ts +1 -1
  40. package/lib/blocks/blockNvmrc.d.ts +1 -1
  41. package/lib/blocks/blockPRCompliance.d.ts +1 -1
  42. package/lib/blocks/blockPackageJson.d.ts +1 -1
  43. package/lib/blocks/blockPackageJson.js +8 -1
  44. package/lib/blocks/blockPnpmDedupe.d.ts +1 -1
  45. package/lib/blocks/blockPrettier.d.ts +1 -1
  46. package/lib/blocks/blockPrettierPluginCurly.d.ts +1 -1
  47. package/lib/blocks/blockPrettierPluginPackageJson.d.ts +1 -1
  48. package/lib/blocks/blockPrettierPluginSh.d.ts +1 -1
  49. package/lib/blocks/blockREADME.d.ts +10 -2
  50. package/lib/blocks/blockREADME.js +36 -11
  51. package/lib/blocks/blockReleaseIt.d.ts +1 -1
  52. package/lib/blocks/blockReleaseIt.js +10 -0
  53. package/lib/blocks/blockRemoveDependencies.d.ts +1 -1
  54. package/lib/blocks/blockRemoveFiles.d.ts +1 -1
  55. package/lib/blocks/blockRemoveWorkflows.d.ts +1 -1
  56. package/lib/blocks/blockRenovate.d.ts +1 -1
  57. package/lib/blocks/blockRepositoryBranchRuleset.d.ts +1 -1
  58. package/lib/blocks/blockRepositoryLabels.d.ts +1 -1
  59. package/lib/blocks/blockRepositorySecrets.d.ts +1 -1
  60. package/lib/blocks/blockRepositorySettings.d.ts +1 -1
  61. package/lib/blocks/blockSecurityDocs.d.ts +1 -1
  62. package/lib/blocks/blockTSup.d.ts +1 -1
  63. package/lib/blocks/blockTemplatedWith.d.ts +1 -1
  64. package/lib/blocks/blockTypeScript.d.ts +1 -1
  65. package/lib/blocks/blockTypeScript.js +4 -2
  66. package/lib/blocks/blockVSCode.d.ts +1 -1
  67. package/lib/blocks/blockVSCode.js +4 -2
  68. package/lib/blocks/blockVitest.d.ts +1 -1
  69. package/lib/blocks/index.d.ts +53 -45
  70. package/lib/data/packageData.d.ts +1 -1
  71. package/lib/index.d.ts +2 -2
  72. package/lib/presets/common.d.ts +1 -1
  73. package/lib/presets/everything.d.ts +1 -1
  74. package/lib/presets/index.d.ts +3 -3
  75. package/lib/presets/minimal.d.ts +1 -1
  76. package/lib/template.d.ts +1 -1
  77. package/lib/types.d.ts +1 -1
  78. package/package.json +1 -1
@@ -3,22 +3,31 @@ import { base } from "../base.js";
3
3
  function printAttributes(attributes) {
4
4
  return Object.entries(attributes).map(([key, value]) => `${key}="${value}"`).sort().join(" ");
5
5
  }
6
+ const zBadge = z.object({
7
+ alt: z.string(),
8
+ comments: z.object({
9
+ after: z.string(),
10
+ before: z.string()
11
+ }).optional(),
12
+ href: z.string().optional(),
13
+ src: z.string()
14
+ });
6
15
  const blockREADME = base.createBlock({
7
16
  about: {
8
17
  name: "README.md"
9
18
  },
10
19
  addons: {
11
- badges: z.array(z.string()).default([]),
20
+ badges: z.array(zBadge).default([]),
12
21
  notices: z.array(z.string()).default([]),
13
22
  sections: z.array(z.string()).default([])
14
23
  },
15
24
  produce({ addons, options }) {
16
25
  const { badges, notices, sections } = addons;
17
- const logo = options.logo && `
18
- <img ${printAttributes({ align: "right", ...options.logo })}>
19
- `;
20
26
  const explainer = options.explainer && `
21
27
  ${options.explainer.join("\n")}
28
+ `;
29
+ const logo = options.logo && `
30
+ <img ${printAttributes({ align: "right", ...options.logo })}>
22
31
  `;
23
32
  return {
24
33
  files: {
@@ -26,13 +35,8 @@ ${options.explainer.join("\n")}
26
35
 
27
36
  <p align="center">${formatDescription(options.description)}</p>
28
37
 
29
- <p align="center">${badges.length ? badges.map((badge) => `
30
- ${badge}`).join("\n") : ""}
31
- <a href="https://github.com/${options.owner}/${options.repository}/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="\u{1F91D} Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a>
32
- <a href="https://codecov.io/gh/${options.owner}/${options.repository}" target="_blank"><img alt="\u{1F9EA} Coverage" src="https://img.shields.io/codecov/c/github/${options.owner}/${options.repository}?label=%F0%9F%A7%AA%20coverage" /></a>
33
- <a href="https://github.com/${options.owner}/${options.repository}/blob/main/LICENSE.md" target="_blank"><img alt="\u{1F4DD} License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg"></a>
34
- <a href="http://npmjs.com/package/${options.repository}"><img alt="\u{1F4E6} npm version" src="https://img.shields.io/npm/v/${options.repository}?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
35
- <img alt="\u{1F4AA} TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
38
+ <p align="center">
39
+ ${formatBadges(badges)}
36
40
  </p>
37
41
  ${[logo, explainer].filter(Boolean).join("")}
38
42
  ## Usage
@@ -51,12 +55,33 @@ ${notices.map((notice) => notice.trim()).join("\n\n")}` : ""}`
51
55
  };
52
56
  }
53
57
  });
58
+ function badgeSorter(a, b) {
59
+ return removeEmojis(a.alt).localeCompare(removeEmojis(b.alt));
60
+ }
61
+ function formatBadge(badge) {
62
+ const image = `<img alt="${badge.alt}" src="${badge.src}" />`;
63
+ const tagged = badge.href ? `<a href="${badge.href}" target="_blank">${image}</a>` : image;
64
+ const commented = badge.comments ? `${badge.comments.before}${tagged}${badge.comments.after}` : tagged;
65
+ return ` ${commented}`;
66
+ }
67
+ function formatBadges(badges) {
68
+ return [
69
+ ...badges,
70
+ {
71
+ alt: "\u{1F4AA} TypeScript: Strict",
72
+ src: "https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg"
73
+ }
74
+ ].sort(badgeSorter).map(formatBadge).join("\n");
75
+ }
54
76
  function formatDescription(description) {
55
77
  if (!description.includes(". ")) {
56
78
  return description;
57
79
  }
58
80
  return "\n " + description.replaceAll(". ", ".\n ") + "\n";
59
81
  }
82
+ function removeEmojis(text) {
83
+ return text.replaceAll(/\p{Emoji}/gu, "").trim();
84
+ }
60
85
  export {
61
86
  blockREADME
62
87
  };
@@ -12,7 +12,7 @@ declare const blockReleaseIt: bingo_stratum.BlockWithoutAddons<{
12
12
  owner: string;
13
13
  repository: string;
14
14
  author?: string | undefined;
15
- bin?: string | undefined;
15
+ bin?: string | Record<string, string> | undefined;
16
16
  contributors?: {
17
17
  avatar_url: string;
18
18
  contributions: string[];
@@ -3,6 +3,7 @@ import { getPackageDependencies } from "../data/packageData.js";
3
3
  import { resolveUses } from "./actions/resolveUses.js";
4
4
  import { blockCSpell } from "./blockCSpell.js";
5
5
  import { blockPackageJson } from "./blockPackageJson.js";
6
+ import { blockREADME } from "./blockREADME.js";
6
7
  import { blockRemoveDependencies } from "./blockRemoveDependencies.js";
7
8
  import { blockRepositorySecrets } from "./blockRepositorySecrets.js";
8
9
  import { createSoloWorkflowFile } from "./files/createSoloWorkflowFile.js";
@@ -30,6 +31,15 @@ const blockReleaseIt = base.createBlock({
30
31
  }
31
32
  }
32
33
  }),
34
+ blockREADME({
35
+ badges: [
36
+ {
37
+ alt: "\u{1F4E6} npm version",
38
+ href: `http://npmjs.com/package/${options.repository}`,
39
+ src: `https://img.shields.io/npm/v/${options.repository}?color=21bb42&label=%F0%9F%93%A6%20npm`
40
+ }
41
+ ]
42
+ }),
33
43
  blockRemoveDependencies({
34
44
  dependencies: ["should-semantic-release"]
35
45
  }),
@@ -14,7 +14,7 @@ declare const blockRemoveDependencies: bingo_stratum.BlockWithAddons<{
14
14
  owner: string;
15
15
  repository: string;
16
16
  author?: string | undefined;
17
- bin?: string | undefined;
17
+ bin?: string | Record<string, string> | undefined;
18
18
  contributors?: {
19
19
  avatar_url: string;
20
20
  contributions: string[];
@@ -14,7 +14,7 @@ declare const blockRemoveFiles: bingo_stratum.BlockWithAddons<{
14
14
  owner: string;
15
15
  repository: string;
16
16
  author?: string | undefined;
17
- bin?: string | undefined;
17
+ bin?: string | Record<string, string> | undefined;
18
18
  contributors?: {
19
19
  avatar_url: string;
20
20
  contributions: string[];
@@ -14,7 +14,7 @@ declare const blockRemoveWorkflows: bingo_stratum.BlockWithAddons<{
14
14
  owner: string;
15
15
  repository: string;
16
16
  author?: string | undefined;
17
- bin?: string | undefined;
17
+ bin?: string | Record<string, string> | undefined;
18
18
  contributors?: {
19
19
  avatar_url: string;
20
20
  contributions: string[];
@@ -12,7 +12,7 @@ declare const blockRenovate: bingo_stratum.BlockWithoutAddons<{
12
12
  owner: string;
13
13
  repository: string;
14
14
  author?: string | undefined;
15
- bin?: string | undefined;
15
+ bin?: string | Record<string, string> | undefined;
16
16
  contributors?: {
17
17
  avatar_url: string;
18
18
  contributions: string[];
@@ -14,7 +14,7 @@ declare const blockRepositoryBranchRuleset: bingo_stratum.BlockWithAddons<{
14
14
  owner: string;
15
15
  repository: string;
16
16
  author?: string | undefined;
17
- bin?: string | undefined;
17
+ bin?: string | Record<string, string> | undefined;
18
18
  contributors?: {
19
19
  avatar_url: string;
20
20
  contributions: string[];
@@ -12,7 +12,7 @@ declare const blockRepositoryLabels: bingo_stratum.BlockWithoutAddons<{
12
12
  owner: string;
13
13
  repository: string;
14
14
  author?: string | undefined;
15
- bin?: string | undefined;
15
+ bin?: string | Record<string, string> | undefined;
16
16
  contributors?: {
17
17
  avatar_url: string;
18
18
  contributions: string[];
@@ -17,7 +17,7 @@ declare const blockRepositorySecrets: bingo_stratum.BlockWithAddons<{
17
17
  owner: string;
18
18
  repository: string;
19
19
  author?: string | undefined;
20
- bin?: string | undefined;
20
+ bin?: string | Record<string, string> | undefined;
21
21
  contributors?: {
22
22
  avatar_url: string;
23
23
  contributions: string[];
@@ -12,7 +12,7 @@ declare const blockRepositorySettings: bingo_stratum.BlockWithoutAddons<{
12
12
  owner: string;
13
13
  repository: string;
14
14
  author?: string | undefined;
15
- bin?: string | undefined;
15
+ bin?: string | Record<string, string> | undefined;
16
16
  contributors?: {
17
17
  avatar_url: string;
18
18
  contributions: string[];
@@ -12,7 +12,7 @@ declare const blockSecurityDocs: bingo_stratum.BlockWithoutAddons<{
12
12
  owner: string;
13
13
  repository: string;
14
14
  author?: string | undefined;
15
- bin?: string | undefined;
15
+ bin?: string | Record<string, string> | undefined;
16
16
  contributors?: {
17
17
  avatar_url: string;
18
18
  contributions: string[];
@@ -15,7 +15,7 @@ declare const blockTSup: bingo_stratum.BlockWithAddons<{
15
15
  owner: string;
16
16
  repository: string;
17
17
  author?: string | undefined;
18
- bin?: string | undefined;
18
+ bin?: string | Record<string, string> | undefined;
19
19
  contributors?: {
20
20
  avatar_url: string;
21
21
  contributions: string[];
@@ -12,7 +12,7 @@ declare const blockTemplatedWith: bingo_stratum.BlockWithoutAddons<{
12
12
  owner: string;
13
13
  repository: string;
14
14
  author?: string | undefined;
15
- bin?: string | undefined;
15
+ bin?: string | Record<string, string> | undefined;
16
16
  contributors?: {
17
17
  avatar_url: string;
18
18
  contributions: string[];
@@ -12,7 +12,7 @@ declare const blockTypeScript: bingo_stratum.BlockWithoutAddons<{
12
12
  owner: string;
13
13
  repository: string;
14
14
  author?: string | undefined;
15
- bin?: string | undefined;
15
+ bin?: string | Record<string, string> | undefined;
16
16
  contributors?: {
17
17
  avatar_url: string;
18
18
  contributions: string[];
@@ -1,5 +1,6 @@
1
1
  import { base } from "../base.js";
2
2
  import { getPackageDependencies } from "../data/packageData.js";
3
+ import { getPrimaryBin } from "./bin/getPrimaryBin.js";
3
4
  import { blockDevelopmentDocs } from "./blockDevelopmentDocs.js";
4
5
  import { blockExampleFiles } from "./blockExampleFiles.js";
5
6
  import { blockGitHubActionsCI } from "./blockGitHubActionsCI.js";
@@ -14,6 +15,7 @@ const blockTypeScript = base.createBlock({
14
15
  name: "TypeScript"
15
16
  },
16
17
  produce({ options }) {
18
+ const primaryBin = getPrimaryBin(options.bin, options.repository);
17
19
  return {
18
20
  addons: [
19
21
  blockDevelopmentDocs({
@@ -85,11 +87,11 @@ export * from "./types.js";
85
87
  }),
86
88
  blockVitest({ coverage: { include: ["src"] }, exclude: ["lib"] }),
87
89
  blockVSCode({
88
- debuggers: options.bin ? [
90
+ debuggers: primaryBin ? [
89
91
  {
90
92
  name: "Debug Program",
91
93
  preLaunchTask: "build",
92
- program: options.bin,
94
+ program: primaryBin,
93
95
  request: "launch",
94
96
  skipFiles: ["<node_internals>/**"],
95
97
  type: "node"
@@ -21,7 +21,7 @@ declare const blockVSCode: bingo_stratum.BlockWithAddons<{
21
21
  owner: string;
22
22
  repository: string;
23
23
  author?: string | undefined;
24
- bin?: string | undefined;
24
+ bin?: string | Record<string, string> | undefined;
25
25
  contributors?: {
26
26
  avatar_url: string;
27
27
  contributions: string[];
@@ -1,6 +1,7 @@
1
1
  import sortKeys from "sort-keys";
2
2
  import { z } from "zod";
3
3
  import { base } from "../base.js";
4
+ import { getPrimaryBin } from "./bin/getPrimaryBin.js";
4
5
  import { blockDevelopmentDocs } from "./blockDevelopmentDocs.js";
5
6
  const blockVSCode = base.createBlock({
6
7
  about: {
@@ -24,6 +25,7 @@ const blockVSCode = base.createBlock({
24
25
  },
25
26
  produce({ addons, options }) {
26
27
  const { debuggers, extensions, settings, tasks } = addons;
28
+ const primaryBin = getPrimaryBin(options.bin, options.repository);
27
29
  return {
28
30
  addons: [
29
31
  blockDevelopmentDocs({
@@ -33,12 +35,12 @@ const blockVSCode = base.createBlock({
33
35
  ],
34
36
  sections: {
35
37
  Building: {
36
- innerSections: options.bin ? [
38
+ innerSections: primaryBin ? [
37
39
  {
38
40
  contents: `
39
41
  This repository includes a [VS Code launch configuration](https://code.visualstudio.com/docs/editor/debugging) for debugging.
40
42
  To debug a \`bin\` app, add a breakpoint to your code, then run _Debug Program_ from the VS Code Debug panel (or press F5).
41
- VS Code will automatically run the \`build\` task in the background before running \`${options.bin}\`.
43
+ VS Code will automatically run the \`build\` task in the background before running \`${primaryBin}\`.
42
44
  `,
43
45
  heading: "Built App Debugging"
44
46
  }
@@ -27,7 +27,7 @@ declare const blockVitest: bingo_stratum.BlockWithAddons<{
27
27
  owner: string;
28
28
  repository: string;
29
29
  author?: string | undefined;
30
- bin?: string | undefined;
30
+ bin?: string | Record<string, string> | undefined;
31
31
  contributors?: {
32
32
  avatar_url: string;
33
33
  contributions: string[];