Skip to content
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

Make chrome debugger be opt-in instead of default #1190

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- Update `recommendedEdition` in `edition.ts to `edition-store@5.x`
- Make Chrome debugger an opt-in instead of a default open port.

## [3.0.0] - 2021-10-20

Expand Down
6 changes: 5 additions & 1 deletion src/api/modules/workspace/common/edition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ const promptSwitchEdition = (currEditionId: string) => {
recommendedEdition
)}.`
)
log.warn(`For more information about editions, check ${chalk.blue('https://developers.vtex.com/vtex-developer-docs/docs/vtex-io-documentation-edition-app')}`)
log.warn(
`For more information about editions, check ${chalk.blue(
'https://developers.vtex.com/vtex-developer-docs/docs/vtex-io-documentation-edition-app'
)}`
)
return promptConfirm(`Would you like to change the edition to ${chalk.blue(recommendedEdition)} now?`, false)
}

Expand Down
11 changes: 7 additions & 4 deletions src/commands/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export default class Link extends CustomCommand {
description: 'Allows linking the app despite Typescript errors.',
default: false,
}),
'with-debugger': oclifFlags.boolean({
char: 'd',
description: 'Start the chrome debugger tunnel after the app is linked.',
default: false,
}),
workspace: oclifFlags.string({
char: 'w',
description: `Starts a development session in the specified ${ColorifyConstants.ID(
Expand All @@ -54,10 +59,8 @@ export default class Link extends CustomCommand {

async run() {
const {
flags,
flags: { account, setup, clean, unsafe, workspace },
flags: { account, setup, clean, unsafe, workspace, 'no-watch': noWatch, 'with-debugger': withDebugger },
} = this.parse(Link)
const noWatch = flags['no-watch']
await appLink({ account, workspace, setup, clean, unsafe, noWatch })
await appLink({ account, workspace, setup, clean, unsafe, noWatch, withDebugger })
}
}
5 changes: 5 additions & 0 deletions src/modules/apps/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ interface LinkOptions {
clean?: boolean
setup?: boolean
noWatch?: boolean
withDebugger?: boolean
}

const DELETE_SIGN = chalk.red('D')
Expand Down Expand Up @@ -319,6 +320,10 @@ export async function appLink(options: LinkOptions) {
if (debuggerStarted) {
return
}
if (!options.withDebugger) {
log.info('Debugger flag not set. To open a chrome debugger server, link your app using the --with-debugger flag.')
return
}
const startDebugger = async () => {
const port = await startDebuggerTunnel(manifest)
if (!port) {
Expand Down