create-typescript-app 2.69.0 → 2.69.1
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/dist/blocks/blockExports.mjs +5 -5
- package/dist/blocks/blockNcc.d.mts +1 -0
- package/dist/blocks/blockNcc.mjs +72 -34
- package/dist/blocks/blockTSDown.d.mts +2 -0
- package/dist/blocks/blockTSDown.mjs +12 -2
- package/dist/blocks/blockTypeScript.d.mts +1 -0
- package/dist/blocks/blockTypeScript.mjs +14 -10
- package/dist/blocks/index.d.mts +4 -0
- package/dist/blocks/index.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/presets/minimal.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { base } from "../base.mjs";
|
|
2
2
|
import { intakeFileAsJson } from "./intake/intakeFileAsJson.mjs";
|
|
3
|
-
import { blockPackageJson } from "./blockPackageJson.mjs";
|
|
4
3
|
import { blockTSDown } from "./blockTSDown.mjs";
|
|
5
4
|
import { z } from "zod";
|
|
6
5
|
//#region src/blocks/blockExports.ts
|
|
@@ -21,10 +20,11 @@ const blockExports = base.createBlock({
|
|
|
21
20
|
produce({ addons, options }) {
|
|
22
21
|
const { filePath = "./dist/index.mjs", runArgs } = addons;
|
|
23
22
|
const main = zFilePath.safeParse(options.packageData?.main).data;
|
|
24
|
-
return { addons: [
|
|
25
|
-
exports:
|
|
26
|
-
...main && { main: libToDist(main) }
|
|
27
|
-
|
|
23
|
+
return { addons: [blockTSDown({
|
|
24
|
+
exports: filePath.startsWith(".") ? filePath : `./${filePath}`,
|
|
25
|
+
...main && { main: libToDist(main) },
|
|
26
|
+
runInCI: [`node ${filePath}${runArgs.map((arg) => ` ${arg}`).join("")}`]
|
|
27
|
+
})] };
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
function libToDist(filePath) {
|
package/dist/blocks/blockNcc.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { base } from "../base.mjs";
|
|
2
2
|
import { blockGitHubActionsCI } from "./blockGitHubActionsCI.mjs";
|
|
3
|
+
import { formatFile } from "../utils/formatFile.mjs";
|
|
3
4
|
import { blockDevelopmentDocs } from "./blockDevelopmentDocs.mjs";
|
|
4
5
|
import { blockPackageJson } from "./blockPackageJson.mjs";
|
|
5
6
|
import { blockGitHubIssueTemplates } from "./blockGitHubIssueTemplates.mjs";
|
|
@@ -7,20 +8,31 @@ import { blockCSpell } from "./blockCSpell.mjs";
|
|
|
7
8
|
import { blockESLint } from "./blockESLint.mjs";
|
|
8
9
|
import { blockGitignore } from "./blockGitignore.mjs";
|
|
9
10
|
import { blockPrettier } from "./blockPrettier.mjs";
|
|
11
|
+
import { blockReleaseIt } from "./blockReleaseIt.mjs";
|
|
12
|
+
import { blockVitest } from "./blockVitest.mjs";
|
|
13
|
+
import { blockTypeScript } from "./blockTypeScript.mjs";
|
|
10
14
|
import { z } from "zod";
|
|
11
15
|
//#region src/blocks/blockNcc.ts
|
|
12
16
|
const blockNcc = base.createBlock({
|
|
13
17
|
about: { name: "ncc" },
|
|
14
|
-
addons: {
|
|
18
|
+
addons: {
|
|
19
|
+
build: z.string().optional(),
|
|
20
|
+
entry: z.string().optional()
|
|
21
|
+
},
|
|
15
22
|
intake({ options }) {
|
|
16
|
-
|
|
23
|
+
const scripts = options.packageData?.scripts;
|
|
24
|
+
return {
|
|
25
|
+
build: scripts?.build?.match(/^tsc\b/) ? scripts.build : void 0,
|
|
26
|
+
entry: scripts?.["build:release"]?.match(/ncc build (.+) -o dist/)?.[1]
|
|
27
|
+
};
|
|
17
28
|
},
|
|
18
29
|
produce({ addons, options }) {
|
|
19
|
-
const { entry = "src/index.ts" } = addons;
|
|
20
|
-
return {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
const { build, entry = "src/index.ts" } = addons;
|
|
31
|
+
return {
|
|
32
|
+
addons: [
|
|
33
|
+
blockCSpell({ ignorePaths: ["dist", "lib"] }),
|
|
34
|
+
blockDevelopmentDocs({ sections: { Building: {
|
|
35
|
+
contents: `
|
|
24
36
|
Run [TypeScript](https://typescriptlang.org) locally to type check and build source files from \`src/\` into output files in \`lib/\`:
|
|
25
37
|
|
|
26
38
|
\`\`\`shell
|
|
@@ -33,8 +45,8 @@ Add \`--watch\` to run the builder in a watch mode that rebuilds changed files i
|
|
|
33
45
|
pnpm build --watch
|
|
34
46
|
\`\`\`
|
|
35
47
|
`,
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
innerSections: [{
|
|
49
|
+
contents: `
|
|
38
50
|
Run [\`@vercel/ncc\`](https://github.com/vercel/ncc) to clear and recreate an output \`dist/\` to be used in production.
|
|
39
51
|
|
|
40
52
|
\`\`\`shell
|
|
@@ -45,16 +57,16 @@ CI fails if the committed \`dist/\` doesn't match what \`pnpm build:release\` pr
|
|
|
45
57
|
If that happens, run \`pnpm build:release\` and commit the changed files under \`dist/\`.
|
|
46
58
|
Renovate PRs that update bundled dependencies need the same: rebuild and commit \`dist/\` on their branch before they can merge.
|
|
47
59
|
`,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
heading: "Building for Release"
|
|
61
|
+
}]
|
|
62
|
+
} } }),
|
|
63
|
+
blockESLint({ ignores: ["dist", "lib"] }),
|
|
64
|
+
blockGitHubActionsCI({ jobs: [{
|
|
65
|
+
name: "Build",
|
|
66
|
+
steps: [{ run: "pnpm build" }]
|
|
67
|
+
}, {
|
|
68
|
+
name: "Build (Release)",
|
|
69
|
+
steps: [{ run: "pnpm build:release" }, { run: `# Verify dist/ is up to date
|
|
58
70
|
changes=$(git status --porcelain --untracked-files=all --ignored -- dist ':!*.d.ts' ':!*.d.ts.map')
|
|
59
71
|
if [ -n "$changes" ]; then
|
|
60
72
|
echo "$changes"
|
|
@@ -62,21 +74,47 @@ if [ -n "$changes" ]; then
|
|
|
62
74
|
exit 1
|
|
63
75
|
fi
|
|
64
76
|
` }]
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
}] }),
|
|
78
|
+
blockGitHubIssueTemplates({ checklists: {
|
|
79
|
+
bug: ["I have checked the workflow run logs for errors.", `I have tried the [latest release](https://github.com/${options.owner}/${options.repository}/releases/latest) of this action and the issue persists.`],
|
|
80
|
+
feature: [`I have looked at the [latest release](https://github.com/${options.owner}/${options.repository}/releases/latest) of this action.`]
|
|
81
|
+
} }),
|
|
82
|
+
blockGitignore({ ignores: [
|
|
83
|
+
"/dist/**/*.d.ts",
|
|
84
|
+
"/dist/**/*.d.ts.map",
|
|
85
|
+
"/lib"
|
|
86
|
+
] }),
|
|
87
|
+
blockPackageJson({ properties: {
|
|
88
|
+
devDependencies: { "@vercel/ncc": "^0.38.3" },
|
|
89
|
+
files: ["lib/"],
|
|
90
|
+
scripts: {
|
|
91
|
+
build: build ?? "tsc --project tsconfig.build.json",
|
|
92
|
+
"build:release": `rm -rf dist && ncc build ${entry} -o dist`
|
|
93
|
+
}
|
|
94
|
+
} }),
|
|
95
|
+
blockPrettier({ ignores: ["/dist", "/lib"] }),
|
|
96
|
+
blockReleaseIt({ builders: [{
|
|
97
|
+
order: 0,
|
|
98
|
+
run: "pnpm build"
|
|
99
|
+
}] }),
|
|
100
|
+
blockTypeScript({ outDir: "lib" }),
|
|
101
|
+
blockVitest({ exclude: ["lib"] })
|
|
102
|
+
],
|
|
103
|
+
...!build && { files: { "tsconfig.build.json": formatFile("tsconfig.build.json", JSON.stringify({
|
|
104
|
+
exclude: ["src/**/*.test.ts"],
|
|
105
|
+
extends: "./tsconfig.json"
|
|
106
|
+
})) } }
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
setup() {
|
|
110
|
+
return { addons: [blockPackageJson({ properties: { exports: { ".": "./lib/index.js" } } })] };
|
|
111
|
+
},
|
|
112
|
+
transition() {
|
|
113
|
+
return { addons: [blockGitignore({ removals: [
|
|
114
|
+
"/dist",
|
|
115
|
+
"dist",
|
|
116
|
+
"dist/"
|
|
117
|
+
] })] };
|
|
80
118
|
}
|
|
81
119
|
});
|
|
82
120
|
//#endregion
|
|
@@ -3,6 +3,8 @@ export declare const blockTSDown: import("bingo-stratum").BlockWithAddons<{
|
|
|
3
3
|
entry: string[];
|
|
4
4
|
properties: Record<string, unknown>;
|
|
5
5
|
runInCI: string[];
|
|
6
|
+
exports?: string | undefined;
|
|
7
|
+
main?: string | undefined;
|
|
6
8
|
}, {
|
|
7
9
|
access: "public" | "restricted";
|
|
8
10
|
description: string;
|
|
@@ -37,6 +37,8 @@ const blockTSDown = base.createBlock({
|
|
|
37
37
|
about: { name: "TSDown" },
|
|
38
38
|
addons: {
|
|
39
39
|
entry: zEntry.default([]),
|
|
40
|
+
exports: z.string().optional(),
|
|
41
|
+
main: z.string().optional(),
|
|
40
42
|
properties: zProperties.default({}),
|
|
41
43
|
runInCI: z.array(z.string()).default([])
|
|
42
44
|
},
|
|
@@ -58,7 +60,7 @@ const blockTSDown = base.createBlock({
|
|
|
58
60
|
};
|
|
59
61
|
},
|
|
60
62
|
produce({ addons, options }) {
|
|
61
|
-
const { entry, properties, runInCI } = addons;
|
|
63
|
+
const { entry, exports, main, properties, runInCI } = addons;
|
|
62
64
|
return {
|
|
63
65
|
addons: [
|
|
64
66
|
blockDevelopmentDocs({ sections: { Building: { contents: `
|
|
@@ -83,8 +85,12 @@ pnpm build --watch
|
|
|
83
85
|
bug: ["I have pulled in the newest version of the project.", "I have tried restarting my IDE and the issue persists."],
|
|
84
86
|
feature: ["I have looked at the latest version of the project."]
|
|
85
87
|
} }),
|
|
88
|
+
blockGitignore({ ignores: ["/dist"] }),
|
|
86
89
|
blockPackageJson({ properties: {
|
|
87
90
|
devDependencies: getPackageDependencies("tsdown"),
|
|
91
|
+
...exports && { exports: { ".": exports } },
|
|
92
|
+
files: ["dist/"],
|
|
93
|
+
...main && { main },
|
|
88
94
|
scripts: { build: "tsdown" }
|
|
89
95
|
} }),
|
|
90
96
|
blockReleaseIt({ builders: [{
|
|
@@ -108,7 +114,11 @@ export default defineConfig(${JSON.stringify({
|
|
|
108
114
|
},
|
|
109
115
|
transition() {
|
|
110
116
|
return { addons: [
|
|
111
|
-
blockGitignore({ removals: [
|
|
117
|
+
blockGitignore({ removals: [
|
|
118
|
+
"/lib",
|
|
119
|
+
"dist/",
|
|
120
|
+
"lib/"
|
|
121
|
+
] }),
|
|
112
122
|
blockPackageJson({ outdatedFiles: ["lib/"] }),
|
|
113
123
|
blockRemoveDependencies({ dependencies: [
|
|
114
124
|
"@babel/cli",
|
|
@@ -111,6 +111,7 @@ export declare const blockTypeScript: import("bingo-stratum").BlockWithAddons<{
|
|
|
111
111
|
useUnknownInCatchVariables?: boolean | undefined;
|
|
112
112
|
verbatimModuleSyntax?: boolean | undefined;
|
|
113
113
|
} | undefined;
|
|
114
|
+
outDir?: string | undefined;
|
|
114
115
|
}, {
|
|
115
116
|
access: "public" | "restricted";
|
|
116
117
|
description: string;
|
|
@@ -9,15 +9,18 @@ import { blockRemoveWorkflows } from "./blockRemoveWorkflows.mjs";
|
|
|
9
9
|
import { getPrimaryBin } from "./bin/getPrimaryBin.mjs";
|
|
10
10
|
import { blockVSCode } from "./blockVSCode.mjs";
|
|
11
11
|
import { blockExampleFiles } from "./blockExampleFiles.mjs";
|
|
12
|
-
import { blockGitignore } from "./blockGitignore.mjs";
|
|
13
12
|
import { blockKnip } from "./blockKnip.mjs";
|
|
14
13
|
import { blockVitest } from "./blockVitest.mjs";
|
|
14
|
+
import { z } from "zod";
|
|
15
15
|
import sortKeys from "sort-keys";
|
|
16
16
|
import { CompilerOptionsSchema } from "zod-tsconfig";
|
|
17
17
|
//#region src/blocks/blockTypeScript.ts
|
|
18
18
|
const blockTypeScript = base.createBlock({
|
|
19
19
|
about: { name: "TypeScript" },
|
|
20
|
-
addons: {
|
|
20
|
+
addons: {
|
|
21
|
+
compilerOptions: CompilerOptionsSchema.optional(),
|
|
22
|
+
outDir: z.string().optional()
|
|
23
|
+
},
|
|
21
24
|
intake({ files }) {
|
|
22
25
|
const raw = intakeFileAsJson(files, ["tsconfig.json"]);
|
|
23
26
|
const { data } = CompilerOptionsSchema.safeParse(raw?.compilerOptions);
|
|
@@ -25,7 +28,7 @@ const blockTypeScript = base.createBlock({
|
|
|
25
28
|
return { compilerOptions: data };
|
|
26
29
|
},
|
|
27
30
|
produce({ addons, options }) {
|
|
28
|
-
const { compilerOptions } = addons;
|
|
31
|
+
const { compilerOptions, outDir } = addons;
|
|
29
32
|
const primaryBin = getPrimaryBin(options.bin, options.repository);
|
|
30
33
|
return {
|
|
31
34
|
addons: [
|
|
@@ -79,16 +82,12 @@ import { greet } from "${options.repository}";
|
|
|
79
82
|
greet("Hello, world! ${options.emoji}");
|
|
80
83
|
\`\`\``]
|
|
81
84
|
}),
|
|
82
|
-
blockGitignore({ ignores: ["/dist"] }),
|
|
83
85
|
blockGitHubActionsCI({ jobs: [{
|
|
84
86
|
name: "Type Check",
|
|
85
87
|
steps: [{ run: "pnpm tsc" }]
|
|
86
88
|
}] }),
|
|
87
89
|
blockKnip({ project: ["src/**/*.ts"] }),
|
|
88
|
-
blockPackageJson({ properties: {
|
|
89
|
-
devDependencies: getPackageDependencies("typescript"),
|
|
90
|
-
files: ["dist/"]
|
|
91
|
-
} }),
|
|
90
|
+
blockPackageJson({ properties: { devDependencies: getPackageDependencies("typescript") } }),
|
|
92
91
|
blockVitest({
|
|
93
92
|
coverage: { include: ["src"] },
|
|
94
93
|
exclude: ["dist"]
|
|
@@ -123,14 +122,19 @@ greet("Hello, world! ${options.emoji}");
|
|
|
123
122
|
skipLibCheck: true,
|
|
124
123
|
strict: true,
|
|
125
124
|
target: "ES2023",
|
|
126
|
-
...
|
|
125
|
+
...outDir && {
|
|
126
|
+
outDir,
|
|
127
|
+
rootDir: "src"
|
|
128
|
+
},
|
|
129
|
+
...compilerOptions,
|
|
130
|
+
...outDir && { noEmit: void 0 }
|
|
127
131
|
}),
|
|
128
132
|
include: ["src"]
|
|
129
133
|
})) }
|
|
130
134
|
};
|
|
131
135
|
},
|
|
132
136
|
transition() {
|
|
133
|
-
return { addons: [
|
|
137
|
+
return { addons: [blockRemoveWorkflows({ workflows: ["tsc"] })] };
|
|
134
138
|
}
|
|
135
139
|
});
|
|
136
140
|
//#endregion
|
package/dist/blocks/index.d.mts
CHANGED
|
@@ -2193,6 +2193,7 @@ export declare const blocks: {
|
|
|
2193
2193
|
}>> | undefined;
|
|
2194
2194
|
}>;
|
|
2195
2195
|
blockNcc: import("bingo-stratum").BlockWithAddons<{
|
|
2196
|
+
build?: string | undefined;
|
|
2196
2197
|
entry?: string | undefined;
|
|
2197
2198
|
}, {
|
|
2198
2199
|
access: "public" | "restricted";
|
|
@@ -3565,6 +3566,8 @@ export declare const blocks: {
|
|
|
3565
3566
|
entry: string[];
|
|
3566
3567
|
properties: Record<string, unknown>;
|
|
3567
3568
|
runInCI: string[];
|
|
3569
|
+
exports?: string | undefined;
|
|
3570
|
+
main?: string | undefined;
|
|
3568
3571
|
}, {
|
|
3569
3572
|
access: "public" | "restricted";
|
|
3570
3573
|
description: string;
|
|
@@ -3748,6 +3751,7 @@ export declare const blocks: {
|
|
|
3748
3751
|
useUnknownInCatchVariables?: boolean | undefined;
|
|
3749
3752
|
verbatimModuleSyntax?: boolean | undefined;
|
|
3750
3753
|
} | undefined;
|
|
3754
|
+
outDir?: string | undefined;
|
|
3751
3755
|
}, {
|
|
3752
3756
|
access: "public" | "restricted";
|
|
3753
3757
|
description: string;
|
package/dist/blocks/index.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import { blockReleaseIt } from "./blockReleaseIt.mjs";
|
|
|
16
16
|
import { blockTSDown } from "./blockTSDown.mjs";
|
|
17
17
|
import { blockVitest } from "./blockVitest.mjs";
|
|
18
18
|
import { blockESLintPlugin } from "./blockESLintPlugin.mjs";
|
|
19
|
+
import { blockTypeScript } from "./blockTypeScript.mjs";
|
|
19
20
|
import { blockNcc } from "./blockNcc.mjs";
|
|
20
21
|
import { blockWebExt } from "./blockWebExt.mjs";
|
|
21
22
|
import { blockAllContributors } from "./blockAllContributors.mjs";
|
|
@@ -31,7 +32,6 @@ import { blockMITLicense } from "./blockMITLicense.mjs";
|
|
|
31
32
|
import { blockSecurityDocs } from "./blockSecurityDocs.mjs";
|
|
32
33
|
import { blockSideEffects } from "./blockSideEffects.mjs";
|
|
33
34
|
import { blockTemplatedWith } from "./blockTemplatedWith.mjs";
|
|
34
|
-
import { blockTypeScript } from "./blockTypeScript.mjs";
|
|
35
35
|
import { blockESLintComments } from "./blockESLintComments.mjs";
|
|
36
36
|
import { blockESLintJSDoc } from "./blockESLintJSDoc.mjs";
|
|
37
37
|
import { blockESLintJSONC } from "./blockESLintJSONC.mjs";
|
package/dist/index.mjs
CHANGED
|
@@ -17,6 +17,7 @@ import { blockReleaseIt } from "./blocks/blockReleaseIt.mjs";
|
|
|
17
17
|
import { blockTSDown } from "./blocks/blockTSDown.mjs";
|
|
18
18
|
import { blockVitest } from "./blocks/blockVitest.mjs";
|
|
19
19
|
import { blockESLintPlugin } from "./blocks/blockESLintPlugin.mjs";
|
|
20
|
+
import { blockTypeScript } from "./blocks/blockTypeScript.mjs";
|
|
20
21
|
import { blockNcc } from "./blocks/blockNcc.mjs";
|
|
21
22
|
import { blockWebExt } from "./blocks/blockWebExt.mjs";
|
|
22
23
|
import { blockAllContributors } from "./blocks/blockAllContributors.mjs";
|
|
@@ -32,7 +33,6 @@ import { blockMITLicense } from "./blocks/blockMITLicense.mjs";
|
|
|
32
33
|
import { blockSecurityDocs } from "./blocks/blockSecurityDocs.mjs";
|
|
33
34
|
import { blockSideEffects } from "./blocks/blockSideEffects.mjs";
|
|
34
35
|
import { blockTemplatedWith } from "./blocks/blockTemplatedWith.mjs";
|
|
35
|
-
import { blockTypeScript } from "./blocks/blockTypeScript.mjs";
|
|
36
36
|
import { presetMinimal } from "./presets/minimal.mjs";
|
|
37
37
|
import { presetCommon } from "./presets/common.mjs";
|
|
38
38
|
import { blockESLintComments } from "./blocks/blockESLintComments.mjs";
|
package/dist/presets/minimal.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import { blockGitignore } from "../blocks/blockGitignore.mjs";
|
|
|
14
14
|
import { blockPrettier } from "../blocks/blockPrettier.mjs";
|
|
15
15
|
import { blockRepositorySecrets } from "../blocks/blockRepositorySecrets.mjs";
|
|
16
16
|
import { blockTSDown } from "../blocks/blockTSDown.mjs";
|
|
17
|
+
import { blockTypeScript } from "../blocks/blockTypeScript.mjs";
|
|
17
18
|
import { blockGitHubApps } from "../blocks/blockGitHubApps.mjs";
|
|
18
19
|
import { blockBin } from "../blocks/blockBin.mjs";
|
|
19
20
|
import { blockContributingDocs } from "../blocks/blockContributingDocs.mjs";
|
|
@@ -26,7 +27,6 @@ import { blockRepositorySettings } from "../blocks/blockRepositorySettings.mjs";
|
|
|
26
27
|
import { blockSecurityDocs } from "../blocks/blockSecurityDocs.mjs";
|
|
27
28
|
import { blockSideEffects } from "../blocks/blockSideEffects.mjs";
|
|
28
29
|
import { blockTemplatedWith } from "../blocks/blockTemplatedWith.mjs";
|
|
29
|
-
import { blockTypeScript } from "../blocks/blockTypeScript.mjs";
|
|
30
30
|
//#region src/presets/minimal.ts
|
|
31
31
|
const presetMinimal = base.createPreset({
|
|
32
32
|
about: {
|