create-typescript-app 2.66.0 → 2.67.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.
@@ -4,6 +4,7 @@ import { base } from "../base.mjs";
4
4
  import { resolveBin } from "../utils/resolveBin.mjs";
5
5
  import { CommandPhase } from "./phases.mjs";
6
6
  import { blockGitHubActionsCI } from "./blockGitHubActionsCI.mjs";
7
+ import { formatFile } from "../utils/formatFile.mjs";
7
8
  import { blockPackageJson } from "./blockPackageJson.mjs";
8
9
  import { blockDevelopmentDocs } from "./blockDevelopmentDocs.mjs";
9
10
  import { blockRemoveWorkflows } from "./blockRemoveWorkflows.mjs";
@@ -44,7 +45,7 @@ const blockCSpell = base.createBlock({
44
45
  scripts: { "lint:spelling": `cspell ${filesGlob}` }
45
46
  } })
46
47
  ],
47
- files: { "cspell.json": JSON.stringify({
48
+ files: { "cspell.json": formatFile("cspell.json", JSON.stringify({
48
49
  dictionaries: [
49
50
  "npm",
50
51
  "node",
@@ -59,7 +60,7 @@ const blockCSpell = base.createBlock({
59
60
  ...ignorePaths
60
61
  ])).sort(),
61
62
  ...allWords.length && { words: allWords }
62
- }) }
63
+ })) }
63
64
  };
64
65
  },
65
66
  setup({ options }) {
@@ -5,6 +5,7 @@ import { CommandPhase } from "./phases.mjs";
5
5
  import { blockRemoveFiles } from "./blockRemoveFiles.mjs";
6
6
  import { withPreviously } from "./files/withPreviously.mjs";
7
7
  import { blockGitHubActionsCI } from "./blockGitHubActionsCI.mjs";
8
+ import { formatFile } from "../utils/formatFile.mjs";
8
9
  import { blockPackageJson } from "./blockPackageJson.mjs";
9
10
  import { blockDevelopmentDocs } from "./blockDevelopmentDocs.mjs";
10
11
  import { blockRemoveWorkflows } from "./blockRemoveWorkflows.mjs";
@@ -116,13 +117,13 @@ Each should be shown in VS Code, and can be run manually on the command-line:
116
117
  }
117
118
  })
118
119
  ],
