mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-10 19:56:54 +03:00
Adjusts @redux-devtools/cli --open
flag to respect protocol and host (#1217)
* Adjusts the location open uses Currently when using open, the cli will ignore the host and protocol and always open `http://localhost`. This pr adjusts the open script to use the options protocol and host and default back to localhost if not provided. * adds changeset * fixes grammar * adjusts electron path to respect protocol and host as well Co-authored-by: Nathan Bierema <nbierema@gmail.com>
This commit is contained in:
parent
69833d35b2
commit
a7729dae87
5
.changeset/long-doors-shout.md
Normal file
5
.changeset/long-doors-shout.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@redux-devtools/cli': patch
|
||||
---
|
||||
|
||||
Updates `--open` flag to respect protocol and host when provided
|
|
@ -9,7 +9,11 @@ function createWindow() {
|
|||
height: 600,
|
||||
});
|
||||
|
||||
mainWindow.loadURL('http://localhost:' + (argv.port ? argv.port : 8000));
|
||||
const port = argv.port ? argv.port : 8000;
|
||||
const host = argv.host ? argv.host : 'localhost';
|
||||
const protocol = argv.protocol ? argv.protocol : 'http';
|
||||
|
||||
mainWindow.loadURL(protocol + '://' + host + ':' + port);
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
|
|
|
@ -11,6 +11,9 @@ export default async function openApp(app: true | string, options: Options) {
|
|||
if (app === true || app === 'electron') {
|
||||
try {
|
||||
const port = options.port ? `--port=${options.port}` : '';
|
||||
const host = options.host ? `--host=${options.host}` : '';
|
||||
const protocol = options.protocol ? `--protocol=${options.protocol}` : '';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
spawn(require('electron') as string, [
|
||||
path.join(
|
||||
|
@ -20,6 +23,8 @@ export default async function openApp(app: true | string, options: Options) {
|
|||
'app'
|
||||
),
|
||||
port,
|
||||
host,
|
||||
protocol,
|
||||
]);
|
||||
} catch (error) {
|
||||
/* eslint-disable no-console */
|
||||
|
@ -42,7 +47,7 @@ export default async function openApp(app: true | string, options: Options) {
|
|||
}
|
||||
|
||||
await open(
|
||||
`http://localhost:${options.port}/`,
|
||||
`${options.protocol}://${options.host ?? 'localhost'}:${options.port}/`,
|
||||
app !== 'browser' ? { app: { name: app } } : undefined
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user