-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
open explorer alpha on start #976
Merged
Merged
Changes from 3 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
26bf9cd
open explorer alpha on start
gonpombo8 c8d333a
add explorer alpha flag
gonpombo8 0ec53a2
remove unused code
gonpombo8 6330588
add protobuf messages
gonpombo8 14a0862
fix bui;d
gonpombo8 e10c836
update protocl
gonpombo8 8216cac
update main
gonpombo8 8651961
ignore path for now
gonpombo8 751dc05
better logs
gonpombo8 8f5bfaf
send protobf only for e@ preview
gonpombo8 c6b56d5
remove explorer alpha path because the params doesnt work
gonpombo8 6ba2be9
add local scene param
gonpombo8 a2f9f95
fix build
gonpombo8 80018a8
Merge branch 'main' into feat/e@-preview
gonpombo8 97ac98c
check always for file
gonpombo8 ee00da5
Merge branch 'main' into feat/e@-preview
gonpombo8 1dbb80e
Merge branch 'main' into feat/e@-preview
gonpombo8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
packages/@dcl/sdk-commands/src/commands/start/explorer-alpha.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import prompts from 'prompts' | ||
import { CliComponents } from '../../components' | ||
import { writeGlobalConfig } from '../../components/config' | ||
|
||
const isWindows = /^win/.test(process.platform) | ||
|
||
export async function runExplorerAlpha(components: CliComponents, cwd: string, realm: string) { | ||
if (await runApp(components, { cwd, realm })) { | ||
return | ||
} | ||
const path = await getExplorerAlphaPath(components) | ||
if (path && (await runApp(components, { cwd, realm, path }))) { | ||
return | ||
} | ||
components.logger.log('\n') | ||
components.logger.warn('DECENTRALAND APP NOT FOUND. ') | ||
components.logger.warn('Please download & install it: https://dcl.gg/explorer\n\n') | ||
} | ||
|
||
async function runApp(components: CliComponents, { cwd, realm, path }: { cwd: string; realm: string; path?: string }) { | ||
const cmd = isWindows ? 'start' : 'open' | ||
try { | ||
await components.spawner.exec(cwd, cmd, [path ?? `decentraland://realm=${realm}`], { silent: true }) | ||
if (path) { | ||
await writeGlobalConfig(components, 'EXPLORER_ALPHA_PATH', path) | ||
} | ||
return true | ||
} catch (e: any) { | ||
// components.logger.error('failed', e.message) | ||
return false | ||
} | ||
} | ||
|
||
export async function getExplorerAlphaPath(components: CliComponents): Promise<string | undefined> { | ||
const path = await components.config.getString('EXPLORER_ALPHA_PATH') | ||
if (path) return path | ||
try { | ||
const answer = await prompts( | ||
{ | ||
type: 'text', | ||
name: 'path', | ||
message: 'Please provide the Directory where the Explorer Client is installed. i.e. /Applications/', | ||
validate: (description) => description.length >= 5 | ||
}, | ||
{ | ||
onCancel: () => { | ||
throw new Error('Please provide a path') | ||
} | ||
} | ||
) | ||
let path: string = answer.path | ||
if (isWindows) { | ||
path += '/Explorer.exe' | ||
} else { | ||
if (!path.includes('Decentraland.app')) { | ||
path = path + '/Decentraland.app' | ||
} | ||
const MAC_PATH = '/Contents/MacOS/Explorer' | ||
if (!path.includes(MAC_PATH)) { | ||
path = path + MAC_PATH | ||
} | ||
return path.replace(/\/\//, '/') | ||
} | ||
return path | ||
} catch (e: any) { | ||
return undefined | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* eslint-disable no-console */ | ||
import type { spawn } from 'child_process' | ||
|
||
interface Options { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: link to the new launcher