119
- files: { [configFileName]: withPreviously(`${explanation}${importLines.join("\n")}
120
+ files: { [configFileName]: withPreviously(formatFile(configFileName, `${explanation}${importLines.join("\n")}
120
121
 
121
122
  export default defineConfig(
122
123
  globalIgnores( [${ignoreLines.join(", ")}], "Global Ignores" ),
123
124
  { linterOptions: { reportUnusedDisableDirectives: "error" } },
124
125
  ${extensionLines.join(",")}
125
- );`, ["eslint.config.js", "eslint.config.mjs"]) },
126
+ );`), ["eslint.config.js", "eslint.config.mjs"]) },
126
127
  scripts: [{
127
128
  commands: ["pnpm lint --fix"],
128
129
  phase: CommandPhase.Process
@@ -173,7 +174,7 @@ function printExtension(extension) {
173
174
  extension.extends && `extends: [${extension.extends.join(", ")}],`,
174
175
  `files: [${extension.files.map((glob) => JSON.stringify(glob)).join(", ")}],`,
175
176
  extension.languageOptions && `languageOptions: ${JSON.stringify(extension.languageOptions).replace("\"import.meta.dirname\"", "import.meta.dirname")},`,
176
- extension.linterOptions && `linterOptions: ${JSON.stringify(extension.linterOptions)}`,
177
+ extension.linterOptions && `linterOptions: ${JSON.stringify(extension.linterOptions)},`,
177
178
  extension.rules && `rules: ${printExtensionRules(extension.rules)},`,
178
179
  extension.settings && `settings: ${JSON.stringify(sortKeys(extension.settings))},`,
179
180
  "}"
@@ -2,6 +2,7 @@ import { intakeFile } from "./intake/intakeFile.mjs";
2
2
  import { base } from "../base.mjs";
3
3
  import { CommandPhase } from "./phases.mjs";
4
4
  import { blockGitHubActionsCI } from "./blockGitHubActionsCI.mjs";
5
+ import { formatFile } from "../utils/formatFile.mjs";
5
6
  import { blockPackageJson } from "./blockPackageJson.mjs";
6
7
  import { blockDevelopmentDocs } from "./blockDevelopmentDocs.mjs";
7
8
  import { blockCSpell } from "./blockCSpell.mjs";
@@ -91,7 +92,7 @@ These are all set to \`"error"\` in the recommended config:
91
92
  } }),
92
93
  blockVitest({ coverage: { exclude: ["src/index.ts", "src/rules/index.ts"] } })
93
94
  ],
94
- files: { [configFileName]: `import prettier from "prettier";
95
+ files: { [configFileName]: formatFile(configFileName, `import prettier from "prettier";
95
96
 
96
97
  /** @type {import('eslint-doc-generator').GenerateOptions} */
97
98
  const config = {
@@ -104,7 +105,7 @@ const config = {
104
105
  };
105
106
 
106
107
  export default config;
107
- ` },
108
+ `) },
108
109
  scripts: [{
109
110
  commands: ["pnpm build"],
110
111
  phase: CommandPhase.Build
@@ -3,6 +3,7 @@ import { base } from "../base.mjs";
3
3
  import { blockRemoveFiles } from "./blockRemoveFiles.mjs";
4
4
  import { withPreviously } from "./files/withPreviously.mjs";
5
5
  import { blockGitHubActionsCI } from "./blockGitHubActionsCI.mjs";
6
+ import { formatFile } from "../utils/formatFile.mjs";
6
7
  import { blockPackageJson } from "./blockPackageJson.mjs";
7
8
  import { blockDevelopmentDocs } from "./blockDevelopmentDocs.mjs";
8
9
  import { blockRemoveWorkflows } from "./blockRemoveWorkflows.mjs";
@@ -45,7 +46,7 @@ const blockKnip = base.createBlock({
45
46
  blockRemoveFiles({ files: [".ts-prunerc*"] }),
46
47
  blockVSCode({ extensions: ["webpro.vscode-knip"] })
47
48
  ],
48
- files: { "knip.config.ts": withPreviously(`import type { KnipConfig } from "knip";
49
+ files: { "knip.config.ts": withPreviously(formatFile("knip.config.ts", `import type { KnipConfig } from "knip";
49
50
 
50
51
  export default ${JSON.stringify({
51
52
  entry: entry?.sort(),
@@ -56,7 +57,7 @@ export default ${JSON.stringify({
56
57
  },
57
58
  project: project?.sort(),
58
59
  treatConfigHintsAsErrors: true
59
- })} satisfies KnipConfig;`, ["knip.json"]) }
60
+ })} satisfies KnipConfig;`), ["knip.json"]) }
60
61
  };
61
62
  },
62
63
  transition() {
@@ -2,6 +2,7 @@ import { htmlToTextSafe } from "../utils/htmlToTextSafe.mjs";
2
2
  import { base } from "../base.mjs";
3
3
  import { CommandPhase } from "./phases.mjs";
4
4
  import { blockRemoveFiles } from "./blockRemoveFiles.mjs";
5
+ import { formatFile } from "../utils/formatFile.mjs";
5
6
  import { resolveEmails } from "../utils/resolveEmails.mjs";
6
7
  import { z } from "zod";
7
8
  import semver from "semver";
@@ -21,13 +22,13 @@ const blockPackageJson = base.createBlock({
21
22
  ...options.packageData?.dependencies,
22
23
  ...addons.properties.dependencies
23
24
  });
24
- const devDependencies = useLargerVersions(options.packageData?.devDependencies, {
25
+ const devDependencies = Object.fromEntries(Object.entries(useLargerVersions(options.packageData?.devDependencies, {
25
26
  ...options.packageData?.devDependencies,
26
27
  ...addons.properties.devDependencies
27
- });
28
+ })).filter(([name]) => !(name in dependencies)));
28
29
  const description = htmlToTextSafe(options.description);
29
30
  return {
30
- files: { "package.json": sortPackageJson(JSON.stringify(removeUndefinedObjects({
31
+ files: { "package.json": formatFile("package.json", sortPackageJson(JSON.stringify(removeUndefinedObjects({
31
32
  ...options.packageData,
32
33
  ...addons.properties,
33
34
  author: {
@@ -53,7 +54,7 @@ const blockPackageJson = base.createBlock({
53
54
  },
54
55
  type: options.type ?? "module",
55
56
  version: options.version ?? "0.0.0"
56
- }))) },
57
+ })))) },
57
58
  scripts: [{
58
59
  commands: [`pnpm install ${offline ? "--offline " : ""}--no-frozen-lockfile`, ...addons.cleanupCommands],
59
60
  phase: CommandPhase.Install
@@ -4,6 +4,7 @@ import { CommandPhase } from "./phases.mjs";
4
4
  import { blockRemoveFiles } from "./blockRemoveFiles.mjs";
5
5
  import { withPreviously } from "./files/withPreviously.mjs";
6
6
  import { blockGitHubActionsCI } from "./blockGitHubActionsCI.mjs";
7
+ import { formatFile } from "../utils/formatFile.mjs";
7
8
  import { blockPackageJson } from "./blockPackageJson.mjs";
8
9
  import { blockDevelopmentDocs } from "./blockDevelopmentDocs.mjs";
9
10
  import { blockRemoveWorkflows } from "./blockRemoveWorkflows.mjs";
@@ -67,14 +68,14 @@ pnpm format --write
67
68
  "/pnpm-lock.yaml",
68
69
  ...ignores
69
70
  ].sort()),
70
- "prettier.config.ts": withPreviously(`import type { Config } from "prettier";
71
+ "prettier.config.ts": withPreviously(formatFile("prettier.config.ts", `import type { Config } from "prettier";
71
72
 
72
73
  export default ${JSON.stringify({
73
74
  ...overrides.length && { overrides: overrides.sort() },
74
75
  ...plugins.length && { plugins: plugins.sort() },
75
76
  useTabs: true
76
77
  })} satisfies Config;
77
- `, [".prettierrc.json"])
78
+ `), [".prettierrc.json"])
78
79
  },
79
80
  scripts: [{
80
81
  commands: [...runBefore, "pnpm format --write"],
@@ -3,6 +3,7 @@ import { base } from "../base.mjs";
3
3
  import { resolveUses } from "./actions/resolveUses.mjs";
4
4
  import { createSoloWorkflowFile } from "./files/createSoloWorkflowFile.mjs";
5
5
  import { withPreviously } from "./files/withPreviously.mjs";
6
+ import { formatFile } from "../utils/formatFile.mjs";
6
7
  import { blockPackageJson } from "./blockPackageJson.mjs";
7
8
  import { blockREADME } from "./blockREADME.mjs";
8
9
  import { blockRepositorySecrets } from "./blockRepositorySecrets.mjs";
@@ -91,7 +92,7 @@ const blockReleaseIt = base.createBlock({
91
92
  ]
92
93
  }), ["release.yml"])
93
94
  } },
94
- ".release-it.json": JSON.stringify({
95
+ ".release-it.json": formatFile(".release-it.json", JSON.stringify({
95
96
  git: {
96
97
  commitMessage: "chore: release v${version}",
97
98
  pushArgs: ["--follow-tags", "--atomic"],
@@ -152,7 +153,7 @@ const blockReleaseIt = base.createBlock({
152
153
  }
153
154
  ]
154
155
  } }
155
- })
156
+ }))
156
157
  },
157
158
  suggestions: [[`- add ${options.owner}/${options.repository} and \`release.yaml\` as a Trusted Publisher on:`, ` https://www.npmjs.com/package/${options.repository}/access`].join("\n")]
158
159
  };
