create-typescript-app 2.28.0 → 2.29.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,7 +1,9 @@
|
|
|
1
1
|
import * as bingo_stratum from 'bingo-stratum';
|
|
2
2
|
|
|
3
3
|
declare const blockKnip: bingo_stratum.BlockWithAddons<{
|
|
4
|
+
entry?: string[] | undefined;
|
|
4
5
|
ignoreDependencies?: string[] | undefined;
|
|
6
|
+
project?: string[] | undefined;
|
|
5
7
|
}, {
|
|
6
8
|
access: "public" | "restricted";
|
|
7
9
|
description: string;
|
package/lib/blocks/blockKnip.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import removeUndefinedObjects from "remove-undefined-objects";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import { base } from "../base.js";
|
|
3
4
|
import {
|
|
@@ -10,27 +11,29 @@ import { blockPackageJson } from "./blockPackageJson.js";
|
|
|
10
11
|
import { blockRemoveFiles } from "./blockRemoveFiles.js";
|
|
11
12
|
import { blockRemoveWorkflows } from "./blockRemoveWorkflows.js";
|
|
12
13
|
import { intakeFileAsJson } from "./intake/intakeFileAsJson.js";
|
|
13
|
-
const
|
|
14
|
+
const zStringArray = z.array(z.string());
|
|
14
15
|
const blockKnip = base.createBlock({
|
|
15
16
|
about: {
|
|
16
17
|
name: "Knip"
|
|
17
18
|
},
|
|
18
19
|
addons: {
|
|
19
|
-
|
|
20
|
+
entry: zStringArray.optional(),
|
|
21
|
+
ignoreDependencies: zStringArray.optional(),
|
|
22
|
+
project: zStringArray.optional()
|
|
20
23
|
},
|
|
21
24
|
intake({ files }) {
|
|
22
25
|
const knipJson = intakeFileAsJson(files, ["knip.json"]);
|
|
23
|
-
if (!knipJson
|
|
26
|
+
if (!knipJson) {
|
|
24
27
|
return void 0;
|
|
25
28
|
}
|
|
26
|
-
return {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
).data
|
|
30
|
-
};
|
|
29
|
+
return removeUndefinedObjects({
|
|
30
|
+
entry: zStringArray.safeParse(knipJson.entry).data,
|
|
31
|
+
ignoreDependencies: zStringArray.safeParse(knipJson.ignoreDependencies).data,
|
|
32
|
+
project: zStringArray.safeParse(knipJson.project).data
|
|
33
|
+
});
|
|
31
34
|
},
|
|
32
35
|
produce({ addons }) {
|
|
33
|
-
const { ignoreDependencies } = addons;
|
|
36
|
+
const { entry, ignoreDependencies, project } = addons;
|
|
34
37
|
return {
|
|
35
38
|
addons: [
|
|
36
39
|
blockDevelopmentDocs({
|
|
@@ -64,13 +67,13 @@ const blockKnip = base.createBlock({
|
|
|
64
67
|
files: {
|
|
65
68
|
"knip.json": JSON.stringify({
|
|
66
69
|
$schema: `https://unpkg.com/knip@${getPackageDependency("knip")}/schema.json`,
|
|
67
|
-
entry:
|
|
70
|
+
entry: entry?.sort(),
|
|
68
71
|
ignoreDependencies,
|
|
69
72
|
ignoreExportsUsedInFile: {
|
|
70
73
|
interface: true,
|
|
71
74
|
type: true
|
|
72
75
|
},
|
|
73
|
-
project:
|
|
76
|
+
project: project?.sort()
|
|
74
77
|
})
|
|
75
78
|
}
|
|
76
79
|
};
|
|
@@ -7,6 +7,7 @@ import { blockDevelopmentDocs } from "./blockDevelopmentDocs.js";
|
|
|
7
7
|
import { blockExampleFiles } from "./blockExampleFiles.js";
|
|
8
8
|
import { blockGitHubActionsCI } from "./blockGitHubActionsCI.js";
|
|
9
9
|
import { blockGitignore } from "./blockGitignore.js";
|
|
10
|
+
import { blockKnip } from "./blockKnip.js";
|
|
10
11
|
import { blockMarkdownlint } from "./blockMarkdownlint.js";
|
|
11
12
|
import { blockPackageJson } from "./blockPackageJson.js";
|
|
12
13
|
import { blockRemoveWorkflows } from "./blockRemoveWorkflows.js";
|
|
@@ -78,6 +79,10 @@ export * from "./types.js";
|
|
|
78
79
|
blockGitHubActionsCI({
|
|
79
80
|
jobs: [{ name: "Type Check", steps: [{ run: "pnpm tsc" }] }]
|
|
80
81
|
}),
|
|
82
|
+
blockKnip({
|
|
83
|
+
entry: ["src/index.ts"],
|
|
84
|
+
project: ["src/**/*.ts"]
|
|
85
|
+
}),
|
|
81
86
|
blockMarkdownlint({
|
|
82
87
|
ignores: ["lib/"]
|
|
83
88
|
}),
|
|
@@ -8,6 +8,7 @@ import { blockESLint } from "./blockESLint.js";
|
|
|
8
8
|
import { blockExampleFiles } from "./blockExampleFiles.js";
|
|
9
9
|
import { blockGitHubActionsCI, zActionStep } from "./blockGitHubActionsCI.js";
|
|
10
10
|
import { blockGitignore } from "./blockGitignore.js";
|
|
11
|
+
import { blockKnip } from "./blockKnip.js";
|
|
11
12
|
import { blockPackageJson } from "./blockPackageJson.js";
|
|
12
13
|
import { blockPrettier } from "./blockPrettier.js";
|
|
13
14
|
import { blockRemoveDependencies } from "./blockRemoveDependencies.js";
|
|
@@ -181,6 +182,9 @@ describe(greet, () => {
|
|
|
181
182
|
}
|
|
182
183
|
]
|
|
183
184
|
}),
|
|
185
|
+
blockKnip({
|
|
186
|
+
entry: ["src/**/*.test.*"]
|
|
187
|
+
}),
|
|
184
188
|
blockPackageJson({
|
|
185
189
|
properties: {
|
|
186
190
|
devDependencies: getPackageDependencies(
|
package/lib/blocks/index.d.ts
CHANGED
|
@@ -1748,7 +1748,9 @@ declare const blocks: {
|
|
|
1748
1748
|
}>> | undefined;
|
|
1749
1749
|
}>;
|
|
1750
1750
|
blockKnip: bingo_stratum.BlockWithAddons<{
|
|
1751
|
+
entry?: string[] | undefined;
|
|
1751
1752
|
ignoreDependencies?: string[] | undefined;
|
|
1753
|
+
project?: string[] | undefined;
|
|
1752
1754
|
}, {
|
|
1753
1755
|
access: "public" | "restricted";
|
|
1754
1756
|
description: string;
|