create-eigen-game 0.12.1 → 0.13.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/README.md +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +466 -378
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +95 -92
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -27
- package/dist/src-q9BxESYC.js +833 -0
- package/dist/src-q9BxESYC.js.map +1 -0
- package/package.json +9 -9
- package/src/cli.ts +437 -0
- package/src/engine-range.ts +60 -0
- package/src/index.ts +971 -0
- package/src/link-firebase.ts +70 -0
- package/src/prompt.ts +182 -0
- package/src/summary.ts +86 -0
- package/templates/app-overlay/lib/game/README.md +1 -1
- package/templates/app-overlay/lib/main.dart.template +8 -5
- package/templates/project/README.md +2 -2
- package/templates/project/package.json +3 -3
- package/templates/worker/.dev.vars.example +1 -0
- package/templates/worker/README.md +5 -2
- package/templates/worker/package.json +1 -1
- package/templates/worker/src/module/v1.ts +1 -0
- package/dist/chunk-L7EVXO3Y.js +0 -439
- package/dist/chunk-L7EVXO3Y.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the engine range emitted into a scaffolded project comes from.
|
|
3
|
+
*
|
|
4
|
+
* Its own module because the two branches below execute in different worlds,
|
|
5
|
+
* one only inside this repository and the other only inside a published tarball,
|
|
6
|
+
* and a function whose published-only path never runs in CI is a function that
|
|
7
|
+
* is not tested. `src/index.ts` uses it; the package `exports` map does not
|
|
8
|
+
* expose it, so it is internal despite being importable by the tests.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** The dependency whose version the scaffolder emits into the generated server. */
|
|
12
|
+
export const ENGINE_PACKAGE = "@eigeninteractive/server";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The engine range for a scaffolded project, from this package's own
|
|
16
|
+
* `@eigeninteractive/server` devDependency.
|
|
17
|
+
*
|
|
18
|
+
* That number is not maintained by anyone: it is the version CI compiled the
|
|
19
|
+
* templates against, because `pnpm -r typecheck` runs
|
|
20
|
+
* `tsc -p templates/worker/tsconfig.json` inside this workspace. Emitting
|
|
21
|
+
* anything else would mean shipping templates paired with an engine no build
|
|
22
|
+
* ever saw.
|
|
23
|
+
*
|
|
24
|
+
* It replaced a derivation from this package's OWN version, which was correct
|
|
25
|
+
* only while `create-eigen-game` sat in the `fixed` changesets group, and that
|
|
26
|
+
* membership is what forced an engine-wide release for every scaffolder-only
|
|
27
|
+
* change. Reading the dependency keeps the guarantee and drops the coupling.
|
|
28
|
+
*
|
|
29
|
+
* Two branches, because the same manifest reads differently in the two places
|
|
30
|
+
* this runs:
|
|
31
|
+
*
|
|
32
|
+
* - **Published tarball**: pnpm rewrites `workspace:*` to the exact version
|
|
33
|
+
* while packing, so the manifest already states it (`"0.2.0"`), and no
|
|
34
|
+
* sibling package exists on disk to consult.
|
|
35
|
+
* - **This workspace**: the manifest still says `workspace:*`, which names no
|
|
36
|
+
* version, so the sibling package is read directly.
|
|
37
|
+
*
|
|
38
|
+
* @param declared the raw `@eigeninteractive/server` devDependency value
|
|
39
|
+
* @param readSiblingVersion consulted only for the `workspace:` protocol
|
|
40
|
+
*/
|
|
41
|
+
export function engineRange(declared: string | undefined, readSiblingVersion: () => string | undefined): string {
|
|
42
|
+
if (!declared) {
|
|
43
|
+
throw new Error(`create-eigen-game has no ${ENGINE_PACKAGE} devDependency, which is where the engine range it emits comes from`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const version = declared.startsWith("workspace:") ? readSiblingVersion() : declared;
|
|
47
|
+
|
|
48
|
+
if (!version) {
|
|
49
|
+
throw new Error(`create-eigen-game declares ${ENGINE_PACKAGE} as "${declared}" but the workspace package could not be read, so there is no engine version to emit`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// pnpm packs `workspace:*` as a bare version, which is what makes the caret
|
|
53
|
+
// below correct. Asserting it means a change in that behaviour fails here
|
|
54
|
+
// rather than emitting something like `^^0.3.0` into a real project.
|
|
55
|
+
if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(version)) {
|
|
56
|
+
throw new Error(`expected an exact ${ENGINE_PACKAGE} version to build a range from, got "${version}"`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return `^${version}`;
|
|
60
|
+
}
|