@openload28/create-tt 1.0.0-dev.20260902.311 → 1.0.0-dev.20260904.322
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/README.md +7 -1
- package/package.json +3 -2
- package/src/installer.js +29 -16
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@ Create a ready-to-run Vite + TypeScript + tt project:
|
|
|
6
6
|
bunx @openload28/create-tt@next my-app
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
Generated projects declare `@openload28/tt-lang` as a TypeScript 7.1 content
|
|
10
|
+
mapper and run `tsc` with `--runExternalCode`. `.ts` and `.tsx` files can import
|
|
11
|
+
`.tt` and `.ttx` directly without `.tt-types` sidecars.
|
|
12
|
+
|
|
9
13
|
Add tt to an existing TypeScript project. The initializer detects Vite,
|
|
10
14
|
Rollup, Rolldown, webpack, Rspack, esbuild, or Farm from `package.json`:
|
|
11
15
|
|
|
@@ -15,7 +19,9 @@ bunx @openload28/create-tt@next init
|
|
|
15
19
|
|
|
16
20
|
The initializer updates `package.json` structurally. For bundlers with a
|
|
17
21
|
declarative config, it generates an `tt.*.config.mjs` wrapper instead of
|
|
18
|
-
rewriting arbitrary user code.
|
|
22
|
+
rewriting arbitrary user code. It also creates `tsconfig.tt.json`, which extends
|
|
23
|
+
the existing TypeScript config and declares the content mapper. Existing scripts
|
|
24
|
+
and config files stay intact.
|
|
19
25
|
Use `--no-install` in CI or when dependencies will be installed later.
|
|
20
26
|
New projects use Bun for dependency installation and scripts. Existing projects
|
|
21
27
|
keep the package manager declared in `package.json` or selected by their lockfile.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openload28/create-tt",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.20260904.322",
|
|
4
4
|
"description": "Create a new tt project or add tt to an existing TypeScript project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
|
-
"test": "node --test"
|
|
20
|
+
"test": "node --test test/*.test.mjs",
|
|
21
|
+
"test:e2e": "node --test e2e/*.test.mjs"
|
|
21
22
|
},
|
|
22
23
|
"engines": {
|
|
23
24
|
"node": ">=18"
|
package/src/installer.js
CHANGED
|
@@ -107,8 +107,8 @@ export async function createProject(options) {
|
|
|
107
107
|
type: 'module',
|
|
108
108
|
scripts: {
|
|
109
109
|
dev: 'vite',
|
|
110
|
-
build: '
|
|
111
|
-
check: '
|
|
110
|
+
build: 'tsc -p tsconfig.json --runExternalCode && vite build',
|
|
111
|
+
check: 'tsc -p tsconfig.json --runExternalCode',
|
|
112
112
|
},
|
|
113
113
|
devDependencies: {
|
|
114
114
|
'@openload28/tt-lang': versions['@openload28/tt-lang'],
|
|
@@ -123,7 +123,7 @@ export async function createProject(options) {
|
|
|
123
123
|
await writeFile(join(root, 'index.html'), indexHtml)
|
|
124
124
|
await writeFile(join(root, 'src/main.ts'), "import './app.tt'\n")
|
|
125
125
|
await writeFile(join(root, 'src/app.tt'), starterSource)
|
|
126
|
-
await writeFile(join(root, '.gitignore'), 'node_modules/\ndist/\n
|
|
126
|
+
await writeFile(join(root, '.gitignore'), 'node_modules/\ndist/\n')
|
|
127
127
|
if (options.registry) {
|
|
128
128
|
await writeFile(join(root, 'bunfig.toml'), `[install]\nregistry = ${JSON.stringify(options.registry)}\n`)
|
|
129
129
|
}
|
|
@@ -144,7 +144,11 @@ export async function initializeExisting(options) {
|
|
|
144
144
|
devDependencies.typescript ??= versions.typescript
|
|
145
145
|
manifest.devDependencies = devDependencies
|
|
146
146
|
manifest.scripts ??= {}
|
|
147
|
-
|
|
147
|
+
const typeConfig = 'tsconfig.tt.json'
|
|
148
|
+
manifest.scripts['tt:check'] ??= `tsc -p ${typeConfig} --runExternalCode`
|
|
149
|
+
|
|
150
|
+
const baseConfig = existsSync(join(root, 'tsconfig.json')) ? './tsconfig.json' : undefined
|
|
151
|
+
await writeJson(join(root, typeConfig), tsconfig(baseConfig))
|
|
148
152
|
|
|
149
153
|
const files = []
|
|
150
154
|
let manualModule
|
|
@@ -159,13 +163,14 @@ export async function initializeExisting(options) {
|
|
|
159
163
|
await writeFile(join(root, adapter.wrapper), wrapperConfig(adapter.module, base))
|
|
160
164
|
files.push(adapter.wrapper)
|
|
161
165
|
manifest.scripts['tt:dev'] ??= `${adapter.commands.dev} --config ${adapter.wrapper}`
|
|
162
|
-
manifest.scripts['tt:build'] ??= `
|
|
166
|
+
manifest.scripts['tt:build'] ??= `tsc -p ${typeConfig} --runExternalCode && ${adapter.commands.build} --config ${adapter.wrapper}`
|
|
163
167
|
}
|
|
164
168
|
} else {
|
|
165
169
|
manifest.scripts['tt:build'] ??= 'ttc -o .tt-build src'
|
|
166
170
|
}
|
|
167
171
|
|
|
168
172
|
await writeJson(manifestPath, manifest, indentation(source))
|
|
173
|
+
files.push(typeConfig)
|
|
169
174
|
return { root, packageManager, mode: 'init', bundler: bundler ?? 'none', files, manualModule }
|
|
170
175
|
}
|
|
171
176
|
|
|
@@ -269,18 +274,26 @@ export default typeof base === 'function'
|
|
|
269
274
|
`
|
|
270
275
|
}
|
|
271
276
|
|
|
272
|
-
function tsconfig() {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
277
|
+
function tsconfig(extendsConfig) {
|
|
278
|
+
const config = {
|
|
279
|
+
...(extendsConfig
|
|
280
|
+
? { extends: extendsConfig, compilerOptions: { noEmit: true } }
|
|
281
|
+
: {
|
|
282
|
+
compilerOptions: {
|
|
283
|
+
target: 'ES2022',
|
|
284
|
+
module: 'Preserve',
|
|
285
|
+
moduleResolution: 'Bundler',
|
|
286
|
+
strict: true,
|
|
287
|
+
noEmit: true,
|
|
288
|
+
skipLibCheck: true,
|
|
289
|
+
},
|
|
290
|
+
include: ['src', 'vite.config.ts'],
|
|
291
|
+
}),
|
|
292
|
+
contentMappers: [
|
|
293
|
+
{ package: '@openload28/tt-lang', extensions: ['.tt', '.ttx'] },
|
|
294
|
+
],
|
|
283
295
|
}
|
|
296
|
+
return config
|
|
284
297
|
}
|
|
285
298
|
|
|
286
299
|
function packageName(value) {
|