try to fix pl;ugin directories

This commit is contained in:
Jan Prochazka 2021-12-26 12:59:59 +01:00
parent 3ffe2090e5
commit 266d7d76de
9 changed files with 30 additions and 8 deletions

View File

@ -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);

View File

@ -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),

View File

@ -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),

View File

@ -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),

View File

@ -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),

View File

@ -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),

View File

@ -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;
}

View File

@ -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,

View File

@ -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,
};