Skip to content

Commit 925eb7c

Browse files
committed
Allow pointing the server spawn at a local package build
npx accepts a directory or tarball, so DCL_SERVER_PACKAGE makes the bevy engine testable through the real spawn path before it is published.
1 parent ae5aa0e commit 925eb7c

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

packages/@dcl/sdk-commands/src/commands/start/hammurabi-server.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { isElectronEnvironment, getSpawnEnv, findNpxCliJs, getNpxBin } from './u
99
const HAMMURABI_PACKAGE = '@dcl/hammurabi-server'
1010
const HAMMURABI_VERSION = 'next'
1111

12-
const BEVY_PACKAGE = '@dcl/bevy-headless-server'
12+
const BEVY_PACKAGE = '@dcl-regenesislabs/bevy-headless-server'
1313
const BEVY_VERSION = 'next'
1414

1515
// The bevy server exits with this when it can never run here (unsupported platform,
@@ -23,6 +23,16 @@ function selectedEngine(): ServerEngine {
2323
return requested === 'bevy' || requested === 'hammurabi' ? requested : 'hammurabi'
2424
}
2525

26+
/**
27+
* npx accepts a directory or tarball as well as a registry spec, so pointing
28+
* DCL_SERVER_PACKAGE at a local build exercises this spawn path without publishing.
29+
*/
30+
function packageSpec(engine: ServerEngine): string {
31+
const override = process.env.DCL_SERVER_PACKAGE
32+
if (override) return override
33+
return engine === 'bevy' ? `${BEVY_PACKAGE}@${BEVY_VERSION}` : `${HAMMURABI_PACKAGE}@${HAMMURABI_VERSION}`
34+
}
35+
2636
/**
2737
* Registers cleanup handlers on the global process object
2838
* Returns a function to remove the handlers
@@ -48,7 +58,7 @@ export function startHammurabiServer(
4858
realm: string,
4959
engine: ServerEngine = 'hammurabi'
5060
): ChildProcess {
51-
const pkg = engine === 'bevy' ? `${BEVY_PACKAGE}@${BEVY_VERSION}` : `${HAMMURABI_PACKAGE}@${HAMMURABI_VERSION}`
61+
const pkg = packageSpec(engine)
5262

5363
printProgressInfo(
5464
components.logger,

0 commit comments

Comments
 (0)