Skip to content

Fix: TypeError when using --inject with comma-separated file paths #927

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
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
7 changes: 6 additions & 1 deletion bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ program
.option('--fullscreen', 'Start in full screen', DEFAULT.fullscreen)
.option('--hide-title-bar', 'For Mac, hide title bar', DEFAULT.hideTitleBar)
.option('--multi-arch', 'For Mac, both Intel and M1', DEFAULT.multiArch)
.option('--inject <url...>', 'Injection of .js or .css files', DEFAULT.inject)
.option(
'--inject <./style.css,./script.js,...>',
'Injection of .js or .css files',
(val, previous) => (val ? val.split(',').map(item => item.trim()) : DEFAULT.inject),
DEFAULT.inject,
)
.option('--debug', 'Debug build and more output', DEFAULT.debug)
.addOption(new Option('--proxy-url <url>', 'Proxy URL for all network requests').default(DEFAULT_PAKE_OPTIONS.proxyUrl).hideHelp())
.addOption(new Option('--user-agent <string>', 'Custom user agent').default(DEFAULT.userAgent).hideHelp())
Expand Down
3 changes: 1 addition & 2 deletions dist/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,6 @@ const DEFAULT_PAKE_OPTIONS = {
height: 780,
width: 1200,
fullscreen: false,
resizable: true,
hideTitleBar: false,
alwaysOnTop: false,
appVersion: '1.0.0',
Expand Down Expand Up @@ -977,7 +976,7 @@ program
.option('--fullscreen', 'Start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
.option('--hide-title-bar', 'For Mac, hide title bar', DEFAULT_PAKE_OPTIONS.hideTitleBar)
.option('--multi-arch', 'For Mac, both Intel and M1', DEFAULT_PAKE_OPTIONS.multiArch)
.option('--inject <url>', 'Injection of .js or .css files', DEFAULT_PAKE_OPTIONS.inject)
.option('--inject <./style.css,./script.js,...>', 'Injection of .js or .css files', (val, previous) => (val ? val.split(',').map(item => item.trim()) : DEFAULT_PAKE_OPTIONS.inject), DEFAULT_PAKE_OPTIONS.inject)
.option('--debug', 'Debug build and more output', DEFAULT_PAKE_OPTIONS.debug)
.addOption(new Option('--proxy-url <url>', 'Proxy URL for all network requests').default(DEFAULT_PAKE_OPTIONS.proxyUrl).hideHelp())
.addOption(new Option('--user-agent <string>', 'Custom user agent').default(DEFAULT_PAKE_OPTIONS.userAgent).hideHelp())
Expand Down