Skip to content

Commit e6e1575

Browse files
feat: add opt-in usage of create as underlying files engine (#1670)
## PR Checklist - [x] Addresses an existing open issue: fixes #1181 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Adds an intentionally undocumented option for a `CTA_CREATE_ENGINE` environment variable. It switches the file creation engine from the current (now, legacy!) system to the [`create` engine](https://github.com/JoshuaKGoldberg/create): ```shell CTA_CREATE_ENGINE=true node ./bin/index.js ... ``` Next up after this will be to wholly remove the current/legacy files, then move onto commands and network requests, then options parsing altogether. Those will be followup PRs. 💝
1 parent 79412ab commit e6e1575

File tree

77 files changed

+3716
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3716
-118
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h1 align="center">Create TypeScript App</h1>
22

3-
<p align="center">Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 💝</p>
3+
<p align="center">Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. ❤️‍🔥</p>
44

55
<p align="center">
66
<!-- prettier-ignore-start -->

cspell.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@
1212
],
1313
"words": [
1414
"allcontributors",
15+
"Anson",
1516
"apexskier",
1617
"arethetypeswrong",
1718
"automerge",
1819
"codespace",
20+
"dbaeumer",
1921
"execa",
2022
"infile",
2123
"joshuakgoldberg",
2224
"markdownlintignore",
2325
"mtfoley",
2426
"outro",
2527
"tada",
26-
"tseslint"
28+
"tseslint",
29+
"wontfix"
2730
]
2831
}

