mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-25 19:13:56 +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,
|
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(() => {
|
app.whenReady().then(() => {
|
||||||
|
|
|
@ -11,6 +11,9 @@ export default async function openApp(app: true | string, options: Options) {
|
||||||
if (app === true || app === 'electron') {
|
if (app === true || app === 'electron') {
|
||||||
try {
|
try {
|
||||||
const port = options.port ? `--port=${options.port}` : '';
|
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
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
spawn(require('electron') as string, [
|
spawn(require('electron') as string, [
|
||||||
path.join(
|
path.join(
|
||||||
|
@ -20,6 +23,8 @@ export default async function openApp(app: true | string, options: Options) {
|
||||||
'app'
|
'app'
|
||||||
),
|
),
|
||||||
port,
|
port,
|
||||||
|
host,
|
||||||
|
protocol,
|
||||||
]);
|
]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
|
@ -42,7 +47,7 @@ export default async function openApp(app: true | string, options: Options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
await open(
|
await open(
|
||||||
`http://localhost:${options.port}/`,
|
`${options.protocol}://${options.host ?? 'localhost'}:${options.port}/`,
|
||||||
app !== 'browser' ? { app: { name: app } } : undefined
|
app !== 'browser' ? { app: { name: app } } : undefined
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user