@@ -1,4 +1,5 @@
1
1
  import { base } from "../base.mjs";
2
+ import { formatFile } from "../utils/formatFile.mjs";
2
3
  import { intakeFileAsJson } from "./intake/intakeFileAsJson.mjs";
3
4
  import { blockGitHubApps } from "./blockGitHubApps.mjs";
4
5
  import { z } from "zod";
@@ -18,7 +19,7 @@ const blockRenovate = base.createBlock({
18
19
  name: "Renovate",
19
20
  url: "https://github.com/apps/renovate"
20
21
  }] })],
21
- files: { ".github": { "renovate.json": JSON.stringify({
22
+ files: { ".github": { "renovate.json": formatFile(".github/renovate.json", JSON.stringify({
22
23
  $schema: "https://docs.renovatebot.com/renovate-schema.json",
23
24
  automerge: true,
24
25
  extends: [
@@ -31,7 +32,7 @@ const blockRenovate = base.createBlock({
31
32
  minimumReleaseAge: "7 days",
32
33
  patch: { enabled: false },
33
34
  postUpdateOptions: ["pnpmDedupe"]
34
- }) } }
35
+ })) } }
35
36
  };
36
37
  }
37
38
  });
@@ -4,6 +4,7 @@ import { CommandPhase } from "./phases.mjs";
4
4
  import { blockRemoveFiles } from "./blockRemoveFiles.mjs";
