create-typescript-app 2.72.0 → 2.74.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.
package/README.md CHANGED
@@ -49,7 +49,8 @@ You can read more about `create-typescript-app` and the tooling it supports:
49
49
 
50
50
  1. [**Blocks**](./docs/Blocks.md): a breakdown of all the pieces this template can set up.
51
51
  2. [**CLI**](./docs/CLI.md): providing granular options to customize how the template is run.
52
- 3. [**FAQs**](./docs/FAQs.md): frequently asked questions and troubleshooting
52
+ 3. [**Examples**](./docs/Examples.md): kinds of projects this template can create, with example repositories
53
+ 4. [**FAQs**](./docs/FAQs.md): frequently asked questions and troubleshooting
53
54
 
54
55
  > [!NOTE]
55
56
  > This template is opinionated and not endorsed by the TypeScript team.
@@ -28,6 +28,7 @@ const blockREADME = base.createBlock({
28
28
  align: "right",
29
29
  ...options.logo
30
30
  })}>\n`;
31
+ const usage = options.documentation.readme.usage ?? ["## Usage", ...defaultUsage].join("\n\n");
31
32
  const suffixes = [...notices, options.documentation.readme.footnotes].filter((suffix) => typeof suffix === "string");
32
33
  return { files: { "README.md": `<h1 align="center">${options.title}</h1>
33
34
 
@@ -37,11 +38,7 @@ const blockREADME = base.createBlock({
37
38
  ${formatBadges(badges)}
38
39
  </p>
39
40
  ${[logo, explainer].filter(Boolean).join("")}
40
- ## Usage
41
-
42
- ${options.documentation.readme.usage ?? defaultUsage.join("\n\n")}
43
-
44
- ## Development
41
+ ${usage ? `${usage}\n\n` : ""}## Development
45
42
 
46
43
  See [\`.github/CONTRIBUTING.md\`](./.github/CONTRIBUTING.md), then [\`.github/DEVELOPMENT.md\`](./.github/DEVELOPMENT.md).
47
44
  Thanks! ${options.emoji}
@@ -30,6 +30,15 @@ const zTest = z.object({
30
30
  environment: zEnvironment,
31
31
  exclude: zExclude
32
32
  }).partial();
33
+ const testFrameworkMigrations = [{
34
+ name: "Jest",
35
+ packageName: "jest",
36
+ url: "https://vitest.dev/guide/migration/jest"
37
+ }, {
38
+ name: "Mocha",
39
+ packageName: "mocha",
40
+ url: "https://vitest.dev/guide/migration/mocha"
41
+ }];
33
42
  function intakeFromConfig(files) {
34
43
  const rawData = intakeFileDefineConfig(files, ["vitest.config.ts"]);
35
44
  if (typeof rawData?.test !== "object") return;
@@ -187,27 +196,35 @@ export default defineConfig({
187
196
  `) }
188
197
  };
189
198
  },
190
- transition() {
191
- return { addons: [
192
- blockGitignore({ removals: [
193
- "/coverage*",
194
- "coverage*/",
195
- "coverage/"
196
- ] }),
197
- blockRemoveDependencies({ dependencies: [
198
- "@vitest/coverage-istanbul",
199
- "eslint-plugin-jest",
200
- "eslint-plugin-mocha",
201
- "eslint-plugin-vitest",
202
- "jest mocha"
203
- ] }),
204
- blockRemoveFiles({ files: [
205
- ".mocha*",
206
- "jest.config.*",
207
- "vitest.config.{c,j,m}*"
208
- ] }),
209
- blockRemoveWorkflows({ workflows: ["test"] })
210
- ] };
199
+ transition({ options }) {
200
+ const existingDependencies = {
201
+ ...options.packageData?.dependencies,
202
+ ...options.packageData?.devDependencies
203
+ };
204
+ const suggestions = testFrameworkMigrations.filter(({ packageName }) => packageName in existingDependencies).map(({ name, url }) => [`- manually migrate your ${name} tests to Vitest:`, ` ${url}`].join("\n"));
205
+ return {
206
+ addons: [
207
+ blockGitignore({ removals: [
208
+ "/coverage*",
209
+ "coverage*/",
210
+ "coverage/"
211
+ ] }),
212
+ blockRemoveDependencies({ dependencies: [
213
+ "@vitest/coverage-istanbul",
214
+ "eslint-plugin-jest",
215
+ "eslint-plugin-mocha",
216
+ "eslint-plugin-vitest",
217
+ "jest mocha"
218
+ ] }),
219
+ blockRemoveFiles({ files: [
220
+ ".mocha*",
221
+ "jest.config.*",
222
+ "vitest.config.{c,j,m}*"
223
+ ] }),
224
+ blockRemoveWorkflows({ workflows: ["test"] })
225
+ ],
226
+ suggestions: suggestions.length ? suggestions : void 0
227
+ };
211
228
  }
212
229
  });
213
230
  //#endregion
@@ -3,7 +3,7 @@ const optionsBase = {
3
3
  access: "public",
4
4
  description: "Test description",
5
5
  directory: ".",
6
- documentation: { readme: { usage: "Test usage." } },
6
+ documentation: { readme: { usage: "## Usage\n\nTest usage." } },
7
7
  email: {
8
8
  github: "github@email.com",
9
9
  npm: "npm@email.com"
@@ -3,11 +3,11 @@ const startUsage = "## Usage";
3
3
  async function readReadmeUsage(getReadme) {
4
4
  const readme = await getReadme();
5
5
  const indexOfUsage = readme.indexOf(startUsage);
6
- if (indexOfUsage === -1) return;
7
- const offset = indexOfUsage + 8;
8
- const indexOfNextKnownHeading = readme.slice(offset).search(/## (?:Development|Contributing|Contributors)/);
9
- if (indexOfNextKnownHeading === -1) return readme.slice(offset) || void 0;
10
- return readme.slice(offset, indexOfNextKnownHeading + offset).trim() || void 0;
6
+ if (indexOfUsage === -1) return readme.trim() ? "" : void 0;
7
+ const remaining = readme.slice(indexOfUsage);
8
+ const indexOfNextKnownHeading = remaining.search(/## (?:Development|Contributing|Contributors)/);
9
+ const usage = (indexOfNextKnownHeading === -1 ? remaining : remaining.slice(0, indexOfNextKnownHeading)).trim();
10
+ return usage === startUsage ? void 0 : usage;
11
11
  }
12
12
  //#endregion
13
13
  export { readReadmeUsage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-typescript-app",
3
- "version": "2.72.0",
3
+ "version": "2.74.0",
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
  "console-fail-test": "0.9.0",
91
91
  "cspell": "10.3.3",
92
92
  "eslint": "10.12.0",
93
- "eslint-plugin-jsdoc": "65.0.1",
93
+ "eslint-plugin-jsdoc": "65.1.0",
94
94
  "eslint-plugin-jsonc": "3.4.1",
95
95
  "eslint-plugin-markdown-links": "0.9.1",
96
96
  "eslint-plugin-n": "18.4.0",