mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 03:16:01 +00:00
NPM plugin refactor
This commit is contained in:
@@ -1,41 +1,44 @@
|
||||
{
|
||||
"name": "dbgate-plugin-sqlite",
|
||||
"main": "dist/backend.js",
|
||||
"version": "5.0.0-alpha.1",
|
||||
"homepage": "https://dbgate.org",
|
||||
"description": "SQLite connect plugin for DbGate",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dbgate/dbgate"
|
||||
},
|
||||
"author": "Jan Prochazka",
|
||||
"license": "GPL-3.0",
|
||||
"keywords": [
|
||||
"dbgate",
|
||||
"dbgateplugin",
|
||||
"sqlite"
|
||||
],
|
||||
"files": [
|
||||
"dist",
|
||||
"icon.svg"
|
||||
],
|
||||
"scripts": {
|
||||
"build:frontend": "webpack --config webpack-frontend.config",
|
||||
"build:frontend:watch": "webpack --watch --config webpack-frontend.config",
|
||||
"build:backend": "webpack --config webpack-backend.config.js",
|
||||
"build": "yarn build:frontend && yarn build:backend",
|
||||
"plugin": "yarn build && yarn pack && dbgate-plugin dbgate-plugin-sqlite",
|
||||
"copydist": "yarn build && yarn pack && dbgate-copydist ../dist/dbgate-plugin-sqlite",
|
||||
"plugout": "dbgate-plugout dbgate-plugin-sqlite",
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dbgate-tools": "^5.0.0-alpha.1",
|
||||
"dbgate-plugin-tools": "^1.0.4",
|
||||
"dbgate-query-splitter": "^4.11.2",
|
||||
"byline": "^5.0.0",
|
||||
"webpack": "^5.91.0",
|
||||
"webpack-cli": "^5.1.4"
|
||||
}
|
||||
"name": "dbgate-plugin-sqlite",
|
||||
"main": "dist/backend.js",
|
||||
"version": "5.0.0-alpha.1",
|
||||
"homepage": "https://dbgate.org",
|
||||
"description": "SQLite connect plugin for DbGate",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dbgate/dbgate"
|
||||
},
|
||||
"author": "Jan Prochazka",
|
||||
"license": "GPL-3.0",
|
||||
"keywords": [
|
||||
"dbgate",
|
||||
"dbgateplugin",
|
||||
"sqlite"
|
||||
],
|
||||
"files": [
|
||||
"dist",
|
||||
"icon.svg"
|
||||
],
|
||||
"scripts": {
|
||||
"build:frontend": "webpack --config webpack-frontend.config",
|
||||
"build:frontend:watch": "webpack --watch --config webpack-frontend.config",
|
||||
"build:backend": "webpack --config webpack-backend.config.js",
|
||||
"build": "yarn build:frontend && yarn build:backend",
|
||||
"plugin": "yarn build && yarn pack && dbgate-plugin dbgate-plugin-sqlite",
|
||||
"copydist": "yarn build && yarn pack && dbgate-copydist ../dist/dbgate-plugin-sqlite",
|
||||
"plugout": "dbgate-plugout dbgate-plugin-sqlite",
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dbgate-plugin-tools": "^1.0.4",
|
||||
"webpack": "^5.91.0",
|
||||
"webpack-cli": "^5.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"dbgate-tools": "^5.0.0-alpha.1",
|
||||
"dbgate-query-splitter": "^4.11.2"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"better-sqlite3": "9.6.0"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,12 +7,10 @@ const { getLogger, createBulkInsertStreamBase, extractErrorLogData } = global.DB
|
||||
|
||||
const logger = getLogger('sqliteDriver');
|
||||
|
||||
let requireBetterSqlite;
|
||||
|
||||
let betterSqliteValue;
|
||||
function getBetterSqlite() {
|
||||
if (!betterSqliteValue) {
|
||||
betterSqliteValue = requireBetterSqlite();
|
||||
betterSqliteValue = require('better-sqlite3');
|
||||
}
|
||||
return betterSqliteValue;
|
||||
}
|
||||
@@ -188,10 +186,6 @@ const driver = {
|
||||
},
|
||||
};
|
||||
|
||||
driver.initialize = (dbgateEnv) => {
|
||||
if (dbgateEnv.nativeModules && dbgateEnv.nativeModules['better-sqlite3']) {
|
||||
requireBetterSqlite = dbgateEnv.nativeModules['better-sqlite3'];
|
||||
}
|
||||
};
|
||||
driver.initialize = (dbgateEnv) => {};
|
||||
|
||||
module.exports = driver;
|
||||
|
||||
@@ -18,6 +18,11 @@ var config = {
|
||||
// optimization: {
|
||||
// minimize: false,
|
||||
// },
|
||||
externals: {
|
||||
'dbgate-tools': 'commonjs dbgate-tools',
|
||||
'dbgate-query-splitter': 'commonjs dbgate-query-splitter',
|
||||
'better-sqlite3': 'commonjs better-sqlite3',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
|
||||
Reference in New Issue
Block a user