try to fix npm build

This commit is contained in:
Jan Prochazka 2022-03-24 09:49:14 +01:00
parent ba77b32e9a
commit 45277e34c9
2 changed files with 14 additions and 2 deletions

View File

@ -3,6 +3,7 @@ const path = require('path');
const fs = require('fs');
const cleanDirectory = require('./cleanDirectory');
const platformInfo = require('./platformInfo');
const processArgs = require('./processArgs');
const createDirectories = {};
const ensureDirectory = (dir, clean) => {
@ -56,6 +57,9 @@ function packagedPluginsDir() {
// node_modules
return global['PLUGINS_DIR'];
}
if (processArgs.pluginsDir) {
return processArgs.pluginsDir;
}
if (platformInfo.isElectronBundle) {
return path.resolve(__dirname, '../../plugins');

View File

@ -9,10 +9,17 @@ function getNamedArg(name) {
const checkParent = process.argv.includes('--checkParent');
const startProcess = getNamedArg('--start-process');
const isForkedApi = process.argv.includes('--is-forked-api');
const pluginsDir = getNamedArg('--plugins-dir');
function getPassArgs() {
if (global['NATIVE_MODULES']) return ['--native-modules', global['NATIVE_MODULES']];
return [];
const res = [];
if (global['NATIVE_MODULES']) {
res.push('--native-modules', global['NATIVE_MODULES']);
}
if (global['PLUGINS_DIR']) {
res.push('--plugins-dir', global['PLUGINS_DIR']);
}
return res;
}
module.exports = {
@ -20,4 +27,5 @@ module.exports = {
startProcess,
isForkedApi,
getPassArgs,
pluginsDir,
};