create-typescript-app 2.38.0 → 2.40.0

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.
@@ -1,4 +1,5 @@
1
1
  import { base } from "../base.js";
2
+ import { blockMarkdownlint } from "./blockMarkdownlint.js";
2
3
  import { blockREADME } from "./blockREADME.js";
3
4
  import { blockRemoveFiles } from "./blockRemoveFiles.js";
4
5
  const blockContributorCovenant = base.createBlock({
@@ -8,6 +9,9 @@ const blockContributorCovenant = base.createBlock({
8
9
  produce({ options }) {
9
10
  return {
10
11
  addons: [
12
+ blockMarkdownlint({
13
+ ignores: [".github/CODE_OF_CONDUCT.md"]
14
+ }),
11
15
  blockREADME({
12
16
  badges: [
13
17
  {
@@ -1,6 +1,8 @@
1
1
  import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
- declare const blockESLintPlugin: bingo_stratum.BlockWithoutAddons<{
3
+ declare const blockESLintPlugin: bingo_stratum.BlockWithAddons<{
4
+ configEmoji?: [string, string][] | undefined;
5
+ }, {
4
6
  access: "public" | "restricted";
5
7
  description: string;
6
8
  directory: string;
@@ -5,11 +5,24 @@ import { blockESLint } from "./blockESLint.js";
5
5
  import { blockGitHubActionsCI } from "./blockGitHubActionsCI.js";
6
6
  import { blockPackageJson } from "./blockPackageJson.js";
7
7
  import { blockVitest } from "./blockVitest.js";
8
+ import { blockESLintPluginIntake } from "./eslint/blockESLintPluginIntake.js";
9
+ import { zConfigEmoji } from "./eslint/schemas.js";
10
+ import { intakeFile } from "./intake/intakeFile.js";
8
11
  const blockESLintPlugin = base.createBlock({
9
12
  about: {
10
13
  name: "ESLint Plugin"
11
14
  },
12
- produce({ options }) {
15
+ addons: {
16
+ configEmoji: zConfigEmoji
17
+ },
18
+ intake({ files }) {
19
+ const docGeneratorConfigRaw = intakeFile(files, [
20
+ [".eslint-doc-generatorrc.js", ".eslint-doc-generatorrc.mjs"]
21
+ ]);
22
+ return docGeneratorConfigRaw ? blockESLintPluginIntake(docGeneratorConfigRaw[0]) : void 0;
23
+ },
24
+ produce({ addons, options }) {
25
+ const { configEmoji } = addons;
13
26
  const configFileName = `.eslint-doc-generatorrc.${options.type === "commonjs" ? "mjs" : "js"}`;
14
27
  return {
15
28
  addons: [
@@ -88,7 +101,8 @@ pnpm build:docs
88
101
 
89
102
  /** @type {import('eslint-doc-generator').GenerateOptions} */
90
103
  const config = {
91
- postprocess: async (content, path) =>
104
+ ${configEmoji ? `configEmoji: ${JSON.stringify(configEmoji)},
105
+ ` : ""}postprocess: async (content, path) =>
92
106
  prettier.format(content, {
93
107
  ...(await prettier.resolveConfig(path)),
94
108
  parser: "markdown",
@@ -7,6 +7,7 @@ import { blockPackageJson } from "./blockPackageJson.js";
7
7
  import { blockRemoveWorkflows } from "./blockRemoveWorkflows.js";
8
8
  import { blockVSCode } from "./blockVSCode.js";
9
9
  import { formatIgnoreFile } from "./files/formatIgnoreFile.js";
10
+ import { intakeFile } from "./intake/intakeFile.js";
10
11
  import { CommandPhase } from "./phases.js";
11
12
  const blockMarkdownlint = base.createBlock({
12
13
  about: {
@@ -15,6 +16,15 @@ const blockMarkdownlint = base.createBlock({
15
16
  addons: {
16
17
  ignores: z.array(z.string()).default([])
17
18
  },
19
+ intake({ files }) {
20
+ const markdownlintignoreRaw = intakeFile(files, [".markdownlintignore"]);
21
+ if (!markdownlintignoreRaw) {
22
+ return void 0;
23
+ }
24
+ return {
25
+ ignores: markdownlintignoreRaw[0].split("\n").filter(Boolean)
26
+ };
27
+ },
18
28
  produce({ addons }) {
19
29
  const { ignores } = addons;
20
30
  return {
@@ -61,12 +71,7 @@ const blockMarkdownlint = base.createBlock({
61
71
  "no-inline-html": false
62
72
  }),
63
73
  ".markdownlintignore": formatIgnoreFile(
64
- [
65
- ".github/CODE_OF_CONDUCT.md",
66
- "CHANGELOG.md",
67
- "node_modules/",
68
- ...ignores
69
- ].sort()
74
+ Array.from(/* @__PURE__ */ new Set(["node_modules/", ...ignores])).sort()
70
75
  )
71
76
  },
72
77
  scripts: [
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { base } from "../base.js";
3
3
  import { getPackageDependencies } from "../data/packageData.js";
4
4
  import { resolveUses } from "./actions/resolveUses.js";
5
+ import { blockMarkdownlint } from "./blockMarkdownlint.js";
5
6
  import { blockPackageJson } from "./blockPackageJson.js";
6
7
  import { blockREADME } from "./blockREADME.js";
7
8
  import { blockRepositorySecrets } from "./blockRepositorySecrets.js";
@@ -22,6 +23,9 @@ const blockReleaseIt = base.createBlock({
22
23
  const { builders } = addons;
23
24
  return {
24
25
  addons: [
26
+ blockMarkdownlint({
27
+ ignores: ["CHANGELOG.md"]
28
+ }),
25
29
  blockPackageJson({
26
30
  properties: {
27
31
  devDependencies: getPackageDependencies(
@@ -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,
@@ -1186,7 +1186,9 @@ declare const blocks: {
1186
1186
  hash?: string | undefined;
1187
1187
  }>> | undefined;
1188
1188
  }>;
1189
- blockESLintPlugin: bingo_stratum.BlockWithoutAddons<{
1189
+ blockESLintPlugin: bingo_stratum.BlockWithAddons<{
1190
+ configEmoji?: [string, string][] | undefined;
1191
+ }, {
1190
1192
  access: "public" | "restricted";
1191
1193
  description: string;
1192
1194
  directory: string;
@@ -1,5 +1,5 @@
1
1
  var name = "create-typescript-app";
2
- var version = "2.37.0";
2
+ var version = "2.39.0";
3
3
  var description = "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁";
4
4
  var repository = {
5
5
  type: "git",
@@ -95,7 +95,7 @@ var devDependencies = {
95
95
  "eslint-plugin-markdown": "5.1.0",
96
96
  "eslint-plugin-n": "17.16.2",
97
97
  "eslint-plugin-package-json": "0.29.0",
98
- "eslint-plugin-perfectionist": "4.10.1",
98
+ "eslint-plugin-perfectionist": "4.11.0",
99
99
  "eslint-plugin-regexp": "2.7.0",
100
100
  "eslint-plugin-yml": "1.17.0",
101
101
  husky: "9.1.7",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-typescript-app",
3
- "version": "2.38.0",
3
+ "version": "2.40.0",
4
4
  "description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁",
5
5
  "repository": {
6
6
  "type": "git",
@@ -99,7 +99,7 @@
99
99
  "eslint-plugin-markdown": "5.1.0",
100
100
  "eslint-plugin-n": "17.16.2",
101
101
  "eslint-plugin-package-json": "0.29.0",
102
- "eslint-plugin-perfectionist": "4.10.1",
102
+ "eslint-plugin-perfectionist": "4.11.0",
103
103
  "eslint-plugin-regexp": "2.7.0",
104
104
  "eslint-plugin-yml": "1.17.0",
105
105
  "husky": "9.1.7",