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(
|
||||
__dirname,
|
||||
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();
|
||||
main.initializeElectronSender(mainWindow.webContents);
|
||||
main.useAllControllers(null, electron);
|
||||
|
@ -137,6 +137,7 @@ module.exports = {
|
||||
},
|
||||
test(req, res) {
|
||||
const subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
||||
'--is-forked-api',
|
||||
'--start-process',
|
||||
'connectProcess',
|
||||
...process.argv.slice(3),
|
||||
|
@ -75,6 +75,7 @@ module.exports = {
|
||||
if (existing) return existing;
|
||||
const connection = await connections.get({ conid });
|
||||
const subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
||||
'--is-forked-api',
|
||||
'--start-process',
|
||||
'databaseConnectionProcess',
|
||||
...process.argv.slice(3),
|
||||
|
@ -38,6 +38,7 @@ module.exports = {
|
||||
if (existing) return existing;
|
||||
const connection = await connections.get({ conid });
|
||||
const subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
||||
'--is-forked-api',
|
||||
'--start-process',
|
||||
'serverConnectionProcess',
|
||||
...process.argv.slice(3),
|
||||
|
@ -66,6 +66,7 @@ module.exports = {
|
||||
const sesid = uuidv1();
|
||||
const connection = await connections.get({ conid });
|
||||
const subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
||||
'--is-forked-api',
|
||||
'--start-process',
|
||||
'sessionProcess',
|
||||
...process.argv.slice(3),
|
||||
|
@ -30,6 +30,7 @@ class DatastoreProxy {
|
||||
async ensureSubprocess() {
|
||||
if (!this.subprocess) {
|
||||
this.subprocess = fork(global['API_PACKAGE'] || process.argv[1], [
|
||||
'--is-forked-api',
|
||||
'--start-process',
|
||||
'jslDatastoreProcess',
|
||||
...process.argv.slice(3),
|
||||
|
@ -41,6 +41,10 @@ const archivedir = dirFunc('archive');
|
||||
const filesdir = dirFunc('files');
|
||||
|
||||
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) {
|
||||
return path.resolve(__dirname, '../../../../plugins');
|
||||
}
|
||||
@ -53,6 +57,12 @@ function packagedPluginsDir() {
|
||||
}
|
||||
if (platformInfo.isElectronBundle) {
|
||||
return path.resolve(__dirname, '../../plugins');
|
||||
|
||||
// if (platformInfo.isForkedApi) {
|
||||
// return path.resolve(__dirname, '../plugins');
|
||||
// } else {
|
||||
// return path.resolve(__dirname, '../../plugins');
|
||||
// }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ const isLinux = platform === 'linux';
|
||||
const isDocker = fs.existsSync('/home/dbgate-docker/public');
|
||||
const isDevMode = process.env.DEVMODE == '1';
|
||||
const isNpmDist = !!global['dbgateApiModulePath'];
|
||||
const isForkedApi = processArgs.isForkedApi;
|
||||
|
||||
// function moduleAvailable(name) {
|
||||
// try {
|
||||
@ -21,14 +22,13 @@ const isNpmDist = !!global['dbgateApiModulePath'];
|
||||
// }
|
||||
// }
|
||||
|
||||
const isElectronBundle = processArgs.isElectronBundle;
|
||||
|
||||
const platformInfo = {
|
||||
isWindows,
|
||||
isMac,
|
||||
isLinux,
|
||||
isDocker,
|
||||
isElectronBundle,
|
||||
isElectronBundle: isElectron() && !isDevMode,
|
||||
isForkedApi,
|
||||
isElectron: isElectron(),
|
||||
isDevMode,
|
||||
isNpmDist,
|
||||
|
@ -7,15 +7,13 @@ function getNamedArg(name) {
|
||||
}
|
||||
|
||||
const checkParent = process.argv.includes('--checkParent');
|
||||
const dynport = process.argv.includes('--dynport');
|
||||
const nativeModules = getNamedArg('--native-modules');
|
||||
const startProcess = getNamedArg('--start-process');
|
||||
const isElectronBundle = process.argv.includes('--is-electron-bundle');
|
||||
const isForkedApi = process.argv.includes('--is-forked-api');
|
||||
|
||||
module.exports = {
|
||||
checkParent,
|
||||
nativeModules,
|
||||
startProcess,
|
||||
dynport,
|
||||
isElectronBundle,
|
||||
isForkedApi,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user