Skip to content
Merged
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: 4 additions & 3 deletions packages/redux-devtools-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,18 @@
},
"dependencies": {
"@apollo/server": "^4.12.1",
"@as-integrations/express5": "^1.1.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@redux-devtools/app": "workspace:^",
"@reduxjs/toolkit": "^2.8.2",
"@types/react": "^19.1.6",
"body-parser": "^1.20.3",
"body-parser": "^2.2.0",
"chalk": "^5.4.1",
"cors": "^2.8.5",
"cross-spawn": "^7.0.6",
"electron": "^31.7.7",
"express": "^4.21.2",
"express": "^5.1.0",
"get-port": "^7.1.0",
"graphql": "^16.11.0",
"knex": "^3.1.0",
Expand All @@ -72,7 +73,7 @@
"@types/body-parser": "^1.19.5",
"@types/cors": "^2.8.18",
"@types/cross-spawn": "^6.0.6",
"@types/express": "^4.17.22",
"@types/express": "^5.0.3",
"@types/jest": "^29.5.14",
"@types/lodash-es": "^4.17.12",
"@types/minimist": "^1.2.5",
Expand Down
6 changes: 3 additions & 3 deletions packages/redux-devtools-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default async function (argv: { [arg: string]: any }): Promise<{
const agServer = socketClusterServer.attach(httpServer, options);

const app = express();
// eslint-disable-next-line @typescript-eslint/no-misused-promises
httpServer.on('request', app);
const store = createStore(options);
app.use(routes(options, store, agServer));
Expand Down Expand Up @@ -76,7 +77,7 @@ export default async function (argv: { [arg: string]: any }): Promise<{
});
})
.catch(function (error) {
console.error(error); // eslint-disable-line no-console
console.error(error);
});
}
}
Expand Down Expand Up @@ -110,15 +111,14 @@ export default async function (argv: { [arg: string]: any }): Promise<{
request.end(data);
})
.catch(function (error) {
console.error(error); // eslint-disable-line no-console
console.error(error);
});
}
})();
void (async () => {
for await (const data of socket.listener('disconnect')) {
const channel = agServer.exchange.channel('sc-' + socket.id);
channel.unsubscribe();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
void agServer.exchange.transmitPublish(channelToEmit!, {
id: socket.id,
type: 'DISCONNECTED',
Expand Down
17 changes: 10 additions & 7 deletions packages/redux-devtools-cli/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,24 @@ function routes(
'/graphql',
cors<cors.CorsRequest>(),
bodyParser.json(),
// @ts-expect-error https://github.com/apollo-server-integrations/apollo-server-integration-express5/issues/9
expressMiddleware(server, {
context: () => Promise.resolve({ store }),
}),
);
})
.catch((error) => {
console.error(error); // eslint-disable-line no-console
console.error(error);
});

serveUmdModule('react');
serveUmdModule('react-dom');
serveUmdModule('@redux-devtools/app');

app.get('/port.js', function (req, res) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
res.send(`reduxDevToolsPort = ${options.port}`);
});
app.get('*', function (req, res) {
app.get('/{*splat}', function (req, res) {
res.sendFile(
path.join(
path.dirname(fileURLToPath(import.meta.url)),
Expand All @@ -93,7 +93,10 @@ function routes(
app.use(bodyParser.urlencoded({ limit: limit, extended: false }));

app.post('/', function (req, res) {
if (!req.body) return res.status(404).end();
if (!req.body) {
res.status(404).end();
return;
}
switch (req.body.op) {
case 'get':
store
Expand All @@ -102,7 +105,7 @@ function routes(
res.send(r || {});
})
.catch(function (error) {
console.error(error); // eslint-disable-line no-console
console.error(error);
res.sendStatus(500);
});
break;
Expand All @@ -113,7 +116,7 @@ function routes(
res.send(r);
})
.catch(function (error) {
console.error(error); // eslint-disable-line no-console
console.error(error);
res.sendStatus(500);
});
break;
Expand All @@ -131,7 +134,7 @@ function routes(
});
})
.catch(function (error) {
console.error(error); // eslint-disable-line no-console
console.error(error);
res.status(500).send({});
});
}
Expand Down
Loading