Skip to content
This repository was archived by the owner on Sep 10, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changeset/optional-auth-domain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"create-eigen-game": patch
---

Scaffold an optional `AUTH_DOMAIN`.

Web sign-in runs through Firebase's popup, which loads
`https://<authDomain>/__/auth/handler`, so Google's account chooser reads "Sign
in to continue to my-project.firebaseapp.com". `app-config.json` now carries an
`AUTH_DOMAIN` key and `main.dart` passes it to `EngineConfig.authDomain`. The
pinned `eigen_flutter` floor moves to `^0.4.1` for that parameter: additive, so
a patch pre-1.0, but the floor has to rise or a scaffold could resolve 0.4.0 and
fail to compile.

Empty is the scaffolded value and the right answer for almost every game: it
leaves sign-in on the Firebase project's own domain, which works everywhere and
needs no Firebase Hosting. Setting it is cosmetic and web-only, and it is not
`APP_HOST`: the value must be a Firebase Hosting domain, a sibling of the
Worker's host rather than the host itself.
8 changes: 7 additions & 1 deletion packages/create-eigen-game/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,14 @@ const engineVersion = engineRange((JSON.parse(readFileSync(resolve(packageRoot,
* every 0.3.x pins `eigen_api: ^0.2.0`, which cannot read a 0.3.x engine at all.
* A scaffold pinning 0.3.x would therefore resolve, compile, and then fail to
* render a game, which is the worst of the three.
*
* Raised to 0.4.1 for `EngineConfig.authDomain`, which the generated
* `main.dart` passes. Additive, so pre-1.0 it is a patch and `^0.4.0` would
* still resolve it, but `^0.4.0` also still resolves 0.4.0, where the parameter
* does not exist and the scaffold would not compile. The floor is what makes
* the generated code and the installed shell agree.
*/
const flutterClientVersion = "^0.4.0";
const flutterClientVersion = "^0.4.1";

const gameSlug = (value: string): string => {
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"API_BASE_URL": "http://localhost:8787",
"APP_HOST": "",
"AUTH_DOMAIN": "",
"GOOGLE_WEB_CLIENT_ID": "",
"FIREBASE_VAPID_KEY": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ const _apiBaseUrl = String.fromEnvironment('API_BASE_URL');
const _googleWebClientId = String.fromEnvironment('GOOGLE_WEB_CLIENT_ID');
const _firebaseVapidKey = String.fromEnvironment('FIREBASE_VAPID_KEY');
const _appHost = String.fromEnvironment('APP_HOST');
// Optional, and empty is the normal answer. Sign-in works without it; setting
// it only changes the hostname Google's account chooser shows a web player,
// and it requires a Firebase Hosting domain, which is not APP_HOST:
// https://eigeninteractive.com/docs/ship-it/deploy-the-web-app
const _authDomain = String.fromEnvironment('AUTH_DOMAIN');

Future<void> main() async {
await runEngineApp(
Expand All @@ -28,6 +33,7 @@ Future<void> main() async {
apiBaseUrl: _apiBaseUrl,
googleWebClientId: _googleWebClientId,
appHost: _appHost.isEmpty ? null : _appHost,
authDomain: _authDomain.isEmpty ? null : _authDomain,
firebaseVapidKey: _firebaseVapidKey,
),
),
Expand Down
2 changes: 1 addition & 1 deletion packages/create-eigen-game/test/scaffold.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ describe("scaffoldGame", () => {
// release on that line, which is the part a scaffold-time pub.dev lookup
// was duplicating. Crossing to the next line is the move that needs the
// `scaffold` CI job to confirm the templates still compile.
expect(run).toHaveBeenCalledWith("flutter", ["pub", "add", "eigen_flutter@^0.4.0", "firebase_core@^4.9.0", "firebase_messaging@^16.2.2"], expect.stringMatching(/\/app$/));
expect(run).toHaveBeenCalledWith("flutter", ["pub", "add", "eigen_flutter@^0.4.1", "firebase_core@^4.9.0", "firebase_messaging@^16.2.2"], expect.stringMatching(/\/app$/));
// A separate `pub add` (rather than folded into the call above) so a
// failure here is legible on its own, and because these are dev
// dependencies (`dev:` prefix) while the engine/Firebase packages above
Expand Down