@dcl/sdk-commands 7.20.1-21915113771.commit-e132905 → 7.20.1-21975617794.commit-7189140
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/commands/sdk-server-logs/index.d.ts +23 -0
- package/dist/commands/sdk-server-logs/index.js +271 -0
- package/dist/commands/sdk-server-logs/index.js.map +1 -0
- package/dist/commands/start/hammurabi-server.d.ts +18 -0
- package/dist/commands/start/hammurabi-server.js +82 -0
- package/dist/commands/start/hammurabi-server.js.map +1 -0
- package/dist/commands/start/index.d.ts +1 -1
- package/dist/commands/start/index.js +36 -31
- package/dist/commands/start/index.js.map +1 -1
- package/dist/commands/start/server/routes.js +2 -0
- package/dist/commands/start/server/routes.js.map +1 -1
- package/dist/commands/start/server/runtime-env.d.ts +71 -0
- package/dist/commands/start/server/runtime-env.js +226 -0
- package/dist/commands/start/server/runtime-env.js.map +1 -0
- package/dist/commands/start/server/storage-service.d.ts +8 -0
- package/dist/commands/start/server/storage-service.js +122 -0
- package/dist/commands/start/server/storage-service.js.map +1 -0
- package/dist/commands/start/types.d.ts +3 -0
- package/dist/commands/start/utils.d.ts +34 -0
- package/dist/commands/start/utils.js +104 -0
- package/dist/commands/start/utils.js.map +1 -1
- package/dist/commands/storage/env.d.ts +5 -0
- package/dist/commands/storage/env.js +86 -0
- package/dist/commands/storage/env.js.map +1 -0
- package/dist/commands/storage/index.d.ts +26 -0
- package/dist/commands/storage/index.js +130 -0
- package/dist/commands/storage/index.js.map +1 -0
- package/dist/commands/storage/player.d.ts +5 -0
- package/dist/commands/storage/player.js +143 -0
- package/dist/commands/storage/player.js.map +1 -0
- package/dist/commands/storage/scene.d.ts +5 -0
- package/dist/commands/storage/scene.js +105 -0
- package/dist/commands/storage/scene.js.map +1 -0
- package/dist/commands/storage/shared.d.ts +62 -0
- package/dist/commands/storage/shared.js +249 -0
- package/dist/commands/storage/shared.js.map +1 -0
- package/dist/commands/storage/types.d.ts +56 -0
- package/dist/commands/storage/types.js +23 -0
- package/dist/commands/storage/types.js.map +1 -0
- package/dist/components/analytics.d.ts +66 -0
- package/dist/components/analytics.js.map +1 -1
- package/dist/logic/auth-chain-headers.d.ts +11 -0
- package/dist/logic/auth-chain-headers.js +25 -0
- package/dist/logic/auth-chain-headers.js.map +1 -0
- package/dist/logic/error.d.ts +1 -1
- package/dist/logic/error.js.map +1 -1
- package/dist/logic/exec.d.ts +1 -0
- package/dist/logic/exec.js +2 -2
- package/dist/logic/exec.js.map +1 -1
- package/dist/logic/lang.js +2 -1
- package/dist/logic/lang.js.map +1 -1
- package/dist/logic/scene-validations.d.ts +9 -1
- package/dist/logic/scene-validations.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Result } from 'arg';
|
|
2
|
+
import { CliComponents } from '../../components';
|
|
3
|
+
interface Options {
|
|
4
|
+
args: Result<typeof args>;
|
|
5
|
+
components: CliComponents;
|
|
6
|
+
}
|
|
7
|
+
export declare const args: {
|
|
8
|
+
'--help': BooleanConstructor;
|
|
9
|
+
'-h': string;
|
|
10
|
+
'--dir': StringConstructor;
|
|
11
|
+
'--multiplayerId': StringConstructor;
|
|
12
|
+
'-m': string;
|
|
13
|
+
'--target': StringConstructor;
|
|
14
|
+
'-t': string;
|
|
15
|
+
'--port': NumberConstructor;
|
|
16
|
+
'-p': string;
|
|
17
|
+
'--https': BooleanConstructor;
|
|
18
|
+
'--no-browser': BooleanConstructor;
|
|
19
|
+
'-b': string;
|
|
20
|
+
};
|
|
21
|
+
export declare function help(options: Options): void;
|
|
22
|
+
export declare function main(options: Options): Promise<void>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.args = void 0;
|
|
7
|
+
exports.help = help;
|
|
8
|
+
exports.main = main;
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const fp_future_1 = __importDefault(require("fp-future"));
|
|
11
|
+
const crypto_1 = require("@dcl/crypto");
|
|
12
|
+
const crypto_2 = require("@dcl/crypto/dist/crypto");
|
|
13
|
+
const eth_connect_1 = require("eth-connect");
|
|
14
|
+
const args_1 = require("../../logic/args");
|
|
15
|
+
const error_1 = require("../../logic/error");
|
|
16
|
+
const beautiful_logs_1 = require("../../logic/beautiful-logs");
|
|
17
|
+
const account_1 = require("../../logic/account");
|
|
18
|
+
const auth_chain_headers_1 = require("../../logic/auth-chain-headers");
|
|
19
|
+
const routes_1 = require("../../linker-dapp/routes");
|
|
20
|
+
const run_dapp_1 = require("../../run-dapp");
|
|
21
|
+
const workspace_validations_1 = require("../../logic/workspace-validations");
|
|
22
|
+
const scene_validations_1 = require("../../logic/scene-validations");
|
|
23
|
+
exports.args = (0, args_1.declareArgs)({
|
|
24
|
+
'--help': Boolean,
|
|
25
|
+
'-h': '--help',
|
|
26
|
+
'--dir': String,
|
|
27
|
+
'--multiplayerId': String,
|
|
28
|
+
'-m': '--multiplayerId',
|
|
29
|
+
'--target': String,
|
|
30
|
+
'-t': '--target',
|
|
31
|
+
'--port': Number,
|
|
32
|
+
'-p': '--port',
|
|
33
|
+
'--https': Boolean,
|
|
34
|
+
'--no-browser': Boolean,
|
|
35
|
+
'-b': '--no-browser'
|
|
36
|
+
});
|
|
37
|
+
const DEFAULT_SERVER = 'https://multiplayer-server.decentraland.org';
|
|
38
|
+
function help(options) {
|
|
39
|
+
options.components.logger.log(`
|
|
40
|
+
Usage: 'sdk-commands sdk-server-logs [options]'
|
|
41
|
+
Streams real-time logs from the multiplayer server for your scene.
|
|
42
|
+
Requires --multiplayerId parameter or a scene.json with multiplayerId.
|
|
43
|
+
|
|
44
|
+
Options:
|
|
45
|
+
-h, --help Displays complete help
|
|
46
|
+
-m, --multiplayerId [id] Multiplayer server ID (required, or uses scene.json)
|
|
47
|
+
-t, --target [URL] Target multiplayer server URL (default: ${DEFAULT_SERVER})
|
|
48
|
+
--dir [path] Path to the project directory
|
|
49
|
+
-p, --port [port] Select a custom port for the linker dApp
|
|
50
|
+
-b, --no-browser Do not open a new browser window
|
|
51
|
+
--https Use HTTPS for the linker dApp
|
|
52
|
+
|
|
53
|
+
Examples:
|
|
54
|
+
- View logs using multiplayerId from scene.json:
|
|
55
|
+
$ sdk-commands sdk-server-logs
|
|
56
|
+
|
|
57
|
+
- View logs for a specific multiplayer ID:
|
|
58
|
+
$ sdk-commands sdk-server-logs --multiplayerId my-multiplayer-id
|
|
59
|
+
$ sdk-commands sdk-server-logs -m my-multiplayer-id
|
|
60
|
+
|
|
61
|
+
- Connect to local development server:
|
|
62
|
+
$ sdk-commands sdk-server-logs --multiplayerId my-id --target http://localhost:8000
|
|
63
|
+
|
|
64
|
+
- Use private key for authentication (no browser):
|
|
65
|
+
$ DCL_PRIVATE_KEY=0x... sdk-commands sdk-server-logs --multiplayerId my-id
|
|
66
|
+
`);
|
|
67
|
+
}
|
|
68
|
+
function setServerLogsRoutes(router, components, awaitResponse, signCallback) {
|
|
69
|
+
const { logger } = components;
|
|
70
|
+
const resolveLinkerPromise = () => setTimeout(() => awaitResponse.resolve(), 100);
|
|
71
|
+
const rejectLinkerPromise = (e) => setTimeout(() => awaitResponse.reject(e), 100);
|
|
72
|
+
router.post('/api/logs', async (ctx) => {
|
|
73
|
+
const value = (await ctx.request.json());
|
|
74
|
+
if (!value.address || !value.authChain) {
|
|
75
|
+
const errorMessage = `Invalid payload: ${Object.keys(value).join(' - ')}`;
|
|
76
|
+
logger.error(errorMessage);
|
|
77
|
+
resolveLinkerPromise();
|
|
78
|
+
return { status: 400, body: { success: false, error: errorMessage } };
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
await signCallback(value);
|
|
82
|
+
resolveLinkerPromise();
|
|
83
|
+
return { body: { success: true } };
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
rejectLinkerPromise(e);
|
|
87
|
+
return { status: 400, body: { success: false, error: e.message } };
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return router;
|
|
91
|
+
}
|
|
92
|
+
async function getAddressAndSignature(components, awaitResponse, payload, multiplayerId, targetUrl, linkOptions, signCallback) {
|
|
93
|
+
// If DCL_PRIVATE_KEY is set, sign directly without the linker dapp
|
|
94
|
+
if (process.env.DCL_PRIVATE_KEY) {
|
|
95
|
+
const wallet = (0, account_1.createWallet)(process.env.DCL_PRIVATE_KEY);
|
|
96
|
+
const authChain = crypto_1.Authenticator.createSimpleAuthChain(payload, wallet.address, (0, crypto_2.ethSign)((0, eth_connect_1.hexToBytes)(wallet.privateKey), payload));
|
|
97
|
+
const linkerResponse = { authChain, address: wallet.address };
|
|
98
|
+
await signCallback(linkerResponse);
|
|
99
|
+
awaitResponse.resolve();
|
|
100
|
+
return {};
|
|
101
|
+
}
|
|
102
|
+
// Use linker dapp for signing - pass the payload as the rootCID
|
|
103
|
+
const { router: commonRouter } = (0, routes_1.setRoutes)(components, {
|
|
104
|
+
rootCID: payload,
|
|
105
|
+
baseParcel: '0,0',
|
|
106
|
+
parcels: ['0,0'],
|
|
107
|
+
skipValidations: true,
|
|
108
|
+
debug: !!process.env.DEBUG,
|
|
109
|
+
isWorld: true,
|
|
110
|
+
world: multiplayerId,
|
|
111
|
+
targetUrl,
|
|
112
|
+
action: 'view-logs'
|
|
113
|
+
});
|
|
114
|
+
const router = setServerLogsRoutes(commonRouter, components, awaitResponse, signCallback);
|
|
115
|
+
components.logger.info('You need to sign to access server logs');
|
|
116
|
+
const { program } = await (0, run_dapp_1.runDapp)(components, router, { ...linkOptions, uri: `/` });
|
|
117
|
+
return { program };
|
|
118
|
+
}
|
|
119
|
+
async function streamLogs(components, logsUrl, authHeaders) {
|
|
120
|
+
const { logger, fetch: fetchComponent } = components;
|
|
121
|
+
logger.info('\nConnecting to server logs...');
|
|
122
|
+
try {
|
|
123
|
+
const response = await fetchComponent.fetch(logsUrl, {
|
|
124
|
+
method: 'GET',
|
|
125
|
+
headers: {
|
|
126
|
+
...authHeaders,
|
|
127
|
+
Accept: 'text/event-stream'
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
if (!response.ok) {
|
|
131
|
+
const errorText = await response.text();
|
|
132
|
+
throw new Error(`Server returned ${response.status}: ${errorText}`);
|
|
133
|
+
}
|
|
134
|
+
const contentType = response.headers.get('content-type') || '';
|
|
135
|
+
if (!contentType.includes('text/event-stream') && !contentType.includes('application/stream')) {
|
|
136
|
+
throw new Error('Server does not support SSE streaming');
|
|
137
|
+
}
|
|
138
|
+
logger.info('Streaming logs in real-time (press CTRL+C to stop)');
|
|
139
|
+
if (response.body) {
|
|
140
|
+
const decoder = new TextDecoder();
|
|
141
|
+
let buffer = '';
|
|
142
|
+
for await (const chunk of response.body) {
|
|
143
|
+
buffer += decoder.decode(chunk, { stream: true });
|
|
144
|
+
const lines = buffer.split('\n');
|
|
145
|
+
buffer = lines.pop() || '';
|
|
146
|
+
for (const line of lines) {
|
|
147
|
+
if (line.trim()) {
|
|
148
|
+
formatAndPrintLog(logger, line);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
logger.info('\n======================= End Scene Logs =======================');
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
(0, beautiful_logs_1.printError)(logger, 'Failed to stream logs:', e);
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function formatAndPrintLog(logger, log) {
|
|
161
|
+
// If log is a string, try to parse as JSON
|
|
162
|
+
let logObj = log;
|
|
163
|
+
if (typeof log === 'string') {
|
|
164
|
+
try {
|
|
165
|
+
logObj = JSON.parse(log);
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
// If not JSON, just print the string
|
|
169
|
+
logger.log(log);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// Extract common log fields
|
|
174
|
+
const timestamp = logObj.timestamp || logObj.time || new Date().toISOString();
|
|
175
|
+
const level = (logObj.level || logObj.severity || 'INFO').toUpperCase();
|
|
176
|
+
const message = logObj.message || logObj.msg || JSON.stringify(logObj);
|
|
177
|
+
// Format timestamp
|
|
178
|
+
const date = new Date(timestamp);
|
|
179
|
+
const formattedTime = date.toISOString().replace('T', ' ').substring(0, 19);
|
|
180
|
+
// Format the log message with timestamp
|
|
181
|
+
const formattedMessage = `[${formattedTime}] [${level}] ${message}`;
|
|
182
|
+
// Map log levels to logger methods
|
|
183
|
+
const normalizedLevel = level.toLowerCase();
|
|
184
|
+
switch (normalizedLevel) {
|
|
185
|
+
case 'error':
|
|
186
|
+
logger.error(formattedMessage);
|
|
187
|
+
break;
|
|
188
|
+
case 'warn':
|
|
189
|
+
case 'warning':
|
|
190
|
+
logger.warn(formattedMessage);
|
|
191
|
+
break;
|
|
192
|
+
case 'debug':
|
|
193
|
+
logger.debug(formattedMessage);
|
|
194
|
+
break;
|
|
195
|
+
case 'info':
|
|
196
|
+
case 'trace':
|
|
197
|
+
default:
|
|
198
|
+
logger.info(formattedMessage);
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
// If there are additional fields, print them
|
|
202
|
+
const additionalFields = Object.keys(logObj).filter((key) => !['timestamp', 'time', 'level', 'severity', 'message', 'msg'].includes(key));
|
|
203
|
+
if (additionalFields.length > 0) {
|
|
204
|
+
const additional = {};
|
|
205
|
+
additionalFields.forEach((key) => {
|
|
206
|
+
additional[key] = logObj[key];
|
|
207
|
+
});
|
|
208
|
+
logger.log(` ${JSON.stringify(additional)}`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async function main(options) {
|
|
212
|
+
const { logger } = options.components;
|
|
213
|
+
const projectRoot = (0, path_1.resolve)(process.cwd(), options.args['--dir'] || '.');
|
|
214
|
+
// Validate workspace exists
|
|
215
|
+
await (0, workspace_validations_1.getValidWorkspace)(options.components, projectRoot);
|
|
216
|
+
let multiplayerId;
|
|
217
|
+
// Check if --multiplayerId parameter is provided
|
|
218
|
+
if (options.args['--multiplayerId']) {
|
|
219
|
+
multiplayerId = options.args['--multiplayerId'];
|
|
220
|
+
logger.info(`Viewing logs for multiplayer ID: ${multiplayerId}`);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
// Fall back to scene.json
|
|
224
|
+
const sceneJson = await (0, scene_validations_1.getValidSceneJson)(options.components, projectRoot);
|
|
225
|
+
if (!sceneJson.multiplayerId) {
|
|
226
|
+
throw new error_1.CliError('SERVER_LOGS_MISSING_MULTIPLAYER_ID', 'scene.json must have multiplayerId defined, or provide --multiplayerId parameter to view server logs');
|
|
227
|
+
}
|
|
228
|
+
multiplayerId = sceneJson.multiplayerId;
|
|
229
|
+
logger.info(`Viewing logs for multiplayer ID: ${multiplayerId}`);
|
|
230
|
+
}
|
|
231
|
+
// Determine target URL
|
|
232
|
+
const baseURL = options.args['--target'] || DEFAULT_SERVER;
|
|
233
|
+
// Build the logs URL
|
|
234
|
+
const logsUrl = `${baseURL}/logs/${multiplayerId}`;
|
|
235
|
+
// Build the pathname for signing
|
|
236
|
+
const pathname = `/logs/${multiplayerId}`;
|
|
237
|
+
// Linker dApp options
|
|
238
|
+
const linkerPort = options.args['--port'];
|
|
239
|
+
const openBrowser = !options.args['--no-browser'];
|
|
240
|
+
const isHttps = !!options.args['--https'];
|
|
241
|
+
const linkOptions = { linkerPort, openBrowser, isHttps };
|
|
242
|
+
const awaitResponse = (0, fp_future_1.default)();
|
|
243
|
+
const timestamp = String(Date.now());
|
|
244
|
+
const metadata = JSON.stringify({});
|
|
245
|
+
// Build the payload to sign: method:path:timestamp:metadata
|
|
246
|
+
const payload = ['get', pathname, timestamp, metadata].join(':').toLowerCase();
|
|
247
|
+
let authHeaders = {};
|
|
248
|
+
const { program } = await getAddressAndSignature(options.components, awaitResponse, payload, multiplayerId, baseURL, linkOptions, async (linkerResponse) => {
|
|
249
|
+
authHeaders = (0, auth_chain_headers_1.createAuthChainHeaders)(linkerResponse.authChain, timestamp, metadata);
|
|
250
|
+
});
|
|
251
|
+
try {
|
|
252
|
+
await awaitResponse;
|
|
253
|
+
logger.info('Authentication successful!');
|
|
254
|
+
// Close the browser window
|
|
255
|
+
if (program) {
|
|
256
|
+
await program.stop();
|
|
257
|
+
}
|
|
258
|
+
// Start streaming logs
|
|
259
|
+
await streamLogs(options.components, logsUrl, authHeaders);
|
|
260
|
+
}
|
|
261
|
+
catch (e) {
|
|
262
|
+
(0, beautiful_logs_1.printError)(logger, 'Failed to authenticate:', e);
|
|
263
|
+
throw e;
|
|
264
|
+
}
|
|
265
|
+
finally {
|
|
266
|
+
if (program) {
|
|
267
|
+
void program.stop();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/sdk-server-logs/index.ts"],"names":[],"mappings":";;;;;;AA0CA,oBA6BC;AAgMD,oBAmFC;AA1VD,+BAA8B;AAE9B,0DAA2C;AAC3C,wCAA2C;AAC3C,oDAAiD;AACjD,6CAAwC;AAIxC,2CAA8C;AAE9C,6CAA4C;AAC5C,+DAAuD;AACvD,iDAAkD;AAClD,uEAAuE;AACvE,qDAAoE;AACpE,6CAAqD;AACrD,6EAAqE;AACrE,qEAAiE;AAOpD,QAAA,IAAI,GAAG,IAAA,kBAAW,EAAC;IAC9B,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,MAAM;IACf,iBAAiB,EAAE,MAAM;IACzB,IAAI,EAAE,iBAAiB;IACvB,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,OAAO;IAClB,cAAc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,SAAS,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAA;IAE9E,IAAI,WAAW,GAA2B,EAAE,CAAA;IAE5C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,sBAAsB,CAC9C,OAAO,CAAC,UAAU,EAClB,aAAa,EACb,OAAO,EACP,aAAa,EACb,OAAO,EACP,WAAW,EACX,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,WAAW,GAAG,IAAA,2CAAsB,EAAC,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;IACrF,CAAC,CACF,CAAA;IAED,IAAI,CAAC;QACH,MAAM,aAAa,CAAA;QACnB,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;QAEzC,2BAA2B;QAC3B,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,OAAO,CAAC,IAAI,EAAE,CAAA;QACtB,CAAC;QAED,uBAAuB;QACvB,MAAM,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;IAC5D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAA,2BAAU,EAAC,MAAM,EAAE,yBAAyB,EAAE,CAAU,CAAC,CAAA;QACzD,MAAM,CAAC,CAAA;IACT,CAAC;YAAS,CAAC;QACT,IAAI,OAAO,EAAE,CAAC;YACZ,KAAK,OAAO,CAAC,IAAI,EAAE,CAAA;QACrB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ChildProcess } from 'child_process';
|
|
2
|
+
import { CliComponents } from '../../components';
|
|
3
|
+
import { PreviewComponents } from './types';
|
|
4
|
+
import { ProjectUnion } from '../../logic/project-validations';
|
|
5
|
+
/**
|
|
6
|
+
* Starts the Multiplayer Server process using npx to install and run in one step
|
|
7
|
+
*/
|
|
8
|
+
export declare function startHammurabiServer(components: Pick<CliComponents, 'logger'>, workingDir: string, realm: string): ChildProcess;
|
|
9
|
+
/**
|
|
10
|
+
* Spawns the multiplayer server if the project requires it.
|
|
11
|
+
* Uses npx to handle installation and execution in a single step (works in Electron).
|
|
12
|
+
*
|
|
13
|
+
* @param components - Preview components including logger
|
|
14
|
+
* @param project - The project to check for authoritative multiplayer support
|
|
15
|
+
* @param realm - The realm URL to pass to the hammurabi server
|
|
16
|
+
* @returns The ChildProcess if started, undefined otherwise
|
|
17
|
+
*/
|
|
18
|
+
export declare function spawnMultiplayerIfNeeded(components: PreviewComponents, project: ProjectUnion, realm: string): ChildProcess | undefined;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startHammurabiServer = startHammurabiServer;
|
|
4
|
+
exports.spawnMultiplayerIfNeeded = spawnMultiplayerIfNeeded;
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const beautiful_logs_1 = require("../../logic/beautiful-logs");
|
|
7
|
+
const log_1 = require("../../components/log");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
const HAMMURABI_PACKAGE = '@dcl/hammurabi-server';
|
|
10
|
+
const HAMMURABI_VERSION = 'next';
|
|
11
|
+
/**
|
|
12
|
+
* Registers cleanup handlers on the global process object
|
|
13
|
+
* Returns a function to remove the handlers
|
|
14
|
+
*/
|
|
15
|
+
function registerProcessCleanup(cleanup) {
|
|
16
|
+
process.on('SIGTERM', cleanup);
|
|
17
|
+
process.on('SIGINT', cleanup);
|
|
18
|
+
process.on('exit', cleanup);
|
|
19
|
+
return () => {
|
|
20
|
+
process.off('SIGTERM', cleanup);
|
|
21
|
+
process.off('SIGINT', cleanup);
|
|
22
|
+
process.off('exit', cleanup);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Starts the Multiplayer Server process using npx to install and run in one step
|
|
27
|
+
*/
|
|
28
|
+
function startHammurabiServer(components, workingDir, realm) {
|
|
29
|
+
(0, beautiful_logs_1.printProgressInfo)(components.logger, `Starting ${log_1.colors.bold('Multiplayer Server')} with realm: ${log_1.colors.bold(realm)}`);
|
|
30
|
+
const npxArgs = ['--yes', `${HAMMURABI_PACKAGE}@${HAMMURABI_VERSION}`, `--realm=${realm}`];
|
|
31
|
+
const npxCliJs = (0, utils_1.findNpxCliJs)();
|
|
32
|
+
// In Electron, override npm_config_prefix because npm derives its prefix from process.execPath,
|
|
33
|
+
// which points to the Electron Helper binary. This causes npm to look for a `lib/` directory
|
|
34
|
+
// inside the Helper bundle, which doesn't exist (ENOENT).
|
|
35
|
+
const env = (0, utils_1.isElectronEnvironment)() ? { ...(0, utils_1.getSpawnEnv)(), npm_config_prefix: workingDir } : (0, utils_1.getSpawnEnv)();
|
|
36
|
+
// If npx-cli.js was found, run it directly via process.execPath (node in regular env,
|
|
37
|
+
// Electron Helper with ELECTRON_RUN_AS_NODE=1 in Electron). Otherwise fall back to npx binary.
|
|
38
|
+
const hammurabiProcess = npxCliJs
|
|
39
|
+
? (0, child_process_1.spawn)(process.execPath, [npxCliJs, ...npxArgs], { cwd: workingDir, shell: false, stdio: 'inherit', env })
|
|
40
|
+
: (0, child_process_1.spawn)((0, utils_1.getNpxBin)(), npxArgs, { cwd: workingDir, shell: false, stdio: 'inherit', env });
|
|
41
|
+
hammurabiProcess.on('error', (error) => {
|
|
42
|
+
(0, beautiful_logs_1.printWarning)(components.logger, `Multiplayer Server process error: ${error.message}`);
|
|
43
|
+
});
|
|
44
|
+
// Register cleanup handlers
|
|
45
|
+
const cleanup = () => {
|
|
46
|
+
if (!hammurabiProcess.killed) {
|
|
47
|
+
hammurabiProcess.kill('SIGTERM');
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const removeCleanup = registerProcessCleanup(cleanup);
|
|
51
|
+
hammurabiProcess.on('close', (code) => {
|
|
52
|
+
removeCleanup();
|
|
53
|
+
if (code !== 0 && code !== null) {
|
|
54
|
+
(0, beautiful_logs_1.printWarning)(components.logger, `Multiplayer Server exited with code ${code}`);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return hammurabiProcess;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Spawns the multiplayer server if the project requires it.
|
|
61
|
+
* Uses npx to handle installation and execution in a single step (works in Electron).
|
|
62
|
+
*
|
|
63
|
+
* @param components - Preview components including logger
|
|
64
|
+
* @param project - The project to check for authoritative multiplayer support
|
|
65
|
+
* @param realm - The realm URL to pass to the hammurabi server
|
|
66
|
+
* @returns The ChildProcess if started, undefined otherwise
|
|
67
|
+
*/
|
|
68
|
+
function spawnMultiplayerIfNeeded(components, project, realm) {
|
|
69
|
+
// Check if this is an authoritative multiplayer scene
|
|
70
|
+
const sceneWithMultiplayer = project.scene;
|
|
71
|
+
if (!sceneWithMultiplayer.authoritativeMultiplayer) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
return startHammurabiServer(components, project.workingDirectory, realm);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
(0, beautiful_logs_1.printWarning)(components.logger, `Failed to start Multiplayer Server: ${error.message}`);
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=hammurabi-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hammurabi-server.js","sourceRoot":"","sources":["../../../src/commands/start/hammurabi-server.ts"],"names":[],"mappings":";;AA+BA,oDA6CC;AAWD,4DAiBC;AAxGD,iDAAmD;AAEnD,+DAA4E;AAC5E,8CAA6C;AAI7C,mCAAqF;AAErF,MAAM,iBAAiB,GAAG,uBAAuB,CAAA;AACjD,MAAM,iBAAiB,GAAG,MAAM,CAAA;AAEhC;;;GAGG;AACH,SAAS,sBAAsB,CAAC,OAAmB;IACjD,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAC9B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KAAK,CAAC,CAAA;IAC1E,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAA,6BAAY,EAAC,UAAU,CAAC,MAAM,EAAE,uCAAuC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QACvF,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -21,7 +21,6 @@ export declare const args: {
|
|
|
21
21
|
'-w': string;
|
|
22
22
|
'--skip-build': BooleanConstructor;
|
|
23
23
|
'--data-layer': BooleanConstructor;
|
|
24
|
-
'--customEntryPoint': BooleanConstructor;
|
|
25
24
|
'--explorer-alpha': BooleanConstructor;
|
|
26
25
|
'--web-explorer': BooleanConstructor;
|
|
27
26
|
'--hub': BooleanConstructor;
|
|
@@ -36,6 +35,7 @@ export declare const args: {
|
|
|
36
35
|
'--landscape-terrain-enabled': BooleanConstructor;
|
|
37
36
|
'-n': BooleanConstructor;
|
|
38
37
|
'--bevy-web': BooleanConstructor;
|
|
38
|
+
'--no-client': BooleanConstructor;
|
|
39
39
|
};
|
|
40
40
|
export declare function help(options: Options): Promise<void>;
|
|
41
41
|
export declare function main(options: Options): Promise<void>;
|
|
@@ -66,6 +66,7 @@ const beautiful_logs_1 = require("../../logic/beautiful-logs");
|
|
|
66
66
|
const project_validations_1 = require("../../logic/project-validations");
|
|
67
67
|
const explorer_alpha_1 = require("./explorer-alpha");
|
|
68
68
|
const utils_1 = require("./utils");
|
|
69
|
+
const hammurabi_server_1 = require("./hammurabi-server");
|
|
69
70
|
exports.args = (0, args_1.declareArgs)({
|
|
70
71
|
'--dir': String,
|
|
71
72
|
'--help': Boolean,
|
|
@@ -83,7 +84,6 @@ exports.args = (0, args_1.declareArgs)({
|
|
|
83
84
|
'-w': '--no-watch',
|
|
84
85
|
'--skip-build': Boolean,
|
|
85
86
|
'--data-layer': Boolean,
|
|
86
|
-
'--customEntryPoint': Boolean,
|
|
87
87
|
'--explorer-alpha': Boolean,
|
|
88
88
|
'--web-explorer': Boolean,
|
|
89
89
|
'--hub': Boolean,
|
|
@@ -98,7 +98,8 @@ exports.args = (0, args_1.declareArgs)({
|
|
|
98
98
|
'--skip-auth-screen': Boolean,
|
|
99
99
|
'--landscape-terrain-enabled': Boolean,
|
|
100
100
|
'-n': Boolean,
|
|
101
|
-
'--bevy-web': Boolean
|
|
101
|
+
'--bevy-web': Boolean,
|
|
102
|
+
'--no-client': Boolean
|
|
102
103
|
});
|
|
103
104
|
async function help(options) {
|
|
104
105
|
options.components.logger.log(`
|
|
@@ -123,8 +124,8 @@ async function help(options) {
|
|
|
123
124
|
--skip-auth-screen Skip the auth screen (accepts 'true' or 'false').
|
|
124
125
|
--landscape-terrain-enabled Enable landscape terrain.
|
|
125
126
|
-n Open a new instance of the Client even if one is already running.
|
|
126
|
-
--bevy-web Opens preview using the Bevy Web browser window
|
|
127
|
-
--mobile
|
|
127
|
+
--bevy-web Opens preview using the Bevy Web browser window.
|
|
128
|
+
--mobile Show QR code for mobile preview on the same network
|
|
128
129
|
|
|
129
130
|
|
|
130
131
|
Examples:
|
|
@@ -149,10 +150,10 @@ async function main(options) {
|
|
|
149
150
|
const withDataLayer = options.args['--data-layer'];
|
|
150
151
|
const enableWeb3 = options.args['--web3'];
|
|
151
152
|
const isHub = !!options.args['--hub'];
|
|
152
|
-
|
|
153
|
-
const bevyWeb =
|
|
154
|
-
const isMobile =
|
|
155
|
-
const explorerAlpha = !options.args['--web-explorer'] && !bevyWeb;
|
|
153
|
+
const skipClient = !!options.args['--no-client'];
|
|
154
|
+
const bevyWeb = !!options.args['--bevy-web'] && !skipClient;
|
|
155
|
+
const isMobile = options.args['--mobile'] && !skipClient;
|
|
156
|
+
const explorerAlpha = !options.args['--web-explorer'] && !bevyWeb && !skipClient;
|
|
156
157
|
let hasSmartWearable = false;
|
|
157
158
|
const workspace = await (0, workspace_validations_1.getValidWorkspace)(options.components, workingDirectory);
|
|
158
159
|
/* istanbul ignore if */
|
|
@@ -166,15 +167,7 @@ async function main(options) {
|
|
|
166
167
|
// first run `npm run build`, this can be disabled with --skip-build
|
|
167
168
|
// then start the embedded compiler, this can be disabled with --no-watch
|
|
168
169
|
if (watch || build) {
|
|
169
|
-
await (0, build_1.buildScene)({
|
|
170
|
-
...options,
|
|
171
|
-
args: {
|
|
172
|
-
'--dir': project.workingDirectory,
|
|
173
|
-
'--watch': watch,
|
|
174
|
-
_: [],
|
|
175
|
-
'--customEntryPoint': !!options.args['--customEntryPoint']
|
|
176
|
-
}
|
|
177
|
-
}, project);
|
|
170
|
+
await (0, build_1.buildScene)({ ...options, args: { '--dir': project.workingDirectory, '--watch': watch, _: [] } }, project);
|
|
178
171
|
await (0, project_validations_1.startValidations)(options.components, project.workingDirectory);
|
|
179
172
|
}
|
|
180
173
|
// track the event
|
|
@@ -237,6 +230,22 @@ async function main(options) {
|
|
|
237
230
|
}
|
|
238
231
|
}
|
|
239
232
|
await startComponents();
|
|
233
|
+
// Start Hammurabi server if needed (stored outside components to avoid lifecycle management)
|
|
234
|
+
let hammurabiServer;
|
|
235
|
+
const project = workspace.projects[0];
|
|
236
|
+
if (project) {
|
|
237
|
+
const realm = `http://localhost:${port}`;
|
|
238
|
+
hammurabiServer = await (0, hammurabi_server_1.spawnMultiplayerIfNeeded)(components, project, realm);
|
|
239
|
+
// Register cleanup handler for hammurabi server
|
|
240
|
+
if (hammurabiServer) {
|
|
241
|
+
const cleanup = () => {
|
|
242
|
+
if (hammurabiServer && !hammurabiServer.killed) {
|
|
243
|
+
hammurabiServer.kill('SIGTERM');
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
components.signaler.programClosed.then(cleanup).catch(() => { });
|
|
247
|
+
}
|
|
248
|
+
}
|
|
240
249
|
const networkInterfaces = os.networkInterfaces();
|
|
241
250
|
const availableURLs = [];
|
|
242
251
|
(0, beautiful_logs_1.printProgressInfo)(options.components.logger, 'Preview server is now running!');
|
|
@@ -248,15 +257,14 @@ async function main(options) {
|
|
|
248
257
|
(networkInterfaces[dev] || []).forEach((details) => {
|
|
249
258
|
if (details.family === 'IPv4') {
|
|
250
259
|
const oldBackpack = 'DISABLE_backpack_editor_v2=&ENABLE_backpack_editor_v1';
|
|
251
|
-
|
|
252
|
-
let url = `${baseUrl}?position=${baseCoords.x}%2C${baseCoords.y}&${oldBackpack}`;
|
|
260
|
+
let addr = `http://${details.address}:${port}?position=${baseCoords.x}%2C${baseCoords.y}&${oldBackpack}`;
|
|
253
261
|
if (debug) {
|
|
254
|
-
|
|
262
|
+
addr = `${addr}&SCENE_DEBUG_PANEL`;
|
|
255
263
|
}
|
|
256
264
|
if (enableWeb3 || hasSmartWearable) {
|
|
257
|
-
|
|
265
|
+
addr = `${addr}&ENABLE_WEB3`;
|
|
258
266
|
}
|
|
259
|
-
availableURLs.push(
|
|
267
|
+
availableURLs.push(addr);
|
|
260
268
|
}
|
|
261
269
|
});
|
|
262
270
|
});
|
|
@@ -264,28 +272,25 @@ async function main(options) {
|
|
|
264
272
|
const lanUrl = (0, utils_1.getLanUrl)(port);
|
|
265
273
|
// Push localhost and 127.0.0.1 at top
|
|
266
274
|
const sortedURLs = availableURLs.sort((a, _b) => {
|
|
267
|
-
return a.
|
|
268
|
-
? -1
|
|
269
|
-
: 1;
|
|
275
|
+
return a.toLowerCase().includes('localhost') || a.includes('127.0.0.1') || a.includes('0.0.0.0') ? -1 : 1;
|
|
270
276
|
});
|
|
271
|
-
const bevyUrl = `https://decentraland.zone/bevy-web/?preview=true&realm=${sortedURLs[0].
|
|
277
|
+
const bevyUrl = `https://decentraland.zone/bevy-web/?preview=true&realm=${new URL(sortedURLs[0]).origin}&position=${baseCoords.x},${baseCoords.y}`;
|
|
272
278
|
if (!explorerAlpha) {
|
|
273
279
|
if (bevyWeb) {
|
|
274
280
|
components.logger.log(` ${bevyUrl}`);
|
|
275
281
|
}
|
|
276
282
|
else {
|
|
277
283
|
for (const addr of sortedURLs) {
|
|
278
|
-
components.logger.log(` ${addr
|
|
284
|
+
components.logger.log(` ${addr}`);
|
|
279
285
|
}
|
|
280
286
|
}
|
|
281
287
|
}
|
|
282
288
|
components.logger.log('\nPress CTRL+C to exit\n');
|
|
283
|
-
// Open preferably localhost/127.0.0.1
|
|
284
289
|
if (explorerAlpha && !isMobile) {
|
|
285
|
-
const realm = new URL(sortedURLs[0]
|
|
290
|
+
const realm = new URL(sortedURLs[0]).origin;
|
|
286
291
|
await (0, explorer_alpha_1.runExplorerAlpha)(components, { cwd: workingDirectory, realm, baseCoords, isHub, args: options.args });
|
|
287
292
|
}
|
|
288
|
-
if (
|
|
293
|
+
if (options.args['--mobile'] && lanUrl) {
|
|
289
294
|
const deepLink = `decentraland://open?preview=${lanUrl}&position=${baseCoords.x}%2C${baseCoords.y}`;
|
|
290
295
|
qrcode_1.default.toString(deepLink, { type: 'terminal', small: true }, (err, qr) => {
|
|
291
296
|
if (!err) {
|
|
@@ -298,7 +303,7 @@ async function main(options) {
|
|
|
298
303
|
// Open preferably localhost/127.0.0.1
|
|
299
304
|
if ((!explorerAlpha || bevyWeb) && openBrowser && sortedURLs.length) {
|
|
300
305
|
try {
|
|
301
|
-
const url = bevyWeb ? bevyUrl : sortedURLs[0]
|
|
306
|
+
const url = bevyWeb ? bevyUrl : sortedURLs[0];
|
|
302
307
|
await (0, open_1.default)(url);
|
|
303
308
|
}
|
|
304
309
|
catch (_) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,oBAqCC;AAED,oBA0MC;AA3TD,uCAAwB;AACxB,2CAA4B;AAC5B,gDAAuB;AACvB,oDAA2B;AAG3B,oCAAqC;AACrC,2CAA8C;AAC9C,qEAA6D;AAC7D,6DAAmD;AAE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