eslint.config.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ export default tseslint.config(
9797
{
9898
extends: [vitest.configs.recommended],
9999
files: ["**/*.test.*"],
100-
rules: {
101-
"@typescript-eslint/no-unsafe-assignment": "off",
102-
},
100+
rules: { "@typescript-eslint/no-unsafe-assignment": "off" },
103101
},
104102
{
105103
extends: [yml.configs["flat/recommended"], yml.configs["flat/prettier"]],

knip.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://unpkg.com/knip@latest/schema.json",
3-
"entry": ["src/index.ts!", "script/*e2e.js"],
3+
"entry": ["script/*e2e.js", "src/index.ts!", "src/**/*.test.*"],
44
"ignoreExportsUsedInFile": { "interface": true, "type": true },
55
"project": ["src/**/*.ts!", "script/**/*.js"]
66
}

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "create-typescript-app",
33
"version": "1.75.0",
4-
"description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 💝",
4+
"description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. ❤️‍🔥",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/JoshuaKGoldberg/create-typescript-app"
@@ -45,6 +45,7 @@
4545
"@prettier/sync": "^0.5.2",
4646
"all-contributors-for-repository": "^0.3.0",
4747
"chalk": "^5.3.0",
48+
"create": "0.1.0-alpha.0",
4849
"execa": "^9.5.1",
4950
"get-github-auth-token": "^0.1.0",
5051
"git-remote-origin-url": "^4.0.0",
@@ -54,6 +55,7 @@
5455
"npm-user": "^6.1.1",
5556
"octokit": "^4.0.2",
5657
"parse-author": "^2.0.0",
58+
"parse-package-name": "^1.0.0",
5759
"prettier": "^3.4.1",
5860
"replace-in-file": "^8.2.0",
5961
"rimraf": "^6.0.1",
@@ -76,6 +78,7 @@
7678
"@vitest/eslint-plugin": "1.1.14",
7779
"c8": "10.1.2",
7880
"console-fail-test": "0.5.0",
81+
"create-testers": "0.1.0-alpha.0",
7982
"cspell": "8.16.1",
8083
"eslint": "9.16.0",
8184
"eslint-plugin-jsdoc": "50.6.0",

pnpm-lock.yaml

+34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

script/__snapshots__/migrate-test-e2e.ts.snap

+14-37
Original file line numberDiff line numberDiff line change
@@ -114,42 +114,6 @@ exports[`expected file changes > README.md 1`] = `
114114
+> 💙 This package was templated with [\`create-typescript-app\`](https://github.com/JoshuaKGoldberg/create-typescript-app)."
115115
`;
116116

117-
exports[`expected file changes > cspell.json 1`] = `
118-
"--- a/cspell.json
119-
+++ b/cspell.json
120-
@@ ... @@
121-
".all-contributorsrc",
122-
".github",
123-
"CHANGELOG.md",
124-
- "coverage*",
125-
+ "coverage",
126-
"lib",
127-
"node_modules",
128-
- "pnpm-lock.yaml",
129-
- "script/__snapshots__"
130-
+ "pnpm-lock.yaml"
131-
],
132-
"words": [
133-
"allcontributors",
134-
@@ ... @@
135-
"arethetypeswrong",
136-
"automerge",
137-
"codespace",
138-
- "execa",
139-
+ "contributorsrc",
140-
"infile",
141-
"joshuakgoldberg",
142-
"markdownlintignore",
143-
"mtfoley",
144-
"outro",
145-
"tada",
146-
- "tseslint"
147-
+ "tseslint",
148-
+ "wontfix"
149-
]
150-
}"
151-
`;
152-
153117
exports[`expected file changes > eslint.config.js 1`] = `
154118
"--- a/eslint.config.js
155119
+++ b/eslint.config.js
@@ -238,14 +202,27 @@ exports[`expected file changes > knip.json 1`] = `
238202
@@ ... @@
239203
{
240204
"$schema": "https://unpkg.com/knip@latest/schema.json",
241-
- "entry": ["src/index.ts!", "script/*e2e.js"],
205+
- "entry": ["script/*e2e.js", "src/index.ts!", "src/**/*.test.*"],
242206
+ "entry": ["src/index.ts!"],
243207
"ignoreExportsUsedInFile": { "interface": true, "type": true },
244208
- "project": ["src/**/*.ts!", "script/**/*.js"]
245209
+ "project": ["src/**/*.ts!"]
246210
}"
247211
`;
248212
213+
exports[`expected file changes > package.json 1`] = `
214+
"--- a/package.json
215+
+++ b/package.json
216+
@@ ... @@
217+
"lint-staged": "15.2.10",
218+
"markdownlint": "0.36.1",
219+
"markdownlint-cli": "0.43.0",
220+
+ "prettier": "^3.4.1",
221+
"prettier-plugin-curly": "0.3.1",
222+
"prettier-plugin-packagejson": "2.5.6",
223+
"prettier-plugin-sh": "0.14.0","
224+
`;
225+
249226
exports[`expected file changes > tsconfig.json 1`] = `
250227
"--- a/tsconfig.json
251228
+++ b/tsconfig.json

script/migrate-test-e2e.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ const filesExpectedToBeChanged = [
1111
".github/workflows/ci.yml",
1212
".gitignore",
1313
".prettierignore",
14-
"cspell.json",
1514
"eslint.config.js",
15+
"package.json",
1616
"tsconfig.json",
1717
];
1818

1919
const filesThatMightBeChanged = new Set([
20+
// For now, ignore typos cspell is picking up from migration snapshots.
21+
"cspell.json",
22+
2023
"script/__snapshots__/migrate-test-e2e.ts.snap",
2124
...filesExpectedToBeChanged,
2225
]);

src/create/createWithOptions.ts

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { $ } from "execa";
22

3-
import { withSpinner, withSpinners } from "../shared/cli/spinners.js";
3+
import {
4+
LabeledSpinnerTask,
5+
withSpinner,
6+
withSpinners,
7+
} from "../shared/cli/spinners.js";
48
import { createCleanupCommands } from "../shared/createCleanupCommands.js";
59
import { doesRepositoryExist } from "../shared/doesRepositoryExist.js";
10+
import { isUsingCreateEngine } from "../shared/isUsingCreateEngine.js";
611
import { GitHubAndOptions } from "../shared/options/readOptions.js";
712
import { addToolAllContributors } from "../steps/addToolAllContributors.js";
813
import { clearLocalGitTags } from "../steps/clearLocalGitTags.js";
@@ -20,12 +25,16 @@ export async function createWithOptions({ github, options }: GitHubAndOptions) {
2025
await writeStructure(options);
2126
},
2227
],
23-
[
24-
"Writing README.md",
25-
async () => {
26-
await writeReadme(options);
27-
},
28-
],
28+
...(isUsingCreateEngine()
29+
? []
30+
: [
31+
[
32+
"Writing README.md",
33+
async () => {
34+
await writeReadme(options);
35+
},
36+
] satisfies LabeledSpinnerTask<void>,
37+
]),
2938
]);
3039

3140
if (!options.excludeAllContributors && !options.skipAllContributorsApi) {

src/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
export * from "./greet.js";
2+
3+
// If you're using create-typescript-app as a template, ignore these.
4+
// They're plumbing for the create engine. :)
5+
export * from "./next/blocks/index.js";
6+
export { default } from "./next/template.js";
7+
28
export * from "./types.js";

0 commit comments

Comments
 (0)