5
5
  import { withPreviously } from "./files/withPreviously.mjs";
6
6
  import { blockGitHubActionsCI } from "./blockGitHubActionsCI.mjs";
7
+ import { formatFile } from "../utils/formatFile.mjs";
7
8
  import { blockPackageJson } from "./blockPackageJson.mjs";
8
9
  import { blockDevelopmentDocs } from "./blockDevelopmentDocs.mjs";
9
10
  import { blockRemoveWorkflows } from "./blockRemoveWorkflows.mjs";
@@ -85,14 +86,14 @@ pnpm build --watch
85
86
  run: "pnpm build"
86
87
  }] })
87
88
  ],
88
- files: { "tsdown.config.ts": withPreviously(`import { defineConfig } from "tsdown";
89
+ files: { "tsdown.config.ts": withPreviously(formatFile("tsdown.config.ts", `import { defineConfig } from "tsdown";
89
90
 
90
91
  export default defineConfig(${JSON.stringify({
91
92
  entry: Array.from(/* @__PURE__ */ new Set([options.bundle ? "src/index.ts" : "src/**/*.ts", ...entry])),
92
93
  ...options.bundle ? {} : { unbundle: true },
93
94
  ...properties
94
95
  })});
95
- `, ["tsup.config.ts"]) },
96
+ `), ["tsup.config.ts"]) },
96
97
  scripts: options.bin ? [{
97
98
  commands: ["pnpm build"],
98
99
  phase: CommandPhase.Build
@@ -1,6 +1,7 @@
1
1
  import { getPackageDependencies } from "../data/packageData.mjs";
2
2
  import { base } from "../base.mjs";
3
3
  import { blockGitHubActionsCI } from "./blockGitHubActionsCI.mjs";
4
+ import { formatFile } from "../utils/formatFile.mjs";
4
5
  import { blockPackageJson } from "./blockPackageJson.mjs";
5
6
  import { blockDevelopmentDocs } from "./blockDevelopmentDocs.mjs";
6
7
  import { blockRemoveWorkflows } from "./blockRemoveWorkflows.mjs";
@@ -110,7 +111,7 @@ greet("Hello, world! ${options.emoji}");
110
111
  }]
111
112
  })
112
113
  ],
113
- files: { "tsconfig.json": JSON.stringify({
114
+ files: { "tsconfig.json": formatFile("tsconfig.json", JSON.stringify({
114
115
  compilerOptions: sortKeys({
115
116
  declaration: true,
116
117
  esModuleInterop: true,
@@ -125,7 +126,7 @@ greet("Hello, world! ${options.emoji}");
125
126
  ...compilerOptions
126
127
  }),
127
128
  include: ["src"]
128
- }) }
129
+ })) }
129
130
  };
130
131
  },
