mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-22 06:00:07 +03:00
Updates
This commit is contained in:
parent
6aebbd1927
commit
61cf775d19
|
@ -1,3 +1,3 @@
|
|||
#! /usr/bin/env node
|
||||
|
||||
require('../dist/bin/redux-devtools.js');
|
||||
import '../dist/bin/redux-devtools.js';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
export default {
|
||||
preset: 'ts-jest',
|
||||
transform: {
|
||||
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }],
|
||||
|
|
|
@ -38,19 +38,19 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.15.0"
|
||||
"node": "^16.14.0 || >= 18.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/server": "^4.3.0",
|
||||
"@redux-devtools/app": "^2.1.3",
|
||||
"@types/react": "^18.0.26",
|
||||
"body-parser": "^1.20.1",
|
||||
"chalk": "^4.1.2",
|
||||
"chalk": "^5.2.0",
|
||||
"cors": "^2.8.5",
|
||||
"cross-spawn": "^7.0.3",
|
||||
"electron": "^22.0.0",
|
||||
"express": "^4.18.2",
|
||||
"get-port": "^5.1.1",
|
||||
"get-port": "^6.1.2",
|
||||
"graphql": "^16.6.0",
|
||||
"knex": "^2.3.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import fs from 'fs';
|
||||
import type { Store } from '../store.js';
|
||||
|
||||
export const schema = fs
|
||||
.readFileSync(require.resolve('./schema_def.graphql'))
|
||||
.toString();
|
||||
export const schema = fs.readFileSync(
|
||||
new URL('./schema_def.graphql', import.meta.url),
|
||||
'utf8'
|
||||
);
|
||||
|
||||
export const resolvers = {
|
||||
Query: {
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
import open from 'open';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { createRequire } from 'module';
|
||||
import spawn from 'cross-spawn';
|
||||
import type { Options } from '../options.js';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
export default async function openApp(app: true | string, options: Options) {
|
||||
if (app === true || app === 'electron') {
|
||||
try {
|
||||
const port = options.port ? `--port=${options.port}` : '';
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
spawn.sync(require('electron') as string, [
|
||||
path.join(__dirname, '..', '..', 'app'),
|
||||
path.join(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
'..',
|
||||
'..',
|
||||
'app'
|
||||
),
|
||||
port,
|
||||
]);
|
||||
} catch (error) {
|
||||
|
|
|
@ -1,17 +1,30 @@
|
|||
import path from 'path';
|
||||
import { Knex, knex } from 'knex';
|
||||
import { fileURLToPath } from 'url';
|
||||
import knex from 'knex';
|
||||
import type { Knex } from 'knex';
|
||||
import { AGServer } from 'socketcluster-server';
|
||||
|
||||
type KnexFunction = <TRecord extends {} = any, TResult = unknown[]>(
|
||||
config: Knex.Config | string
|
||||
) => Knex<TRecord, TResult>;
|
||||
|
||||
export default function connector(options: AGServer.AGServerOptions) {
|
||||
const dbOptions = options.dbOptions as Knex.Config;
|
||||
dbOptions.useNullAsDefault = true;
|
||||
if (!(dbOptions as any).migrate) {
|
||||
return knex(dbOptions);
|
||||
return (knex as unknown as KnexFunction)(dbOptions);
|
||||
}
|
||||
|
||||
dbOptions.migrations = { directory: path.resolve(__dirname, 'migrations') };
|
||||
dbOptions.seeds = { directory: path.resolve(__dirname, 'seeds') };
|
||||
const knexInstance = knex(dbOptions);
|
||||
dbOptions.migrations = {
|
||||
directory: path.join(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
'migrations'
|
||||
),
|
||||
};
|
||||
dbOptions.seeds = {
|
||||
directory: path.join(path.dirname(fileURLToPath(import.meta.url)), 'seeds'),
|
||||
};
|
||||
const knexInstance = (knex as unknown as KnexFunction)(dbOptions);
|
||||
|
||||
/* eslint-disable no-console */
|
||||
knexInstance.migrate
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
interface ProtocolOptions {
|
||||
key: string | undefined;
|
||||
|
@ -31,9 +31,14 @@ export interface Options {
|
|||
export default function getOptions(argv: { [arg: string]: any }): Options {
|
||||
let dbOptions = argv.dbOptions;
|
||||
if (typeof dbOptions === 'string') {
|
||||
dbOptions = require(path.resolve(process.cwd(), argv.dbOptions as string));
|
||||
dbOptions = JSON.parse(fs.readFileSync(argv.dbOptions, 'utf8'));
|
||||
} else if (typeof dbOptions === 'undefined') {
|
||||
dbOptions = require('../defaultDbOptions.json');
|
||||
dbOptions = JSON.parse(
|
||||
fs.readFileSync(
|
||||
new URL('../defaultDbOptions.json', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import path from 'path';
|
||||
import { createRequire } from 'module';
|
||||
import { fileURLToPath } from 'url';
|
||||
import express from 'express';
|
||||
import type { Router } from 'express';
|
||||
import morgan from 'morgan';
|
||||
|
@ -13,6 +15,8 @@ import { resolvers, schema } from './api/schema.js';
|
|||
|
||||
const app = express.Router();
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
function serveUmdModule(name: string) {
|
||||
app.use(
|
||||
express.static(
|
||||
|
@ -74,7 +78,12 @@ function routes(
|
|||
res.send(`reduxDevToolsPort = ${options.port}`);
|
||||
});
|
||||
app.get('*', function (req, res) {
|
||||
res.sendFile(path.join(__dirname, '../app/index.html'));
|
||||
res.sendFile(
|
||||
path.join(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
'../app/index.html'
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
app.use(cors({ methods: 'POST' }));
|
||||
|
|
|
@ -943,7 +943,7 @@ importers:
|
|||
'@typescript-eslint/eslint-plugin': ^5.47.0
|
||||
'@typescript-eslint/parser': ^5.47.0
|
||||
body-parser: ^1.20.1
|
||||
chalk: ^4.1.2
|
||||
chalk: ^5.2.0
|
||||
cors: ^2.8.5
|
||||
cross-spawn: ^7.0.3
|
||||
electron: ^22.0.0
|
||||
|
@ -951,7 +951,7 @@ importers:
|
|||
eslint-config-prettier: ^8.5.0
|
||||
eslint-plugin-jest: ^27.1.7
|
||||
express: ^4.18.2
|
||||
get-port: ^5.1.1
|
||||
get-port: ^6.1.2
|
||||
graphql: ^16.6.0
|
||||
jest: ^29.3.1
|
||||
knex: ^2.3.0
|
||||
|
@ -978,12 +978,12 @@ importers:
|
|||
'@redux-devtools/app': link:../redux-devtools-app
|
||||
'@types/react': 18.0.26
|
||||
body-parser: 1.20.1
|
||||
chalk: 4.1.2
|
||||
chalk: 5.2.0
|
||||
cors: 2.8.5
|
||||
cross-spawn: 7.0.3
|
||||
electron: 22.0.0
|
||||
express: 4.18.2
|
||||
get-port: 5.1.1
|
||||
get-port: 6.1.2
|
||||
graphql: 16.6.0
|
||||
knex: 2.3.0_sqlite3@5.1.4
|
||||
lodash-es: 4.17.21
|
||||
|
@ -10862,6 +10862,11 @@ packages:
|
|||
ansi-styles: 4.3.0
|
||||
supports-color: 7.2.0
|
||||
|
||||
/chalk/5.2.0:
|
||||
resolution: {integrity: sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==}
|
||||
engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
|
||||
dev: false
|
||||
|
||||
/char-regex/1.0.2:
|
||||
resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==}
|
||||
engines: {node: '>=10'}
|
||||
|
@ -13898,9 +13903,9 @@ packages:
|
|||
resolution: {integrity: sha512-41eOxtlGgHQRbFyA8KTH+w+32Em3cRdfBud7j67ulzmIfmaHX9doq47s0fa4P5o9H64BZX9nrYI6sJvk46Op+Q==}
|
||||
dev: false
|
||||
|
||||
/get-port/5.1.1:
|
||||
resolution: {integrity: sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==}
|
||||
engines: {node: '>=8'}
|
||||
/get-port/6.1.2:
|
||||
resolution: {integrity: sha512-BrGGraKm2uPqurfGVj/z97/zv8dPleC6x9JBNRTrDNtCkkRF4rPwrQXFgL7+I+q8QSdU4ntLQX2D7KIxSy8nGw==}
|
||||
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
||||
dev: false
|
||||
|
||||
/get-stdin/4.0.1:
|
||||
|
@ -14750,7 +14755,7 @@ packages:
|
|||
engines: {node: '>=12.0.0'}
|
||||
dependencies:
|
||||
ansi-escapes: 4.3.2
|
||||
chalk: 4.1.1
|
||||
chalk: 4.1.2
|
||||
cli-cursor: 3.1.0
|
||||
cli-width: 3.0.0
|
||||
external-editor: 3.1.0
|
||||
|
@ -17921,7 +17926,7 @@ packages:
|
|||
engines: {node: '>=10'}
|
||||
dependencies:
|
||||
bl: 4.1.0
|
||||
chalk: 4.1.1
|
||||
chalk: 4.1.2
|
||||
cli-cursor: 3.1.0
|
||||
cli-spinners: 2.7.0
|
||||
is-interactive: 1.0.0
|
||||
|
|
Loading…
Reference in New Issue
Block a user