From 732ecd8fad98f74cd360275f9ffbfb84831bc5ac Mon Sep 17 00:00:00 2001 From: Gonzalo DCL Date: Mon, 9 Dec 2024 17:52:24 -0300 Subject: [PATCH] add new params for explorer alpha --- .../src/commands/start/explorer-alpha.ts | 12 ++++++++---- .../@dcl/sdk-commands/src/commands/start/index.ts | 14 +++++++++++++- packages/@dcl/sdk-commands/src/logic/args.ts | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/packages/@dcl/sdk-commands/src/commands/start/explorer-alpha.ts b/packages/@dcl/sdk-commands/src/commands/start/explorer-alpha.ts index fd9a49752..ba899df8d 100644 --- a/packages/@dcl/sdk-commands/src/commands/start/explorer-alpha.ts +++ b/packages/@dcl/sdk-commands/src/commands/start/explorer-alpha.ts @@ -27,7 +27,7 @@ async function runApp( components: CliComponents, { cwd, - realm, + realm: realmValue, baseCoords, isHub, args @@ -40,10 +40,14 @@ async function runApp( } ) { const cmd = isWindows ? 'start' : 'open' - // Remove (--) from the command - const extraArgs = args._.map(($) => $.replace(/^-+/, '')).join('&') + const position = args['--position'] ?? `${baseCoords.x},${baseCoords.y}` + const realm = args['--realm'] ?? realmValue + const localScene = args['--local-scene'] ?? true + const debug = args['--debug'] ?? true + const dclenv = args['--dclenv'] ?? 'org' + try { - const params = `realm=${realm}&position=${baseCoords.x},${baseCoords.y}&local-scene=true&debug=true&hub=${isHub}&${extraArgs}` + const params = `realm=${realm}&position=${position}&local-scene=${localScene}&debug=${debug}&hub=${isHub}&dclenv=${dclenv}` const app = `decentraland://"${params}"` await components.spawner.exec(cwd, cmd, [app], { silent: true }) components.logger.info(`Desktop client: decentraland://${params}\n`) diff --git a/packages/@dcl/sdk-commands/src/commands/start/index.ts b/packages/@dcl/sdk-commands/src/commands/start/index.ts index ee15d9fad..8e7923e94 100644 --- a/packages/@dcl/sdk-commands/src/commands/start/index.ts +++ b/packages/@dcl/sdk-commands/src/commands/start/index.ts @@ -52,7 +52,13 @@ export const args = declareArgs({ '--desktop-client': Boolean, '--data-layer': Boolean, '--explorer-alpha': Boolean, - '--hub': Boolean + '--hub': Boolean, + // Params related to the explorer-alpha + '--debug': Boolean, + '--dclenv': String, + '--realm': String, + '--local-scene': String, + '--position': String }) export async function help(options: Options) { @@ -70,6 +76,12 @@ export async function help(options: Options) { --web3 Connects preview to browser wallet to use the associated avatar and account --skip-build Skip build and only serve the files in preview mode --desktop-client Show URL to launch preview in the desktop client (BETA) + --debug Enables Debug panel mode inside DCL Explorer (default=true) + --dclenv Decentraland Environment. Which environment uses for the content: catalyst, asset-bundles, etc. Posible values: org, zone, today. (default=org) + --realm Realm used to serve the content. (default=Localhost) + --local-scene Enable local scene development. + --position Initial Position to start the explorer. (default=position defined at scene.json) + Examples: diff --git a/packages/@dcl/sdk-commands/src/logic/args.ts b/packages/@dcl/sdk-commands/src/logic/args.ts index a7d89cc63..1875f0a89 100644 --- a/packages/@dcl/sdk-commands/src/logic/args.ts +++ b/packages/@dcl/sdk-commands/src/logic/args.ts @@ -7,7 +7,7 @@ export type Args = { export function parseArgs(argv: string[], args: T): Result { try { - return arg({ '--json': Boolean, '-h': '--help', '--help': Boolean, ...args }, { permissive: true, argv }) + return arg({ '--json': Boolean, '-h': '--help', '--help': Boolean, ...args }, { permissive: false, argv }) } catch (err: any) { if (err.name === 'ArgError') throw new CliError(`Argument error: ` + err.message) /* istanbul ignore next */