create-typescript-app 2.34.1 → 2.35.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.
@@ -54,7 +54,13 @@ ${explanation2}
54
54
  ].sort(
55
55
  (a, b) => a.replace(/.+from/, "").localeCompare(b.replace(/.+from/, ""))
56
56
  );
57
- const ignoreLines = ["lib", "node_modules", "pnpm-lock.yaml", ...ignores].map((ignore) => JSON.stringify(ignore)).sort();
57
+ const ignoreLines = Array.from(
58
+ new Set(
59
+ ["lib", "node_modules", "pnpm-lock.yaml", ...ignores].map(
60
+ (ignore) => JSON.stringify(ignore)
61
+ )
62
+ )
63
+ ).sort();
58
64
  const extensionLines = [
59
65
  printExtension({
60
66
  extends: [
@@ -10,16 +10,30 @@ import { blockReleaseIt } from "./blockReleaseIt.js";
10
10
  import { blockRemoveDependencies } from "./blockRemoveDependencies.js";
11
11
  import { blockRemoveFiles } from "./blockRemoveFiles.js";
12
12
  import { blockRemoveWorkflows } from "./blockRemoveWorkflows.js";
13
+ import { intakeFileDefineConfig } from "./intake/intakeFileDefineConfig.js";
13
14
  import { CommandPhase } from "./phases.js";
15
+ const zEntry = z.array(z.string());
16
+ const zProperties = z.record(z.unknown());
14
17
  const blockTSup = base.createBlock({
15
18
  about: {
16
19
  name: "TSup"
17
20
  },
18
21
  addons: {
19
- entry: z.array(z.string()).default([]),
20
- properties: z.record(z.unknown()).default({}),
22
+ entry: zEntry.default([]),
23
+ properties: zProperties.default({}),
21
24
  runInCI: z.array(z.string()).default([])
22
25
  },
26
+ intake({ files }) {
27
+ const rawData = intakeFileDefineConfig(files, ["tsup.config.ts"]);
28
+ if (!rawData) {
29
+ return void 0;
30
+ }
31
+ const { entry: rawEntry, ...rest } = rawData;
32
+ return {
33
+ entry: zEntry.safeParse(rawEntry).data,
34
+ properties: zProperties.safeParse(rest).data
35
+ };
36
+ },
23
37
  produce({ addons, options }) {
24
38
  const { entry, properties, runInCI } = addons;
25
39
  return {
@@ -1,4 +1,3 @@
1
- import JSON5 from "json5";
2
1
  import { z } from "zod";
3
2
  import { base } from "../base.js";
4
3
  import { getPackageDependencies } from "../data/packageData.js";
@@ -16,14 +15,7 @@ import { blockRemoveFiles } from "./blockRemoveFiles.js";
16
15
  import { blockRemoveWorkflows } from "./blockRemoveWorkflows.js";
17
16
  import { blockTSup } from "./blockTSup.js";
18
17
  import { blockVSCode } from "./blockVSCode.js";
19
- import { intakeFile } from "./intake/intakeFile.js";
20
- function tryParseJSON5(text) {
21
- try {
22
- return JSON5.parse(text);
23
- } catch {
24
- return void 0;
25
- }
26
- }
18
+ import { intakeFileDefineConfig } from "./intake/intakeFileDefineConfig.js";
27
19
  const zCoverage = z.object({
28
20
  exclude: z.array(z.string()).optional(),
29
21
  include: z.array(z.string()).optional()
@@ -36,17 +28,8 @@ const zTest = z.object({
36
28
  exclude: zExclude
37
29
  }).partial();
38
30
  function intakeFromConfig(files) {
39
- const file = intakeFile(files, ["vitest.config.ts"]);
40
- if (!file) {
41
- return void 0;
42
- }
43
- const normalized = file[0].replaceAll(/[\n\r]/g, "");
44
- const matched = /defineConfig\(\{(.+)\}\)\s*(?:;\s*)?$/u.exec(normalized);
45
- if (!matched) {
46
- return void 0;
47
- }
48
- const rawData = tryParseJSON5(`{${matched[1]}}`);
49
- if (typeof rawData !== "object" || typeof rawData.test !== "object") {
31
+ const rawData = intakeFileDefineConfig(files, ["vitest.config.ts"]);
32
+ if (typeof rawData?.test !== "object") {
50
33
  return void 0;
51
34
  }
52
35
  const parsedData = zTest.safeParse(rawData.test).data;
@@ -0,0 +1,5 @@
1
+ import { IntakeDirectory } from 'bingo-fs';
2
+
3
+ declare function intakeFileDefineConfig(files: IntakeDirectory, filePath: (string | string[])[]): Record<string, unknown> | undefined;
4
+
5
+ export { intakeFileDefineConfig };
@@ -0,0 +1,28 @@
1
+ import JSON5 from "json5";
2
+ import { intakeFile } from "./intakeFile.js";
3
+ function intakeFileDefineConfig(files, filePath) {
4
+ const file = intakeFile(files, filePath);
5
+ if (!file) {
6
+ return void 0;
7
+ }
8
+ const normalized = file[0].replaceAll(/[\n\r]/g, "");
9
+ const matched = /defineConfig\(\{(.+)\}\)\s*(?:;\s*)?$/u.exec(normalized);
10
+ if (!matched) {
11
+ return void 0;
12
+ }
13
+ const rawData = tryParseJSON5(`{${matched[1]}}`);
14
+ if (!rawData || typeof rawData !== "object") {
15
+ return void 0;
16
+ }
17
+ return rawData;
18
+ }
19
+ function tryParseJSON5(text) {
20
+ try {
21
+ return JSON5.parse(text);
22
+ } catch {
23
+ return void 0;
24
+ }
25
+ }
26
+ export {
27
+ intakeFileDefineConfig
28
+ };
@@ -1,5 +1,5 @@
1
1
  var name = "create-typescript-app";
2
- var version = "2.34.0";
2
+ var version = "2.34.2";
3
3
  var description = "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁";
4
4
  var repository = {
5
5
  type: "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-typescript-app",
3
- "version": "2.34.1",
3
+ "version": "2.35.0",
4
4
  "description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁",
5
5
  "repository": {
6
6
  "type": "git",