create-typescript-app 2.20.0 → 2.21.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.
@@ -2,6 +2,10 @@ import * as bingo_stratum from 'bingo-stratum';
2
2
 
3
3
  declare const blockVitest: bingo_stratum.BlockWithAddons<{
4
4
  exclude: string[];
5
+ coverage: {
6
+ exclude?: string[] | undefined;
7
+ include?: string[] | undefined;
8
+ };
5
9
  actionSteps: ({
6
10
  with?: Record<string, string> | undefined;
7
11
  env?: Record<string, string> | undefined;
@@ -11,10 +15,6 @@ declare const blockVitest: bingo_stratum.BlockWithAddons<{
11
15
  } | {
12
16
  uses: string;
13
17
  }))[];
14
- coverage: {
15
- exclude?: string[] | undefined;
16
- include?: string[] | undefined;
17
- };
18
18
  flags: string[];
19
19
  }, {
20
20
  access: "public" | "restricted";
@@ -1,3 +1,4 @@
1
+ import JSON5 from "json5";
1
2
  import { z } from "zod";
2
3
  import { base } from "../base.js";
3
4
  import { getPackageDependencies } from "../data/packageData.js";
@@ -14,19 +15,56 @@ import { blockRemoveFiles } from "./blockRemoveFiles.js";
14
15
  import { blockRemoveWorkflows } from "./blockRemoveWorkflows.js";
15
16
  import { blockTSup } from "./blockTSup.js";
16
17
  import { blockVSCode } from "./blockVSCode.js";
18
+ import { intakeFile } from "./intake/intakeFile.js";
19
+ function tryParseJSON5(text) {
20
+ try {
21
+ return JSON5.parse(text);
22
+ } catch {
23
+ return void 0;
24
+ }
25
+ }
26
+ const zCoverage = z.object({
27
+ exclude: z.array(z.string()).optional(),
28
+ include: z.array(z.string()).optional()
29
+ });
30
+ const zExclude = z.array(z.string());
31
+ const zTest = z.object({
32
+ coverage: zCoverage,
33
+ exclude: zExclude
34
+ });
17
35
  const blockVitest = base.createBlock({
18
36
  about: {
19
37
  name: "Vitest"
20
38
  },
21
39
  addons: {
22
40
  actionSteps: z.array(zActionStep).default([]),
23
- coverage: z.object({
24
- exclude: z.array(z.string()).optional(),
25
- include: z.array(z.string()).optional()
26
- }).default({}),
27
- exclude: z.array(z.string()).default([]),
41
+ coverage: zCoverage.default({}),
42
+ exclude: zExclude.default([]),
28
43
  flags: z.array(z.string()).default([])
29
44
  },
45
+ intake({ files }) {
46
+ const file = intakeFile(files, ["vitest.config.ts"]);
47
+ if (!file) {
48
+ return void 0;
49
+ }
50
+ const normalized = file[0].replaceAll(/[\n\r]/g, "");
51
+ const matched = /defineConfig\(\{(.+)\}\)\s*(?:;\s*)?$/u.exec(normalized);
52
+ if (!matched) {
53
+ return void 0;
54
+ }
55
+ const rawData = tryParseJSON5(`{${matched[1]}}`);
56
+ if (typeof rawData !== "object" || typeof rawData.test !== "object") {
57
+ return void 0;
58
+ }
59
+ const parsedData = zTest.safeParse(rawData.test).data;
60
+ if (!parsedData) {
61
+ return void 0;
62
+ }
63
+ return {
64
+ coverage: parsedData.coverage,
65
+ exclude: parsedData.exclude
66
+ };
67
+ },
30
68
  produce({ addons }) {
31
69
  const { actionSteps, coverage, exclude = [] } = addons;
32
70
  const excludeText = JSON.stringify(exclude);
@@ -2961,6 +2961,10 @@ declare const blocks: {
2961
2961
  }>;
2962
2962
  blockVitest: bingo_stratum.BlockWithAddons<{
2963
2963
  exclude: string[];
2964
+ coverage: {
2965
+ exclude?: string[] | undefined;
2966
+ include?: string[] | undefined;
2967
+ };
2964
2968
  actionSteps: ({
2965
2969
  with?: Record<string, string> | undefined;
2966
2970
  env?: Record<string, string> | undefined;
@@ -2970,10 +2974,6 @@ declare const blocks: {
2970
2974
  } | {
2971
2975
  uses: string;
2972
2976
  }))[];
2973
- coverage: {
2974
- exclude?: string[] | undefined;
2975
- include?: string[] | undefined;
2976
- };
2977
2977
  flags: string[];
2978
2978
  }, {
2979
2979
  access: "public" | "restricted";
@@ -1,5 +1,5 @@
1
1
  var name = "create-typescript-app";
2
- var version = "2.19.0";
2
+ var version = "2.20.0";
3
3
  var description = "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁";
4
4
  var repository = {
5
5
  type: "git",
@@ -47,6 +47,7 @@ var dependencies = {
47
47
  "input-from-file-json": "^0.5.4",
48
48
  "input-from-script": "^0.5.4",
49
49
  "js-yaml": "^4.1.0",
50
+ json5: "^2.2.3",
50
51
  "lazy-value": "^3.0.0",
51
52
  lodash: "^4.17.21",
52
53
  "npm-user": "^6.1.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-typescript-app",
3
- "version": "2.20.0",
3
+ "version": "2.21.0",
4
4
  "description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,6 +51,7 @@
51
51
  "input-from-file-json": "^0.5.4",
52
52
  "input-from-script": "^0.5.4",
53
53
  "js-yaml": "^4.1.0",
54
+ "json5": "^2.2.3",
54
55
  "lazy-value": "^3.0.0",
55
56
  "lodash": "^4.17.21",
56
57
  "npm-user": "^6.1.1",