Skip to content

Commit

Permalink
Remove WebSocket debugger tunnel
Browse files Browse the repository at this point in the history
  • Loading branch information
arturpimentel committed Oct 25, 2023
1 parent 3cfcad4 commit 242b0c1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 174 deletions.
9 changes: 2 additions & 7 deletions src/commands/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,16 @@ export default class Link extends CustomCommand {
)} flag to switch from the current ${ColorifyConstants.ID('account')} and ${ColorifyConstants.ID('workspace')}.`,
required: false,
}),
debug: oclifFlags.boolean({
description: `Starts a debug tunnel (alpha)`,
default: false,
required: false,
}),
}

static args = []

async run() {
const {
flags,
flags: { account, setup, clean, unsafe, workspace, debug },
flags: { account, setup, clean, unsafe, workspace },
} = this.parse(Link)
const noWatch = flags['no-watch']
await appLink({ account, workspace, setup, clean, unsafe, noWatch, debug })
await appLink({ account, workspace, setup, clean, unsafe, noWatch })
}
}
132 changes: 0 additions & 132 deletions src/modules/apps/debugger.ts

This file was deleted.

36 changes: 1 addition & 35 deletions src/modules/apps/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import debounce from 'debounce'
import log from '../../api/logger'
import moment from 'moment'
import retry from 'async-retry'
import startDebuggerTunnel from './debugger'
import workspaceUse from '../../api/modules/workspace/use'
import { BatchStream } from '../../api/typings/types'
import { Messages } from '../../lib/constants/Messages'
Expand All @@ -54,7 +53,6 @@ interface LinkOptions {
clean?: boolean
setup?: boolean
noWatch?: boolean
debug?: boolean
}

const DELETE_SIGN = chalk.red('D')
Expand Down Expand Up @@ -315,36 +313,6 @@ export async function appLink(options: LinkOptions) {
initial_link_required: () => warnAndLinkFromStart(root, projectUploader, unsafe),
}

let debuggerStarted = false
const onBuild = async () => {
if (debuggerStarted) {
return
}
const startDebugger = async () => {
const port = await startDebuggerTunnel(manifest)
if (!port) {
throw new Error('Failed to start debugger.')
}
return port
}
if (options.debug && shouldStartDebugger(manifest)) {
// TODO: Add some sort of log here to know if devs are actually interested
// in this feature
try {
const debuggerPort = await retry(startDebugger, RETRY_OPTS_DEBUGGER)
// eslint-disable-next-line require-atomic-updates
debuggerStarted = true
log.info(
`Debugger tunnel listening on ${chalk.green(`:${debuggerPort}`)}. Go to ${chalk.blue(
'chrome://inspect'
)} in Google Chrome to debug your running application.`
)
} catch (e) {
log.error(e.message)
}
}
}

log.info(`Linking app ${appId}`)

let unlistenBuild
Expand All @@ -356,9 +324,7 @@ export async function appLink(options: LinkOptions) {
await listenBuild(subject, buildTrigger, { waitCompletion: true })
return
}
unlistenBuild = await listenBuild(subject, buildTrigger, { waitCompletion: false, onBuild, onError }).then(
prop('unlisten')
)
unlistenBuild = await listenBuild(subject, buildTrigger, { waitCompletion: false, onError }).then(prop('unlisten'))
} catch (e) {
if (e.response) {
const { data } = e.response
Expand Down

0 comments on commit 242b0c1

Please sign in to comment.