131
132
  transition() {
@@ -1,4 +1,5 @@
1
1
  import { base } from "../base.mjs";
2
+ import { formatFile } from "../utils/formatFile.mjs";
2
3
  import { blockDevelopmentDocs } from "./blockDevelopmentDocs.mjs";
3
4
  import { getPrimaryBin } from "./bin/getPrimaryBin.mjs";
4
5
  import { z } from "zod";
@@ -37,20 +38,20 @@ To launch it, open a test file, then run _Debug Current Test File_ from the VS C
37
38
  }
38
39
  })],
39
40
  files: { ".vscode": {
40
- "extensions.json": extensions?.length ? JSON.stringify({ recommendations: [...extensions].sort() }) : void 0,
41
- "launch.json": debuggers?.length ? JSON.stringify({
41
+ "extensions.json": extensions?.length ? formatFile(".vscode/extensions.json", JSON.stringify({ recommendations: [...extensions].sort() })) : void 0,
42
+ "launch.json": debuggers?.length ? formatFile(".vscode/launch.json", JSON.stringify({
42
43
  configurations: [...debuggers].sort((a, b) => a.name.localeCompare(b.name)),
43
44
  version: "0.2.0"
44
- }) : void 0,
45
- "settings.json": JSON.stringify(sortKeys({
45
+ })) : void 0,
46
+ "settings.json": formatFile(".vscode/settings.json", JSON.stringify(sortKeys({
46
47
  "editor.formatOnSave": true,
47
48
  "editor.rulers": [80],
48
49
  ...settings
49
- })),
50
- "tasks.json": tasks?.length ? JSON.stringify({
50
+ }))),
51
+ "tasks.json": tasks?.length ? formatFile(".vscode/tasks.json", JSON.stringify({
51
52
  tasks: tasks.sort((a, b) => a.detail.localeCompare(b.detail)),
52
53
  version: "2.0.0"
53
- }) : void 0
54
+ })) : void 0
54
55
  } }
55
56
  };
56
57
  }
@@ -3,6 +3,7 @@ import { getPackageDependencies } from "../data/packageData.mjs";
3
3
  import { base } from "../base.mjs";
4
4
  import { blockRemoveFiles } from "./blockRemoveFiles.mjs";
5
5
  import { blockGitHubActionsCI } from "./blockGitHubActionsCI.mjs";
6
+ import { formatFile } from "../utils/formatFile.mjs";
6
7
  import { blockPackageJson } from "./blockPackageJson.mjs";
7
8
  import { blockDevelopmentDocs } from "./blockDevelopmentDocs.mjs";
8
9
  import { blockRemoveWorkflows } from "./blockRemoveWorkflows.mjs";
@@ -168,7 +169,7 @@ describe(greet, () => {
168
169
  extensions: ["vitest.explorer"]
169
170
  })
170
171
  ],
171
- files: { "vitest.config.ts": `import { defineConfig } from "vitest/config";
172
+ files: { "vitest.config.ts": formatFile("vitest.config.ts", `import { defineConfig } from "vitest/config";
172
173
 
173
174
  export default defineConfig({
174
175
  test: {
@@ -183,7 +184,7 @@ export default defineConfig({
183
184
  setupFiles: ["console-fail-test/setup"],
184
185
  },
185
186
  });
186
- ` }
187
+ `) }
187
188
  };
188
189
  },
