fixed npm dist subprocess problem

This commit is contained in:
Jan Prochazka 2022-03-24 09:00:51 +01:00
parent a3bc1e577a
commit 4c411b048d
7 changed files with 18 additions and 15 deletions

View File

@ -3,8 +3,9 @@
version: "3"
services:
dbgate:
build: docker
# build: docker
# image: dbgate/dbgate:beta-alpine
image: dbgate/dbgate:alpine
# image: dbgate/dbgate:beta
restart: always
ports:
@ -15,8 +16,8 @@ services:
volumes:
- dbgate-data:/root/dbgate-data
environment:
WEB_ROOT: /dbgate
# environment:
# WEB_ROOT: /dbgate
# CONNECTIONS: mssql
# LABEL_mssql: MS Sql
@ -25,11 +26,11 @@ services:
# PORT_mssql: 1433
# PASSWORD_mssql: Pwd2020Db
# ENGINE_mssql: mssql@dbgate-plugin-mssql
proxy:
# image: nginx
build: test/nginx
ports:
- 8082:80
# proxy:
# # image: nginx
# build: test/nginx
# ports:
# - 8082:80
# volumes:
# - /home/jena/test/chinook:/mnt/sqt

View File

@ -47,7 +47,8 @@
"ts:api": "yarn workspace dbgate-api ts",
"ts:web": "yarn workspace dbgate-web ts",
"ts": "yarn ts:api && yarn ts:web",
"postinstall": "yarn resetPackagedPlugins && yarn build:lib && patch-package && yarn fillNativeModules && yarn build:plugins:frontend"
"postinstall": "yarn resetPackagedPlugins && yarn build:lib && patch-package && yarn fillNativeModules && yarn build:plugins:frontend",
"dbgate-serve": "node packages/dbgate/bin/dbgate-serve.js"
},
"dependencies": {
"concurrently": "^5.1.0",

View File

@ -111,7 +111,7 @@ module.exports = {
stdio: ['ignore', 'pipe', 'pipe', 'ipc'],
env: {
...process.env,
DBGATE_API: global['API_PACKAGE'] || global['dbgateApiModulePath'] || process.argv[1],
DBGATE_API: global['API_PACKAGE'] || process.argv[1],
..._.fromPairs(pluginNames.map(name => [`PLUGIN_${_.camelCase(name)}`, getPluginBackendPath(name)])),
},
}

View File

@ -8,7 +8,7 @@ if (processArgs.startProcess) {
const proc = require('./proc');
const module = proc[processArgs.startProcess];
module.start();
} else if (!processArgs.checkParent && !global['API_PACKAGE'] && !global['dbgateApiModulePath']) {
} else if (!processArgs.checkParent && !global['API_PACKAGE']) {
const main = require('./main');
main.start();

View File

@ -54,7 +54,7 @@ function packagedPluginsDir() {
}
if (platformInfo.isNpmDist) {
// node_modules
return global['dbgateApiPackagedPluginsPath'];
return global['PLUGINS_DIR'];
}
if (platformInfo.isElectronBundle) {
return path.resolve(__dirname, '../../plugins');

View File

@ -10,7 +10,7 @@ const isMac = platform === 'darwin';
const isLinux = platform === 'linux';
const isDocker = fs.existsSync('/home/dbgate-docker/public');
const isDevMode = process.env.DEVMODE == '1';
const isNpmDist = !!global['dbgateApiModulePath'];
const isNpmDist = !!global['IS_NPM_DIST'];
const isForkedApi = processArgs.isForkedApi;
// function moduleAvailable(name) {

View File

@ -3,8 +3,9 @@
const path = require('path');
require('dotenv').config();
global.dbgateApiModulePath = path.dirname(path.dirname(require.resolve('dbgate-api')));
global.dbgateApiPackagedPluginsPath = path.dirname(global.dbgateApiModulePath);
global.API_PACKAGE = path.dirname(path.dirname(require.resolve('dbgate-api')));
global.PLUGINS_DIR = path.dirname(global.API_PACKAGE);
global.IS_NPM_DIST = true;
const dbgateApi = require('dbgate-api');