create-typescript-app 2.39.0 → 2.40.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 (83) hide show
  1. package/lib/base.d.ts +11 -11
  2. package/lib/base.js +1 -1
  3. package/lib/blocks/blockAllContributors.d.ts +1 -1
  4. package/lib/blocks/blockAreTheTypesWrong.d.ts +1 -1
  5. package/lib/blocks/blockCSpell.d.ts +1 -1
  6. package/lib/blocks/blockCTATransitions.d.ts +1 -1
  7. package/lib/blocks/blockCodecov.d.ts +1 -1
  8. package/lib/blocks/blockContributingDocs.d.ts +1 -1
  9. package/lib/blocks/blockContributorCovenant.d.ts +1 -1
  10. package/lib/blocks/blockDevelopmentDocs.d.ts +1 -1
  11. package/lib/blocks/blockESLint.d.ts +1 -1
  12. package/lib/blocks/blockESLintComments.d.ts +1 -1
  13. package/lib/blocks/blockESLintJSDoc.d.ts +1 -1
  14. package/lib/blocks/blockESLintJSONC.d.ts +1 -1
  15. package/lib/blocks/blockESLintMarkdown.d.ts +1 -1
  16. package/lib/blocks/blockESLintMoreStyling.d.ts +1 -1
  17. package/lib/blocks/blockESLintNode.d.ts +1 -1
  18. package/lib/blocks/blockESLintPackageJson.d.ts +1 -1
  19. package/lib/blocks/blockESLintPerfectionist.d.ts +1 -1
  20. package/lib/blocks/blockESLintPlugin.d.ts +4 -2
  21. package/lib/blocks/blockESLintPlugin.js +62 -7
  22. package/lib/blocks/blockESLintRegexp.d.ts +1 -1
  23. package/lib/blocks/blockESLintYML.d.ts +1 -1
  24. package/lib/blocks/blockExampleFiles.d.ts +2 -1
  25. package/lib/blocks/blockExampleFiles.js +9 -1
  26. package/lib/blocks/blockFunding.d.ts +1 -1
  27. package/lib/blocks/blockGitHubActionsCI.d.ts +1 -1
  28. package/lib/blocks/blockGitHubApps.d.ts +1 -1
  29. package/lib/blocks/blockGitHubIssueTemplates.d.ts +1 -1
  30. package/lib/blocks/blockGitHubPRTemplate.d.ts +1 -1
  31. package/lib/blocks/blockGitignore.d.ts +1 -1
  32. package/lib/blocks/blockKnip.d.ts +1 -1
  33. package/lib/blocks/blockMITLicense.d.ts +1 -1
  34. package/lib/blocks/blockMain.d.ts +1 -1
  35. package/lib/blocks/blockMarkdownlint.d.ts +1 -1
  36. package/lib/blocks/blockNcc.d.ts +1 -1
  37. package/lib/blocks/blockNvmrc.d.ts +1 -1
  38. package/lib/blocks/blockPRCompliance.d.ts +1 -1
  39. package/lib/blocks/blockPackageJson.d.ts +1 -1
  40. package/lib/blocks/blockPnpmDedupe.d.ts +1 -1
  41. package/lib/blocks/blockPrettier.d.ts +1 -1
  42. package/lib/blocks/blockPrettierPluginCurly.d.ts +1 -1
  43. package/lib/blocks/blockPrettierPluginPackageJson.d.ts +1 -1
  44. package/lib/blocks/blockPrettierPluginSh.d.ts +1 -1
  45. package/lib/blocks/blockREADME.d.ts +2 -1
  46. package/lib/blocks/blockREADME.js +3 -2
  47. package/lib/blocks/blockReleaseIt.d.ts +1 -1
  48. package/lib/blocks/blockRemoveDependencies.d.ts +1 -1
  49. package/lib/blocks/blockRemoveFiles.d.ts +1 -1
  50. package/lib/blocks/blockRemoveWorkflows.d.ts +1 -1
  51. package/lib/blocks/blockRenovate.d.ts +1 -1
  52. package/lib/blocks/blockRepositoryBranchRuleset.d.ts +1 -1
  53. package/lib/blocks/blockRepositoryLabels.d.ts +1 -1
  54. package/lib/blocks/blockRepositorySecrets.d.ts +1 -1
  55. package/lib/blocks/blockRepositorySettings.d.ts +1 -1
  56. package/lib/blocks/blockSecurityDocs.d.ts +1 -1
  57. package/lib/blocks/blockTSup.d.ts +1 -1
  58. package/lib/blocks/blockTemplatedWith.d.ts +1 -1
  59. package/lib/blocks/blockTypeScript.d.ts +1 -1
  60. package/lib/blocks/blockTypeScript.js +11 -1
  61. package/lib/blocks/blockVSCode.d.ts +1 -1
  62. package/lib/blocks/blockVitest.d.ts +1 -1
  63. package/lib/blocks/blockWebExt.d.ts +1 -1
  64. package/lib/blocks/eslint/blockESLintPluginIntake.d.ts +5 -0
  65. package/lib/blocks/eslint/blockESLintPluginIntake.js +48 -0
  66. package/lib/blocks/eslint/schemas.d.ts +2 -1
  67. package/lib/blocks/eslint/schemas.js +2 -0
  68. package/lib/blocks/index.d.ts +51 -48
  69. package/lib/data/packageData.d.ts +1 -1
  70. package/lib/index.d.ts +6 -6
  71. package/lib/options/readDocumentation.d.ts +1 -1
  72. package/lib/options/readReadmeUsage.d.ts +1 -1
  73. package/lib/options/readReadmeUsage.js +14 -10
  74. package/lib/presets/common.d.ts +5 -5
  75. package/lib/presets/everything.d.ts +5 -5
  76. package/lib/presets/index.d.ts +15 -15
  77. package/lib/presets/minimal.d.ts +5 -5
  78. package/lib/schemas.d.ts +10 -10
  79. package/lib/schemas.js +1 -1
  80. package/lib/template.d.ts +5 -5
  81. package/package.json +1 -1
  82. package/lib/options/readUsageFromReadme.d.ts +0 -3
  83. package/lib/options/readUsageFromReadme.js +0 -17