189
190
  transition() {
@@ -34,6 +34,7 @@ declare const _exports: {
34
34
  "*": string;
35
35
  };
36
36
  dependencies: {
37
+ "@prettier/sync": string;
37
38
  "@typescript-eslint/typescript-estree": string;
38
39
  bingo: string;
39
40
  "bingo-fs": string;
@@ -57,6 +58,7 @@ declare const _exports: {
57
58
  "object-strings-deep": string;
58
59
  "parse-author": string;
59
60
  "parse-package-name": string;
61
+ prettier: string;
60
62
  "remove-dependencies": string;
61
63
  "remove-undefined-objects": string;
62
64
  semver: string;
@@ -73,7 +75,6 @@ declare const _exports: {
73
75
  "@eslint-community/eslint-plugin-eslint-comments": string;
74
76
  "@eslint/js": string;
75
77
  "@eslint/markdown": string;
76
- "@prettier/sync": string;
77
78
  "@release-it/conventional-changelog": string;
78
79
  "@types/html-to-text": string;
79
80
  "@types/lodash": string;
@@ -100,7 +101,6 @@ declare const _exports: {
100
101
  husky: string;
101
102
  knip: string;
102
103
  "lint-staged": string;
103
- prettier: string;
104
104
  "prettier-plugin-curly": string;
105
105
  "prettier-plugin-packagejson": string;
106
106
  "prettier-plugin-padding-lines": string;
@@ -0,0 +1,3 @@
1
+ //#region src/utils/formatFile.d.ts
2
+ export declare function formatFile(filePath: string, text: string): string;
3
+ //#endregion
@@ -0,0 +1,10 @@
1
+ import prettier from "@prettier/sync";
2
+ //#region src/utils/formatFile.ts
3
+ function formatFile(filePath, text) {
4
+ return prettier.format(text, {
5
+ filepath: filePath,
6
+ useTabs: true
7
+ });
8
+ }
9
+ //#endregion
10
+ export { formatFile };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-typescript-app",
3
- "version": "2.66.0",
3
+ "version": "2.67.0",
4
4
  "description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,12 +33,13 @@
33
33
  "*": "prettier --ignore-unknown --write"
34
34
  },
35
35
  "dependencies": {
36
+ "@prettier/sync": "^0.6.1",
36
37
  "@typescript-eslint/typescript-estree": "^8.67.0",
37
38
  "bingo": "^0.13.0",
38
39
  "bingo-fs": "^0.6.0",
39
40
  "bingo-stratum": "^0.7.0",
40
41
  "cached-factory": "^0.3.0",
41
- "cspell-populate-words": "^0.3.1",
42
+ "cspell-populate-words": "0.3.1",
42
43
  "execa": "^10.0.1",
43
44
  "git-url-parse": "^16.1.0",
44
45
  "github-default-labels": "^0.1.1",
@@ -56,6 +57,7 @@
56
57
  "object-strings-deep": "^0.1.2",
57
58
  "parse-author": "^2.0.0",
58
59
  "parse-package-name": "^1.0.0",
60
+ "prettier": "^3.9.6",
59
61
  "remove-dependencies": "^0.1.1",
60
62
  "remove-undefined-objects": "^9.0.0",
61
63
  "semver": "^7.8.5",
@@ -72,7 +74,6 @@
72
74
  "@eslint-community/eslint-plugin-eslint-comments": "4.8.1",
73
75
  "@eslint/js": "10.0.1",
74
76
  "@eslint/markdown": "8.0.3",
75
- "@prettier/sync": "0.6.1",
76
77
  "@release-it/conventional-changelog": "12.0.0",
77
78
  "@types/html-to-text": "9.0.4",
78
79
  "@types/lodash": "4.17.25",
@@ -91,15 +92,14 @@
91
92
  "eslint-plugin-jsdoc": "64.5.4",
92
93
  "eslint-plugin-jsonc": "3.4.1",
93
94
  "eslint-plugin-markdown-links": "0.9.1",
94
- "eslint-plugin-n": "18.3.0",
95
+ "eslint-plugin-n": "18.4.0",
95
96
  "eslint-plugin-package-json": "1.10.0",
96
97
  "eslint-plugin-perfectionist": "5.12.0",
97
98
  "eslint-plugin-regexp": "3.3.1",
98
99
  "eslint-plugin-yml": "3.8.1",
99
100
  "husky": "9.1.7",
100
101
  "knip": "6.38.0",
101
- "lint-staged": "17.5.1",
102
- "prettier": "3.9.6",
102
+ "lint-staged": "17.6.0",
103
103
  "prettier-plugin-curly": "0.4.1",
104
104
  "prettier-plugin-packagejson": "3.0.2",
105
105
  "prettier-plugin-padding-lines": "0.1.0",