@openload28/create-tt 1.0.0-dev.20260908.330 → 1.0.0-dev.20260910.348
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 +6 -1
- package/package.json +1 -1
- package/src/installer.js +13 -2
package/README.md
CHANGED
|
@@ -21,7 +21,9 @@ The initializer updates `package.json` structurally. For bundlers with a
|
|
|
21
21
|
declarative config, it generates an `tt.*.config.mjs` wrapper instead of
|
|
22
22
|
rewriting arbitrary user code. It also creates `tsconfig.tt.json`, which extends
|
|
23
23
|
the existing TypeScript config and declares the content mapper. Existing scripts
|
|
24
|
-
and config files stay intact.
|
|
24
|
+
and config files stay intact. Re-running init accepts unchanged generated configs;
|
|
25
|
+
if a generated config has been customized, init stops before writing any project
|
|
26
|
+
files.
|
|
25
27
|
Use `--no-install` in CI or when dependencies will be installed later.
|
|
26
28
|
New projects use Bun for dependency installation and scripts. Existing projects
|
|
27
29
|
keep the package manager declared in `package.json` or selected by their lockfile.
|
|
@@ -38,3 +40,6 @@ The Nightly initializer installs the `next` channels of
|
|
|
38
40
|
`@openload28/tt-lang` and `@openload28/unplugin-tt`. The current TypeScript toolchain
|
|
39
41
|
prerequisite is documented in the repository
|
|
40
42
|
[installation guide](https://github.com/load28/tt/blob/main/docs/getting-started.md).
|
|
43
|
+
|
|
44
|
+
Beta and RC initializers select the matching `beta` and `rc` dependency channels;
|
|
45
|
+
stable initializers select `latest`.
|
package/package.json
CHANGED
package/src/installer.js
CHANGED
|
@@ -24,6 +24,7 @@ const versions = {
|
|
|
24
24
|
|
|
25
25
|
export function dependencyChannel(packageVersion) {
|
|
26
26
|
if (/-dev\./.test(packageVersion)) return 'next'
|
|
27
|
+
if (/-beta(?:\.|$)/.test(packageVersion)) return 'beta'
|
|
27
28
|
if (/-rc(?:\.|$)/.test(packageVersion)) return 'rc'
|
|
28
29
|
return 'latest'
|
|
29
30
|
}
|
|
@@ -148,7 +149,7 @@ export async function initializeExisting(options) {
|
|
|
148
149
|
manifest.scripts['tt:check'] ??= `tsc -p ${typeConfig} --runExternalCode`
|
|
149
150
|
|
|
150
151
|
const baseConfig = existsSync(join(root, 'tsconfig.json')) ? './tsconfig.json' : undefined
|
|
151
|
-
|
|
152
|
+
const generated = [[typeConfig, `${JSON.stringify(tsconfig(baseConfig), null, ' ')}\n`]]
|
|
152
153
|
|
|
153
154
|
const files = []
|
|
154
155
|
let manualModule
|
|
@@ -160,7 +161,7 @@ export async function initializeExisting(options) {
|
|
|
160
161
|
if (bundler === 'esbuild') {
|
|
161
162
|
manualModule = adapter.module
|
|
162
163
|
} else {
|
|
163
|
-
|
|
164
|
+
generated.push([adapter.wrapper, wrapperConfig(adapter.module, base)])
|
|
164
165
|
files.push(adapter.wrapper)
|
|
165
166
|
manifest.scripts['tt:dev'] ??= `${adapter.commands.dev} --config ${adapter.wrapper}`
|
|
166
167
|
manifest.scripts['tt:build'] ??= `tsc -p ${typeConfig} --runExternalCode && ${adapter.commands.build} --config ${adapter.wrapper}`
|
|
@@ -169,6 +170,16 @@ export async function initializeExisting(options) {
|
|
|
169
170
|
manifest.scripts['tt:build'] ??= 'ttc -o .tt-build src'
|
|
170
171
|
}
|
|
171
172
|
|
|
173
|
+
// Validate the complete output set before changing any project files.
|
|
174
|
+
// Identical generated files make repeated init safe; customized files
|
|
175
|
+
// require an explicit user decision outside the initializer.
|
|
176
|
+
for (const [file, content] of generated) {
|
|
177
|
+
const path = join(root, file)
|
|
178
|
+
if (existsSync(path) && await readFile(path, 'utf8') !== content) {
|
|
179
|
+
throw new Error(`refusing to overwrite existing config: ${path}`)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
for (const [file, content] of generated) await writeFile(join(root, file), content)
|
|
172
183
|
await writeJson(manifestPath, manifest, indentation(source))
|
|
173
184
|
files.push(typeConfig)
|
|
174
185
|
return { root, packageManager, mode: 'init', bundler: bundler ?? 'none', files, manualModule }
|