@defold-typescript/cli 0.3.0 → 0.4.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/bin.js +6 -6
- package/dist/index.js +6 -6
- package/package.json +3 -3
- package/src/init.ts +8 -7
package/dist/bin.js
CHANGED
|
@@ -367,9 +367,9 @@ var SCAFFOLD_DEV_DEPS = {
|
|
|
367
367
|
"@defold-typescript/types": typesVersionSpec(),
|
|
368
368
|
"@biomejs/biome": "^2.2.0"
|
|
369
369
|
};
|
|
370
|
-
function repairManagedDevDeps(devDeps) {
|
|
370
|
+
function repairManagedDevDeps(devDeps, force = false) {
|
|
371
371
|
delete devDeps["@defold-typescript/transpiler"];
|
|
372
|
-
if (devDeps["@defold-typescript/types"]?.startsWith("workspace:")) {
|
|
372
|
+
if (force || devDeps["@defold-typescript/types"]?.startsWith("workspace:")) {
|
|
373
373
|
devDeps["@defold-typescript/types"] = typesVersionSpec();
|
|
374
374
|
}
|
|
375
375
|
}
|
|
@@ -407,7 +407,7 @@ function writeBiome(cwd, written) {
|
|
|
407
407
|
writeJson(biomePath, BIOME_JSON_CONTENT);
|
|
408
408
|
written.push("biome.json");
|
|
409
409
|
}
|
|
410
|
-
function writeTsSurface(cwd, written) {
|
|
410
|
+
function writeTsSurface(cwd, written, force = false) {
|
|
411
411
|
mkdirSync2(path6.join(cwd, "src"), { recursive: true });
|
|
412
412
|
writeFileSync2(path6.join(cwd, "src", "main.ts"), MAIN_TS_CONTENT);
|
|
413
413
|
written.push("src/main.ts");
|
|
@@ -430,7 +430,7 @@ function writeTsSurface(cwd, written) {
|
|
|
430
430
|
devDeps[name] = version;
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
repairManagedDevDeps(devDeps);
|
|
433
|
+
repairManagedDevDeps(devDeps, force);
|
|
434
434
|
existing.devDependencies = devDeps;
|
|
435
435
|
existing["defold-typescript"] ??= { "defold-version": CURRENT_STABLE_DEFOLD_VERSION };
|
|
436
436
|
writeJson(pkgPath, existing);
|
|
@@ -467,7 +467,7 @@ main_collection = /main/main.collectionc
|
|
|
467
467
|
written.push("main/main.collection");
|
|
468
468
|
writeFileSync2(path6.join(cwd, "main", "main.script"), MAIN_SCRIPT_CONTENT);
|
|
469
469
|
written.push("main/main.script");
|
|
470
|
-
const scriptKind = writeTsSurface(cwd, written);
|
|
470
|
+
const scriptKind = writeTsSurface(cwd, written, force);
|
|
471
471
|
return { written, scriptKind };
|
|
472
472
|
}
|
|
473
473
|
function runInit(opts) {
|
|
@@ -483,7 +483,7 @@ function runInit(opts) {
|
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
485
|
const written = [];
|
|
486
|
-
const scriptKind = writeTsSurface(cwd, written);
|
|
486
|
+
const scriptKind = writeTsSurface(cwd, written, force);
|
|
487
487
|
return { written, scriptKind };
|
|
488
488
|
}
|
|
489
489
|
|
package/dist/index.js
CHANGED
|
@@ -431,9 +431,9 @@ var SCAFFOLD_DEV_DEPS = {
|
|
|
431
431
|
"@defold-typescript/types": typesVersionSpec(),
|
|
432
432
|
"@biomejs/biome": "^2.2.0"
|
|
433
433
|
};
|
|
434
|
-
function repairManagedDevDeps(devDeps) {
|
|
434
|
+
function repairManagedDevDeps(devDeps, force = false) {
|
|
435
435
|
delete devDeps["@defold-typescript/transpiler"];
|
|
436
|
-
if (devDeps["@defold-typescript/types"]?.startsWith("workspace:")) {
|
|
436
|
+
if (force || devDeps["@defold-typescript/types"]?.startsWith("workspace:")) {
|
|
437
437
|
devDeps["@defold-typescript/types"] = typesVersionSpec();
|
|
438
438
|
}
|
|
439
439
|
}
|
|
@@ -471,7 +471,7 @@ function writeBiome(cwd, written) {
|
|
|
471
471
|
writeJson(biomePath, BIOME_JSON_CONTENT);
|
|
472
472
|
written.push("biome.json");
|
|
473
473
|
}
|
|
474
|
-
function writeTsSurface(cwd, written) {
|
|
474
|
+
function writeTsSurface(cwd, written, force = false) {
|
|
475
475
|
mkdirSync2(path7.join(cwd, "src"), { recursive: true });
|
|
476
476
|
writeFileSync2(path7.join(cwd, "src", "main.ts"), MAIN_TS_CONTENT);
|
|
477
477
|
written.push("src/main.ts");
|
|
@@ -494,7 +494,7 @@ function writeTsSurface(cwd, written) {
|
|
|
494
494
|
devDeps[name] = version;
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
repairManagedDevDeps(devDeps);
|
|
497
|
+
repairManagedDevDeps(devDeps, force);
|
|
498
498
|
existing.devDependencies = devDeps;
|
|
499
499
|
existing["defold-typescript"] ??= { "defold-version": CURRENT_STABLE_DEFOLD_VERSION };
|
|
500
500
|
writeJson(pkgPath, existing);
|
|
@@ -531,7 +531,7 @@ main_collection = /main/main.collectionc
|
|
|
531
531
|
written.push("main/main.collection");
|
|
532
532
|
writeFileSync2(path7.join(cwd, "main", "main.script"), MAIN_SCRIPT_CONTENT);
|
|
533
533
|
written.push("main/main.script");
|
|
534
|
-
const scriptKind = writeTsSurface(cwd, written);
|
|
534
|
+
const scriptKind = writeTsSurface(cwd, written, force);
|
|
535
535
|
return { written, scriptKind };
|
|
536
536
|
}
|
|
537
537
|
function runInit(opts) {
|
|
@@ -547,7 +547,7 @@ function runInit(opts) {
|
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
const written = [];
|
|
550
|
-
const scriptKind = writeTsSurface(cwd, written);
|
|
550
|
+
const scriptKind = writeTsSurface(cwd, written, force);
|
|
551
551
|
return { written, scriptKind };
|
|
552
552
|
}
|
|
553
553
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defold-typescript/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "End-user CLI for scaffolding and building Defold projects written in TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"test": "bun test"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@defold-typescript/transpiler": "0.
|
|
35
|
-
"@defold-typescript/types": "0.
|
|
34
|
+
"@defold-typescript/transpiler": "0.4.1",
|
|
35
|
+
"@defold-typescript/types": "0.4.1"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/init.ts
CHANGED
|
@@ -134,10 +134,11 @@ const SCAFFOLD_DEV_DEPS: Record<string, string> = {
|
|
|
134
134
|
// repairs an entry it didn't itself create, so repair them explicitly: the
|
|
135
135
|
// transpiler is CLI-internal and must not be a consumer dep at all, and a
|
|
136
136
|
// `workspace:` types pin must become a concrete published version. A concrete
|
|
137
|
-
// user-chosen types pin is left alone
|
|
138
|
-
|
|
137
|
+
// user-chosen types pin is left alone unless `force` is set, the explicit
|
|
138
|
+
// opt-in to refresh the managed pin (and only that pin) to the CLI's version.
|
|
139
|
+
function repairManagedDevDeps(devDeps: Record<string, string>, force = false): void {
|
|
139
140
|
delete devDeps["@defold-typescript/transpiler"];
|
|
140
|
-
if (devDeps["@defold-typescript/types"]?.startsWith("workspace:")) {
|
|
141
|
+
if (force || devDeps["@defold-typescript/types"]?.startsWith("workspace:")) {
|
|
141
142
|
devDeps["@defold-typescript/types"] = typesVersionSpec();
|
|
142
143
|
}
|
|
143
144
|
}
|
|
@@ -171,7 +172,7 @@ function writeBiome(cwd: string, written: string[]): void {
|
|
|
171
172
|
written.push("biome.json");
|
|
172
173
|
}
|
|
173
174
|
|
|
174
|
-
function writeTsSurface(cwd: string, written: string[]): ScriptKind | null {
|
|
175
|
+
function writeTsSurface(cwd: string, written: string[], force = false): ScriptKind | null {
|
|
175
176
|
mkdirSync(path.join(cwd, "src"), { recursive: true });
|
|
176
177
|
writeFileSync(path.join(cwd, "src", "main.ts"), MAIN_TS_CONTENT);
|
|
177
178
|
written.push("src/main.ts");
|
|
@@ -196,7 +197,7 @@ function writeTsSurface(cwd: string, written: string[]): ScriptKind | null {
|
|
|
196
197
|
devDeps[name] = version;
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
|
-
repairManagedDevDeps(devDeps);
|
|
200
|
+
repairManagedDevDeps(devDeps, force);
|
|
200
201
|
existing.devDependencies = devDeps;
|
|
201
202
|
existing["defold-typescript"] ??= { "defold-version": CURRENT_STABLE_DEFOLD_VERSION };
|
|
202
203
|
writeJson(pkgPath, existing);
|
|
@@ -243,7 +244,7 @@ export function runNewProjectInit(cwd: string, force = false): RunInitResult {
|
|
|
243
244
|
writeFileSync(path.join(cwd, "main", "main.script"), MAIN_SCRIPT_CONTENT);
|
|
244
245
|
written.push("main/main.script");
|
|
245
246
|
|
|
246
|
-
const scriptKind = writeTsSurface(cwd, written);
|
|
247
|
+
const scriptKind = writeTsSurface(cwd, written, force);
|
|
247
248
|
|
|
248
249
|
return { written, scriptKind };
|
|
249
250
|
}
|
|
@@ -266,6 +267,6 @@ export function runInit(opts: RunInitOptions): RunInitResult {
|
|
|
266
267
|
}
|
|
267
268
|
|
|
268
269
|
const written: string[] = [];
|
|
269
|
-
const scriptKind = writeTsSurface(cwd, written);
|
|
270
|
+
const scriptKind = writeTsSurface(cwd, written, force);
|
|
270
271
|
return { written, scriptKind };
|
|
271
272
|
}
|