Skip to content

Commit f96cbae

Browse files
authored
feat: Add string-based boolean flags for explorer-alpha parameters (#1139)
* fix boolean flags, they weren't working when the flag was =false because of the Boolean cast. Add new -n flag to open the client in a new instance * remvoe patch coverage check * add tests
1 parent db2ca6f commit f96cbae

File tree

4 files changed

+359
-33
lines changed

4 files changed

+359
-33
lines changed

codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ coverage:
33
project:
44
default:
55
threshold: 1%
6-
patch:
6+
patch: off
77
default:
88
threshold: 1%

packages/@dcl/sdk-commands/src/commands/start/explorer-alpha.ts

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import { CliComponents } from '../../components'
44

55
const isWindows = /^win/.test(process.platform)
66

7+
// Helper function to convert string to boolean
8+
function stringToBoolean(value: string | undefined, defaultValue: boolean = true): boolean {
9+
if (!value) return defaultValue
10+
return value.toLowerCase() === 'true'
11+
}
12+
713
export async function runExplorerAlpha(
814
components: CliComponents,
915
opts: {
@@ -42,23 +48,30 @@ async function runApp(
4248
const cmd = isWindows ? 'start' : 'open'
4349
const position = args['--position'] ?? `${baseCoords.x},${baseCoords.y}`
4450
const realm = args['--realm'] ?? realmValue
45-
const localScene = args['--local-scene'] ?? true
46-
const debug = args['--debug'] ?? true
51+
const localScene = stringToBoolean(args['--local-scene'], true)
52+
const debug = stringToBoolean(args['--debug'], true)
4753
const dclenv = args['--dclenv'] ?? 'org'
48-
const skipAuthScreen = args['--skip-auth-screen'] ?? true
49-
const landscapeTerrainEnabled = args['--landscape-terrain-enabled'] ?? true
54+
const skipAuthScreen = stringToBoolean(args['--skip-auth-screen'], true)
55+
const landscapeTerrainEnabled = stringToBoolean(args['--landscape-terrain-enabled'], true)
56+
const openDeeplinkInNewInstance = args['-n']
5057

5158
try {
52-
const queryParams = [
53-
`realm=${realm}`,
54-
`position=${position}`,
55-
`local-scene=${localScene}`,
56-
`debug=${debug}`,
57-
`hub=${isHub}`,
58-
`dclenv=${dclenv}`,
59-
`skip-auth-screen=${skipAuthScreen}`,
60-
`landscape-terrain-enabled=${landscapeTerrainEnabled}`
61-
].join('&')
59+
const params = new URLSearchParams()
60+
61+
params.set('realm', realm)
62+
params.set('position', position)
63+
params.set('local-scene', localScene.toString())
64+
params.set('debug', debug.toString())
65+
params.set('hub', isHub.toString())
66+
params.set('dclenv', dclenv)
67+
params.set('skip-auth-screen', skipAuthScreen.toString())
68+
params.set('landscape-terrain-enabled', landscapeTerrainEnabled.toString())
69+
70+
if (openDeeplinkInNewInstance) {
71+
params.set('open-deeplink-in-new-instance', openDeeplinkInNewInstance.toString())
72+
}
73+
74+
const queryParams = params.toString()
6275

6376
const app = `decentraland://"${queryParams}"`
6477
await components.spawner.exec(cwd, cmd, [app], { silent: true })

packages/@dcl/sdk-commands/src/commands/start/index.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,14 @@ export const args = declareArgs({
5353
'--explorer-alpha': Boolean,
5454
'--hub': Boolean,
5555
// Params related to the explorer-alpha
56-
'--debug': Boolean,
56+
'--debug': String,
5757
'--dclenv': String,
5858
'--realm': String,
5959
'--local-scene': String,
6060
'--position': String,
61-
'--skip-auth-screen': Boolean,
62-
'--landscape-terrain-enabled': Boolean
61+
'--skip-auth-screen': String,
62+
'--landscape-terrain-enabled': String,
63+
'-n': Boolean
6364
})
6465

6566
export async function help(options: Options) {
@@ -68,21 +69,22 @@ export async function help(options: Options) {
6869
6970
Options:
7071
71-
-h, --help Displays complete help
72-
-p, --port [port] Select a custom port for the development server
73-
-d, --no-debug Disable debugging panel
74-
-b, --no-browser Do not open a new browser window
75-
-w, --no-watch Do not open watch for filesystem changes
76-
-c, --ci Run the parcel previewer on a remote unix server
77-
--web3 Connects preview to browser wallet to use the associated avatar and account
78-
--skip-build Skip build and only serve the files in preview mode
79-
--debug Enables Debug panel mode inside DCL Explorer (default=true)
80-
--dclenv Decentraland Environment. Which environment to use for the content. This determines the catalyst server used, asset-bundles, etc. Possible values: org, zone, today. (default=org)
81-
--realm Realm used to serve the content. (default=Localhost)
82-
--local-scene Enable local scene development.
83-
--position Initial Position to start the explorer. (default=position defined at scene.json)
84-
--skip-auth-screen Skip the auth screen.
85-
--landscape-terrain-enabled Enable landscape terrain.
72+
-h, --help Displays complete help
73+
-p, --port Select a custom port for the development server
74+
-d, --no-debug Disable debugging panel
75+
-b, --no-browser Do not open a new browser window
76+
-w, --no-watch Do not open watch for filesystem changes
77+
-c, --ci Run the parcel previewer on a remote unix server
78+
--web3 Connects preview to browser wallet to use the associated avatar and account
79+
--skip-build Skip build and only serve the files in preview mode
80+
--debug Enables Debug panel mode inside DCL Explorer (default=true)
81+
--dclenv Decentraland Environment. Which environment to use for the content. This determines the catalyst server used, asset-bundles, etc. Possible values: org, zone, today. (default=org)
82+
--realm Realm used to serve the content. (default=Localhost)
83+
--local-scene Enable local scene development.
84+
--position Initial Position to start the explorer. (default=position defined at scene.json)
85+
--skip-auth-screen Skip the auth screen (accepts 'true' or 'false').
86+
--landscape-terrain-enabled Enable landscape terrain.
87+
-n Open a new instance of the Client even if one is already running.
8688
8789
8890
Examples:

0 commit comments

Comments
 (0)