@@ -8,10 +8,10 @@ declare const blockMarkdownlint: bingo_stratum.BlockWithAddons<{
8
8
  directory: string;
9
9
  documentation: {
10
10
  readme: {
11
- usage: string;
12
11
  additional?: string | undefined;
13
12
  explainer?: string | undefined;
14
13
  footnotes?: string | undefined;
14
+ usage?: string | undefined;
15
15
  };
16
16
  development?: string | undefined;
17
17
  };
@@ -8,10 +8,10 @@ declare const blockNcc: bingo_stratum.BlockWithAddons<{
8
8
  directory: string;
9
9
  documentation: {
10
10
  readme: {
11
- usage: string;
12
11
  additional?: string | undefined;
13
12
  explainer?: string | undefined;
14
13
  footnotes?: string | undefined;
14
+ usage?: string | undefined;
15
15
  };
16
16
  development?: string | undefined;
17
17
  };
@@ -6,10 +6,10 @@ declare const blockNvmrc: bingo_stratum.BlockWithoutAddons<{
6
6
  directory: string;
7
7
  documentation: {
8
8
  readme: {
9
- usage: string;
10
9
  additional?: string | undefined;
11
10
  explainer?: string | undefined;
12
11
  footnotes?: string | undefined;
12
+ usage?: string | undefined;
13
13
  };
14
14
  development?: string | undefined;
15
15
  };
@@ -6,10 +6,10 @@ declare const blockPRCompliance: bingo_stratum.BlockWithoutAddons<{
6
6
  directory: string;
7
7
  documentation: {
8
8
  readme: {
9
- usage: string;
10
9
  additional?: string | undefined;
11
10
  explainer?: string | undefined;
12
11
  footnotes?: string | undefined;
12
+ usage?: string | undefined;
13
13
  };
14
14
  development?: string | undefined;
15
15
  };
@@ -83,10 +83,10 @@ declare const blockPackageJson: bingo_stratum.BlockWithAddons<{
83
83
  directory: string;
84
84
  documentation: {
85
85
  readme: {
86
- usage: string;
87
86
  additional?: string | undefined;
88
87
  explainer?: string | undefined;
89
88
  footnotes?: string | undefined;
89
+ usage?: string | undefined;
90
90
  };
91
91
  development?: string | undefined;
92
92
  };
@@ -6,10 +6,10 @@ declare const blockPnpmDedupe: bingo_stratum.BlockWithoutAddons<{
6
6
  directory: string;
7
7
  documentation: {
8
8
  readme: {
9
- usage: string;
10
9
  additional?: string | undefined;
11
10
  explainer?: string | undefined;
12
11
  footnotes?: string | undefined;
12
+ usage?: string | undefined;
13
13
  };
14
14
  development?: string | undefined;
15
15
  };
@@ -16,10 +16,10 @@ declare const blockPrettier: bingo_stratum.BlockWithAddons<{
16
16
  directory: string;
17
17
  documentation: {
18
18
  readme: {
19
- usage: string;
20
19
  additional?: string | undefined;
21
20
  explainer?: string | undefined;
22
21
  footnotes?: string | undefined;
22
+ usage?: string | undefined;
23
23
  };
24
24
  development?: string | undefined;
25
25
  };
@@ -6,10 +6,10 @@ declare const blockPrettierPluginCurly: bingo_stratum.BlockWithoutAddons<{
6
6
  directory: string;
7
7
  documentation: {
8
8
  readme: {
9
- usage: string;
10
9
  additional?: string | undefined;
11
10
  explainer?: string | undefined;
12
11
  footnotes?: string | undefined;
12
+ usage?: string | undefined;
13
13
  };
14
14
  development?: string | undefined;
15
15
  };
@@ -6,10 +6,10 @@ declare const blockPrettierPluginPackageJson: bingo_stratum.BlockWithoutAddons<{
6
6
  directory: string;
7
7
  documentation: {
8
8
  readme: {
9
- usage: string;
10
9
  additional?: string | undefined;
11
10
  explainer?: string | undefined;
12
11
  footnotes?: string | undefined;
12
+ usage?: string | undefined;
13
13
  };
14
14
  development?: string | undefined;
15
15
  };
@@ -6,10 +6,10 @@ declare const blockPrettierPluginSh: bingo_stratum.BlockWithoutAddons<{
6
6
  directory: string;
7
7
  documentation: {
8
8
  readme: {
9
- usage: string;
10
9
  additional?: string | undefined;
11
10
  explainer?: string | undefined;
12
11
  footnotes?: string | undefined;
12
+ usage?: string | undefined;
13
13
  };
14
14
  development?: string | undefined;
15
15
  };
@@ -11,6 +11,7 @@ declare const blockREADME: bingo_stratum.BlockWithAddons<{
11
11
  after: string;
12
12
  } | undefined;
13
13
  }[];
14
+ defaultUsage: string[];
14
15
  notices: string[];
15
16
  }, {
16
17
  access: "public" | "restricted";
@@ -18,10 +19,10 @@ declare const blockREADME: bingo_stratum.BlockWithAddons<{
18
19
  directory: string;
19
20
  documentation: {
20
21
  readme: {
21
- usage: string;
22
22
  additional?: string | undefined;
23
23
  explainer?: string | undefined;
24
24
  footnotes?: string | undefined;
25
+ usage?: string | undefined;
25
26
  };
26
27
  development?: string | undefined;
27
28
  };
@@ -18,11 +18,12 @@ const blockREADME = base.createBlock({
18
18
  },
19
19
  addons: {
20
20
  badges: z.array(zBadge).default([]),
21
+ defaultUsage: z.array(z.string()).default([]),
21
22
  notices: z.array(z.string()).default([]),
22
23
  sections: z.array(z.string()).default([])
23
24
  },
24
25
  produce({ addons, options }) {
25
- const { badges, notices, sections } = addons;
26
+ const { badges, defaultUsage, notices, sections } = addons;
26
27
  const explainer = options.documentation.readme.explainer && `
27
28
  ${options.documentation.readme.explainer}
28
29
  `;
@@ -45,7 +46,7 @@ ${formatBadges(badges)}
45
46
  ${[logo, explainer].filter(Boolean).join("")}
46
47
  ## Usage
47
48
 
48
- ${options.documentation.readme.usage}
49
+ ${options.documentation.readme.usage ?? defaultUsage.join("\n\n")}
49
50
 
50
51
  ## Development
51
52
 
@@ -11,10 +11,10 @@ declare const blockReleaseIt: bingo_stratum.BlockWithAddons<{
11
11
  directory: string;
12
12
  documentation: {
13
13
  readme: {
14
- usage: string;
15
14
  additional?: string | undefined;
16
15
  explainer?: string | undefined;
17
16
  footnotes?: string | undefined;
17
+ usage?: string | undefined;
18
18
  };
19
19
  development?: string | undefined;
20
20
  };
@@ -8,10 +8,10 @@ declare const blockRemoveDependencies: bingo_stratum.BlockWithAddons<{
8
8
  directory: string;
9
9
  documentation: {
10
10
  readme: {
11
- usage: string;
12
11
  additional?: string | undefined;
13
12
  explainer?: string | undefined;
14
13
  footnotes?: string | undefined;
14
+ usage?: string | undefined;
15
15
  };
16
16
  development?: string | undefined;
17
17
  };
@@ -8,10 +8,10 @@ declare const blockRemoveFiles: bingo_stratum.BlockWithAddons<{
8
8
  directory: string;
9
9
  documentation: {
10
10
  readme: {
11
- usage: string;
12
11
  additional?: string | undefined;
13
12
  explainer?: string | undefined;
14
13
  footnotes?: string | undefined;
14
+ usage?: string | undefined;
15
15
  };
16
16
  development?: string | undefined;
17
17
  };
@@ -8,10 +8,10 @@ declare const blockRemoveWorkflows: bingo_stratum.BlockWithAddons<{
8
8
  directory: string;
9
9
  documentation: {
10
10
  readme: {
11
- usage: string;
12
11
  additional?: string | undefined;
13
12
  explainer?: string | undefined;
14
13
  footnotes?: string | undefined;
14
+ usage?: string | undefined;
15
15
  };
16
16
  development?: string | undefined;
17
17
  };
@@ -8,10 +8,10 @@ declare const blockRenovate: bingo_stratum.BlockWithAddons<{
8
8
  directory: string;
9
9
  documentation: {
10
10
  readme: {
11
- usage: string;
12
11
  additional?: string | undefined;
13
12
  explainer?: string | undefined;
14
13
  footnotes?: string | undefined;
14
+ usage?: string | undefined;
15
15
  };
16
16
  development?: string | undefined;
17
17
  };
@@ -8,10 +8,10 @@ declare const blockRepositoryBranchRuleset: bingo_stratum.BlockWithAddons<{
8
8
  directory: string;
9
9
  documentation: {
10
10
  readme: {
11
- usage: string;
12
11
  additional?: string | undefined;
13
12
  explainer?: string | undefined;
14
13
  footnotes?: string | undefined;
14
+ usage?: string | undefined;
15
15
  };
16
16
  development?: string | undefined;
17
17
  };
@@ -6,10 +6,10 @@ declare const blockRepositoryLabels: bingo_stratum.BlockWithoutAddons<{
6
6
  directory: string;
7
7
  documentation: {
8
8
  readme: {
9
- usage: string;
10
9
  additional?: string | undefined;
11
10
  explainer?: string | undefined;
12
11
  footnotes?: string | undefined;
12
+ usage?: string | undefined;
13
13
  };
14
14
  development?: string | undefined;
15
15
  };
@@ -11,10 +11,10 @@ declare const blockRepositorySecrets: bingo_stratum.BlockWithAddons<{
11
11
  directory: string;
12
12
  documentation: {
13
13
  readme: {
14
- usage: string;
15
14
  additional?: string | undefined;
16
15
  explainer?: string | undefined;
17
16
  footnotes?: string | undefined;
17
+ usage?: string | undefined;
18
18
  };
19
19
  development?: string | undefined;
20
20
  };
@@ -6,10 +6,10 @@ declare const blockRepositorySettings: bingo_stratum.BlockWithoutAddons<{
6
6
  directory: string;
7
7
  documentation: {
8
8
  readme: {
9
- usage: string;
10
9
  additional?: string | undefined;
11
10
  explainer?: string | undefined;
12
11
  footnotes?: string | undefined;
12
+ usage?: string | undefined;
13
13
  };
14
14
  development?: string | undefined;
15
15
  };
@@ -6,10 +6,10 @@ declare const blockSecurityDocs: bingo_stratum.BlockWithoutAddons<{
6
6
  directory: string;
7
7
  documentation: {
8
8
  readme: {
9
- usage: string;
10
9
  additional?: string | undefined;
11
10
  explainer?: string | undefined;
12
11
  footnotes?: string | undefined;
12
+ usage?: string | undefined;
13
13
  };
14
14
  development?: string | undefined;
15
15
  };
@@ -10,10 +10,10 @@ declare const blockTSup: bingo_stratum.BlockWithAddons<{
10
10
  directory: string;
11
11
  documentation: {
12
12
  readme: {
13
- usage: string;
14
13
  additional?: string | undefined;
15
14
  explainer?: string | undefined;
16
15
  footnotes?: string | undefined;
16
+ usage?: string | undefined;
17
17
  };
18
18
  development?: string | undefined;
19
19
  };
@@ -6,10 +6,10 @@ declare const blockTemplatedWith: bingo_stratum.BlockWithoutAddons<{
6
6
  directory: string;
7
7
  documentation: {
8
8
  readme: {
9
- usage: string;
10
9
  additional?: string | undefined;
11
10
  explainer?: string | undefined;
12
11
  footnotes?: string | undefined;
12
+ usage?: string | undefined;
13
13
  };
14
14
  development?: string | undefined;
15
15
  };
@@ -118,10 +118,10 @@ declare const blockTypeScript: bingo_stratum.BlockWithAddons<{
118
118
  directory: string;
119
119
  documentation: {
120
120
  readme: {
121
- usage: string;
122
121
  additional?: string | undefined;
123
122
  explainer?: string | undefined;
124
123
  footnotes?: string | undefined;
124
+ usage?: string | undefined;
125
125
  };
126
126
  development?: string | undefined;
127
127
  };
@@ -82,7 +82,17 @@ export * from "./types.js";
82
82
  times?: number;
83
83
  }
84
84
  `
85
- }
85
+ },
86
+ usage: [
87
+ `\`\`\`shell
88
+ npm i ${options.repository}
89
+ \`\`\`
90
+ \`\`\`ts
91
+ import { greet } from "${options.repository}";
92
+
93
+ greet("Hello, world! ${options.emoji}");
94
+ \`\`\``
95
+ ]
86
96
  }),
87
97
  blockGitignore({
88
98
  ignores: ["/lib"]
@@ -15,10 +15,10 @@ declare const blockVSCode: bingo_stratum.BlockWithAddons<{
15
15
  directory: string;
16
16
  documentation: {
17
17
  readme: {
18
- usage: string;
19
18
  additional?: string | undefined;
20
19
  explainer?: string | undefined;
21
20
  footnotes?: string | undefined;
21
+ usage?: string | undefined;
22
22
  };
23
23
  development?: string | undefined;
24
24
  };
@@ -23,10 +23,10 @@ declare const blockVitest: bingo_stratum.BlockWithAddons<{
23
23
  directory: string;
24
24
  documentation: {
25
25
  readme: {
26
- usage: string;
27
26
  additional?: string | undefined;
28
27
  explainer?: string | undefined;
29
28
  footnotes?: string | undefined;
29
+ usage?: string | undefined;
30
30
  };
31
31
  development?: string | undefined;
32
32
  };
@@ -6,10 +6,10 @@ declare const blockWebExt: bingo_stratum.BlockWithoutAddons<{
6
6
  directory: string;
7
7
  documentation: {
8
8
  readme: {
9
- usage: string;
10
9
  additional?: string | undefined;
11
10
  explainer?: string | undefined;
12
11
  footnotes?: string | undefined;
12
+ usage?: string | undefined;
13
13
  };
14
14
  development?: string | undefined;
15
15
  };
@@ -0,0 +1,5 @@
1
+ declare function blockESLintPluginIntake(sourceText: string): {
2
+ configEmoji: [string, string][];
3
+ } | undefined;
4
+
5
+ export { blockESLintPluginIntake };
@@ -0,0 +1,48 @@
1
+ import {
2
+ AST_NODE_TYPES,
3
+ parse as parseAST
4
+ } from "@typescript-eslint/typescript-estree";
5
+ import JSON5 from "json5";
6
+ import { tryCatch } from "../../utils/tryCatch.js";
7
+ import { zConfigEmoji } from "./schemas.js";
8
+ function blockESLintPluginIntake(sourceText) {
9
+ const ast = tryCatch(
10
+ () => parseAST(sourceText, {
11
+ comment: true,
12
+ loc: true,
13
+ range: true
14
+ })
15
+ );
16
+ if (!ast) {
17
+ return void 0;
18
+ }
19
+ const config = findConfig(ast.body);
20
+ if (!config) {
21
+ return void 0;
22
+ }
23
+ const configEmoji = findConfigEmoji(config.properties);
24
+ if (!configEmoji) {
25
+ return void 0;
26
+ }
27
+ const { data } = zConfigEmoji.safeParse(
28
+ JSON5.parse(sourceText.slice(...configEmoji.range))
29
+ );
30
+ return data && { configEmoji: data };
31
+ function findConfig(body) {
32
+ for (const node of body) {
33
+ if (node.type === AST_NODE_TYPES.VariableDeclaration && node.declarations[0].id.type === AST_NODE_TYPES.Identifier && node.declarations[0].id.name === "config" && node.declarations[0].init?.type === AST_NODE_TYPES.ObjectExpression) {
34
+ return node.declarations[0].init;
35
+ }
36
+ }
37
+ }
38
+ function findConfigEmoji(properties) {
39
+ for (const node of properties) {
40
+ if (node.type === AST_NODE_TYPES.Property && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "configEmoji" && node.value.type === AST_NODE_TYPES.ArrayExpression) {
41
+ return node.value;
42
+ }
43
+ }
44
+ }
45
+ }
46
+ export {
47
+ blockESLintPluginIntake
48
+ };
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ declare const zConfigEmoji: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">>;
3
4
  declare const zRuleOptions: z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"off">, z.ZodLiteral<"warn">, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown], null>, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">]>, z.ZodUnknown, z.ZodUnknown], null>]>;
4
5
  type RuleOptions = z.infer<typeof zRuleOptions>;
5
6
  declare const zExtensionRuleGroup: z.ZodObject<{
@@ -94,4 +95,4 @@ declare const zPackageImport: z.ZodObject<{
94
95
  types?: boolean | undefined;
95
96
  }>;
96
97
 
97
- export { type Extension, type ExtensionRuleGroup, type ExtensionRules, type RuleOptions, zExtension, zExtensionRuleGroup, zExtensionRules, zPackageImport, zRuleOptions };
98
+ export { type Extension, type ExtensionRuleGroup, type ExtensionRules, type RuleOptions, zConfigEmoji, zExtension, zExtensionRuleGroup, zExtensionRules, zPackageImport, zRuleOptions };
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ const zConfigEmoji = z.array(z.tuple([z.string(), z.string()])).optional();
2
3
  const zRuleOptions = z.union([
3
4
  z.literal("error"),
4
5
  z.literal("off"),
@@ -36,6 +37,7 @@ const zPackageImport = z.object({
36
37
  types: z.boolean().optional()
37
38
  });
38
39
  export {
40
+ zConfigEmoji,
39
41
  zExtension,
40
42
  zExtensionRuleGroup,
41
43
  zExtensionRules,