diff --git a/.github/workflows/build-app-beta.yaml b/.github/workflows/build-app-beta.yaml index 4a4697c19..24b326342 100644 --- a/.github/workflows/build-app-beta.yaml +++ b/.github/workflows/build-app-beta.yaml @@ -47,9 +47,6 @@ jobs: yarn printSecrets env: GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - - name: fillNativeModulesElectron - run: | - yarn fillNativeModulesElectron - name: fillPackagedPlugins run: | yarn fillPackagedPlugins diff --git a/.github/workflows/build-app-pro-beta.yaml b/.github/workflows/build-app-pro-beta.yaml index 9b69277d9..25b4ac545 100644 --- a/.github/workflows/build-app-pro-beta.yaml +++ b/.github/workflows/build-app-pro-beta.yaml @@ -87,11 +87,6 @@ jobs: yarn printSecrets env: GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - - name: fillNativeModulesElectron - run: | - cd .. - cd dbgate-merged - yarn fillNativeModulesElectron - name: fillPackagedPlugins run: | cd .. diff --git a/.github/workflows/build-app-pro.yaml b/.github/workflows/build-app-pro.yaml index 1170a7079..ff1630b9b 100644 --- a/.github/workflows/build-app-pro.yaml +++ b/.github/workflows/build-app-pro.yaml @@ -88,11 +88,6 @@ jobs: yarn printSecrets env: GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - - name: fillNativeModulesElectron - run: | - cd .. - cd dbgate-merged - yarn fillNativeModulesElectron - name: fillPackagedPlugins run: | cd .. diff --git a/.github/workflows/build-app.yaml b/.github/workflows/build-app.yaml index 492153279..4e3b56e0c 100644 --- a/.github/workflows/build-app.yaml +++ b/.github/workflows/build-app.yaml @@ -50,9 +50,6 @@ jobs: yarn printSecrets env: GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - - name: fillNativeModulesElectron - run: | - yarn fillNativeModulesElectron - name: fillPackagedPlugins run: | yarn fillPackagedPlugins diff --git a/.gitignore b/.gitignore index 4fbefcafc..40255d24e 100644 --- a/.gitignore +++ b/.gitignore @@ -28,8 +28,6 @@ docker/plugins npm-debug.log* yarn-debug.log* yarn-error.log* -app/src/nativeModulesContent.js -packages/api/src/nativeModulesContent.js packages/api/src/packagedPluginsContent.js .VSCodeCounter diff --git a/app/src/electron.js b/app/src/electron.js index 715067197..8106380f3 100644 --- a/app/src/electron.js +++ b/app/src/electron.js @@ -430,7 +430,6 @@ function createWindow() { ); global.API_PACKAGE = apiPackage; - global.NATIVE_MODULES = path.join(__dirname, 'nativeModules'); // console.log('global.API_PACKAGE', global.API_PACKAGE); const api = require(apiPackage); diff --git a/app/src/nativeModules.js b/app/src/nativeModules.js deleted file mode 100644 index 03a2f2c06..000000000 --- a/app/src/nativeModules.js +++ /dev/null @@ -1,3 +0,0 @@ -const content = require('./nativeModulesContent'); - -module.exports = content; diff --git a/fillNativeModules.js b/fillNativeModules.js deleted file mode 100644 index 23024893d..000000000 --- a/fillNativeModules.js +++ /dev/null @@ -1,24 +0,0 @@ -const fs = require('fs'); - -let fillContent = ''; - -if (process.platform == 'win32') { - fillContent += `content.msnodesqlv8 = () => require('msnodesqlv8');\n`; -} -fillContent += `content['better-sqlite3'] = () => require('better-sqlite3');\n`; -fillContent += `content['oracledb'] = () => require('oracledb');\n`; - -const getContent = empty => ` -// this file is generated automatically by script fillNativeModules.js, do not edit it manually -const content = {}; - -${empty ? '' : fillContent} - -module.exports = content; -`; - -fs.writeFileSync( - 'packages/api/src/nativeModulesContent.js', - getContent(process.argv.includes('--electron') ? true : false) -); -fs.writeFileSync('app/src/nativeModulesContent.js', getContent(false)); diff --git a/package.json b/package.json index 75a285e6e..8059cb46c 100644 --- a/package.json +++ b/package.json @@ -47,8 +47,6 @@ "printSecrets": "node printSecrets", "generatePadFile": "node generatePadFile", "adjustPackageJson": "node adjustPackageJson", - "fillNativeModules": "node fillNativeModules", - "fillNativeModulesElectron": "node fillNativeModules --electron", "fillPackagedPlugins": "node fillPackagedPlugins", "resetPackagedPlugins": "node resetPackagedPlugins", "prettier": "prettier --write packages/api/src && prettier --write packages/datalib/src && prettier --write packages/filterparser/src && prettier --write packages/sqltree/src && prettier --write packages/tools/src && prettier --write packages/types && prettier --write packages/web/src && prettier --write app/src", @@ -62,7 +60,7 @@ "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 build:plugins:frontend", "dbgate-serve": "node packages/dbgate/bin/dbgate-serve.js" }, "dependencies": { diff --git a/packages/api/src/nativeModules.js b/packages/api/src/nativeModules.js deleted file mode 100644 index 954acbaa0..000000000 --- a/packages/api/src/nativeModules.js +++ /dev/null @@ -1,13 +0,0 @@ -const argIndex = process.argv.indexOf('--native-modules'); -const redirectFile = global['NATIVE_MODULES'] || (argIndex > 0 ? process.argv[argIndex + 1] : null); - -function requireDynamic(file) { - try { - // @ts-ignore - return __non_webpack_require__(redirectFile); - } catch (err) { - return require(redirectFile); - } -} - -module.exports = redirectFile ? requireDynamic(redirectFile) : require('./nativeModulesContent'); diff --git a/packages/api/src/shell/requirePlugin.js b/packages/api/src/shell/requirePlugin.js index 4bb00c997..23393d40a 100644 --- a/packages/api/src/shell/requirePlugin.js +++ b/packages/api/src/shell/requirePlugin.js @@ -1,7 +1,6 @@ const path = require('path'); const fs = require('fs'); const { pluginsdir, packagedPluginsDir, getPluginBackendPath } = require('../utility/directories'); -const nativeModules = require('../nativeModules'); const platformInfo = require('../utility/platformInfo'); const authProxy = require('../utility/authProxy'); const { getLogger } = require('dbgate-tools'); @@ -11,7 +10,6 @@ const loadedPlugins = {}; const dbgateEnv = { dbgateApi: null, - nativeModules, platformInfo, authProxy, }; diff --git a/packages/api/src/utility/processArgs.js b/packages/api/src/utility/processArgs.js index 6bf866512..b00877cce 100644 --- a/packages/api/src/utility/processArgs.js +++ b/packages/api/src/utility/processArgs.js @@ -17,9 +17,6 @@ const listenApiChild = process.argv.includes('--listen-api-child') || listenApi; function getPassArgs() { const res = []; - if (global['NATIVE_MODULES']) { - res.push('--native-modules', global['NATIVE_MODULES']); - } if (global['PLUGINS_DIR']) { res.push('--plugins-dir', global['PLUGINS_DIR']); }