mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
try to fix pl;ugin directories
This commit is contained in:
parent
3ffe2090e5
commit
266d7d76de
@ -207,11 +207,20 @@ function createWindow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
global.API_PACKAGE = process.env.DEVMODE ? '../packages/api/src/index' : '../packages/api/dist/bundle.js';
|
global.API_PACKAGE = path.resolve(
|
||||||
|
process.env.DEVMODE ? '../packages/api/src/index' : './packages/api/dist/bundle.js'
|
||||||
|
);
|
||||||
|
// console.log('global.API_PACKAGE', global.API_PACKAGE);
|
||||||
const api = require(path.join(
|
const api = require(path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
process.env.DEVMODE ? '../../packages/api/src/index' : '../packages/api/dist/bundle.js'
|
process.env.DEVMODE ? '../../packages/api/src/index' : '../packages/api/dist/bundle.js'
|
||||||
));
|
));
|
||||||
|
// console.log(
|
||||||
|
// 'REQUIRED',
|
||||||
|
// path.resolve(
|
||||||
|
// path.join(__dirname, process.env.DEVMODE ? '../../packages/api/src/index' : '../packages/api/dist/bundle.js')
|
||||||
|
// )
|
||||||
|
// );
|
||||||
const main = api.getMainModule();
|
const main = api.getMainModule();
|
||||||
main.initializeElectronSender(mainWindow.webContents);
|
main.initializeElectronSender(mainWindow.webContents);
|
||||||
main.useAllControllers(null, electron);
|
main.useAllControllers(null, electron);
|
||||||
|
@ -137,6 +137,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
test(req, res) {
|
test(req, res) {
|
||||||
const subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
const subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
||||||
|
'--is-forked-api',
|
||||||
'--start-process',
|
'--start-process',
|
||||||
'connectProcess',
|
'connectProcess',
|
||||||
...process.argv.slice(3),
|
...process.argv.slice(3),
|
||||||
|
@ -75,6 +75,7 @@ module.exports = {
|
|||||||
if (existing) return existing;
|
if (existing) return existing;
|
||||||
const connection = await connections.get({ conid });
|
const connection = await connections.get({ conid });
|
||||||
const subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
const subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
||||||
|
'--is-forked-api',
|
||||||
'--start-process',
|
'--start-process',
|
||||||
'databaseConnectionProcess',
|
'databaseConnectionProcess',
|
||||||
...process.argv.slice(3),
|
...process.argv.slice(3),
|
||||||
|
@ -38,6 +38,7 @@ module.exports = {
|
|||||||
if (existing) return existing;
|
if (existing) return existing;
|
||||||
const connection = await connections.get({ conid });
|
const connection = await connections.get({ conid });
|
||||||
const subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
const subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
||||||
|
'--is-forked-api',
|
||||||
'--start-process',
|
'--start-process',
|
||||||
'serverConnectionProcess',
|
'serverConnectionProcess',
|
||||||
...process.argv.slice(3),
|
...process.argv.slice(3),
|
||||||
|
@ -66,6 +66,7 @@ module.exports = {
|
|||||||
const sesid = uuidv1();
|
const sesid = uuidv1();
|
||||||
const connection = await connections.get({ conid });
|
const connection = await connections.get({ conid });
|
||||||
const subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
const subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
||||||
|
'--is-forked-api',
|
||||||
'--start-process',
|
'--start-process',
|
||||||
'sessionProcess',
|
'sessionProcess',
|
||||||
...process.argv.slice(3),
|
...process.argv.slice(3),
|
||||||
|
@ -30,6 +30,7 @@ class DatastoreProxy {
|
|||||||
async ensureSubprocess() {
|
async ensureSubprocess() {
|
||||||
if (!this.subprocess) {
|
if (!this.subprocess) {
|
||||||
this.subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
this.subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
||||||
|
'--is-forked-api',
|
||||||
'--start-process',
|
'--start-process',
|
||||||
'jslDatastoreProcess',
|
'jslDatastoreProcess',
|
||||||
...process.argv.slice(3),
|
...process.argv.slice(3),
|
||||||
|
@ -41,6 +41,10 @@ const archivedir = dirFunc('archive');
|
|||||||
const filesdir = dirFunc('files');
|
const filesdir = dirFunc('files');
|
||||||
|
|
||||||
function packagedPluginsDir() {
|
function packagedPluginsDir() {
|
||||||
|
// console.log('CALL DIR FROM', new Error('xxx').stack);
|
||||||
|
// console.log('__dirname', __dirname);
|
||||||
|
// console.log('platformInfo.isElectronBundle', platformInfo.isElectronBundle);
|
||||||
|
// console.log('platformInfo.isForkedApi', platformInfo.isForkedApi);
|
||||||
if (platformInfo.isDevMode) {
|
if (platformInfo.isDevMode) {
|
||||||
return path.resolve(__dirname, '../../../../plugins');
|
return path.resolve(__dirname, '../../../../plugins');
|
||||||
}
|
}
|
||||||
@ -53,6 +57,12 @@ function packagedPluginsDir() {
|
|||||||
}
|
}
|
||||||
if (platformInfo.isElectronBundle) {
|
if (platformInfo.isElectronBundle) {
|
||||||
return path.resolve(__dirname, '../../plugins');
|
return path.resolve(__dirname, '../../plugins');
|
||||||
|
|
||||||
|
// if (platformInfo.isForkedApi) {
|
||||||
|
// return path.resolve(__dirname, '../plugins');
|
||||||
|
// } else {
|
||||||
|
// return path.resolve(__dirname, '../../plugins');
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ const isLinux = platform === 'linux';
|
|||||||
const isDocker = fs.existsSync('/home/dbgate-docker/public');
|
const isDocker = fs.existsSync('/home/dbgate-docker/public');
|
||||||
const isDevMode = process.env.DEVMODE == '1';
|
const isDevMode = process.env.DEVMODE == '1';
|
||||||
const isNpmDist = !!global['dbgateApiModulePath'];
|
const isNpmDist = !!global['dbgateApiModulePath'];
|
||||||
|
const isForkedApi = processArgs.isForkedApi;
|
||||||
|
|
||||||
// function moduleAvailable(name) {
|
// function moduleAvailable(name) {
|
||||||
// try {
|
// try {
|
||||||
@ -21,14 +22,13 @@ const isNpmDist = !!global['dbgateApiModulePath'];
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
const isElectronBundle = processArgs.isElectronBundle;
|
|
||||||
|
|
||||||
const platformInfo = {
|
const platformInfo = {
|
||||||
isWindows,
|
isWindows,
|
||||||
isMac,
|
isMac,
|
||||||
isLinux,
|
isLinux,
|
||||||
isDocker,
|
isDocker,
|
||||||
isElectronBundle,
|
isElectronBundle: isElectron() && !isDevMode,
|
||||||
|
isForkedApi,
|
||||||
isElectron: isElectron(),
|
isElectron: isElectron(),
|
||||||
isDevMode,
|
isDevMode,
|
||||||
isNpmDist,
|
isNpmDist,
|
||||||
|
@ -7,15 +7,13 @@ function getNamedArg(name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const checkParent = process.argv.includes('--checkParent');
|
const checkParent = process.argv.includes('--checkParent');
|
||||||
const dynport = process.argv.includes('--dynport');
|
|
||||||
const nativeModules = getNamedArg('--native-modules');
|
const nativeModules = getNamedArg('--native-modules');
|
||||||
const startProcess = getNamedArg('--start-process');
|
const startProcess = getNamedArg('--start-process');
|
||||||
const isElectronBundle = process.argv.includes('--is-electron-bundle');
|
const isForkedApi = process.argv.includes('--is-forked-api');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
checkParent,
|
checkParent,
|
||||||
nativeModules,
|
nativeModules,
|
||||||
startProcess,
|
startProcess,
|
||||||
dynport,
|
isForkedApi,
|
||||||
isElectronBundle,
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user