NPM plugin refactor

This commit is contained in:
SPRINX0\prochazka
2024-11-13 10:31:01 +01:00
parent 94db02db2e
commit 1f868523b0
24 changed files with 159 additions and 82 deletions

View File

@@ -25,14 +25,13 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"byline": "^5.0.0",
"dbgate-plugin-tools": "^1.0.8",
"dbgate-tools": "^5.0.0-alpha.1",
"json-stable-stringify": "^1.0.1",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@clickhouse/client": "^1.5.0"
"@clickhouse/client": "^1.5.0",
"dbgate-tools": "^5.0.0-alpha.1",
"json-stable-stringify": "^1.0.1"
}
}

View File

@@ -18,6 +18,12 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
'@clickhouse/client': 'commonjs @clickhouse/client',
'json-stable-stringify': 'commonjs json-stable-stringify',
'dbgate-tools': 'commonjs dbgate-tools',
},
};
module.exports = config;

View File

@@ -32,11 +32,13 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"csv": "^6.3.10",
"dbgate-plugin-tools": "^1.0.7",
"line-reader": "^0.4.0",
"lodash": "^4.17.21",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"csv": "^6.3.10",
"line-reader": "^0.4.0",
"lodash": "^4.17.21"
}
}
}

View File

@@ -18,6 +18,12 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
csv: 'commonjs csv',
'line-reader': 'commonjs line-reader',
lodash: 'commonjs lodash',
},
};
module.exports = config;

View File

@@ -32,10 +32,12 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"lodash": "^4.17.21",
"xlsx": "0.16.9",
"dbgate-plugin-tools": "^1.0.7",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependecies": {
"lodash": "^4.17.21",
"xlsx": "0.16.9"
}
}

View File

@@ -18,6 +18,11 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
xlsx: 'commonjs xlsx',
lodash: 'commonjs lodash',
},
};
module.exports = config;

View File

@@ -31,15 +31,17 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"bson": "^6.8.0",
"dbgate-plugin-tools": "^1.0.7",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"bson": "^6.8.0",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"is-promise": "^4.0.0",
"lodash": "^4.17.21",
"mongodb": "^6.3.0",
"mongodb-client-encryption": "^6.0.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
"mongodb-client-encryption": "^6.0.0"
}
}

View File

@@ -18,6 +18,16 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
'dbgate-tools': 'commonjs dbgate-tools',
'dbgate-query-splitter': 'commonjs dbgate-query-splitter',
lodash: 'commonjs lodash',
mongodb: 'commonjs mongodb',
'mongodb-client-encryption': 'commonjs mongodb-client-encryption',
bson: 'commonjs bson',
'is-promise': 'commonjs is-promise',
},
};
module.exports = config;

View File

@@ -31,12 +31,12 @@
"plugout": "dbgate-plugout dbgate-plugin-mssql"
},
"devDependencies": {
"dbgate-plugin-tools": "^1.0.7",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"async-lock": "^1.2.6",
"dbgate-plugin-tools": "^1.0.7",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"tedious": "^18.2.0"

View File

@@ -20,6 +20,10 @@ var config = {
externals: {
msnodesqlv8: 'commonjs msnodesqlv8',
'async-lock': 'commonjs async-lock',
'dbgate-query-splitter': 'commonjs dbgate-query-splitter',
'dbgate-tools': 'commonjs dbgate-tools',
tedious: 'commonjs tedious',
},
};

View File

@@ -31,12 +31,14 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"antares-mysql-dumper": "^0.0.1",
"dbgate-plugin-tools": "^1.0.7",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"mysql2": "^3.11.3",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"antares-mysql-dumper": "^0.0.1",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"mysql2": "^3.11.3"
}
}

View File

@@ -14,6 +14,13 @@ var config = {
libraryTarget: 'commonjs2',
},
externals: {
'dbgate-tools': 'commonjs dbgate-tools',
'dbgate-query-splitter': 'commonjs dbgate-query-splitter',
'antares-mysql-dumper': 'commonjs antares-mysql-dumper',
mysql2: 'commonjs mysql2',
},
// uncomment for disable minimalization
// optimization: {
// minimize: false,

View File

@@ -31,10 +31,15 @@
},
"devDependencies": {
"dbgate-plugin-tools": "^1.0.8",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21"
},
"optionalDependencies": {
"oracledb": "^6.6.0"
}
}

View File

@@ -6,13 +6,12 @@ const Analyser = require('./Analyser');
const { createBulkInsertStreamBase, makeUniqueColumnNames } = global.DBGATE_PACKAGES['dbgate-tools'];
const createOracleBulkInsertStream = require('./createOracleBulkInsertStream');
let requireOracledb;
let platformInfo;
let oracledbValue;
function getOracledb() {
if (!oracledbValue) {
oracledbValue = requireOracledb();
oracledbValue = require('oracledb');
}
return oracledbValue;
}
@@ -359,9 +358,6 @@ const driver = {
};
driver.initialize = dbgateEnv => {
if (dbgateEnv.nativeModules && dbgateEnv.nativeModules['oracledb']) {
requireOracledb = dbgateEnv.nativeModules['oracledb'];
}
platformInfo = dbgateEnv.platformInfo;
};

View File

@@ -35,6 +35,12 @@ var config = {
},
}),
],
externals: {
'dbgate-tools': 'commonjs dbgate-tools',
'dbgate-query-splitter': 'commonjs dbgate-query-splitter',
lodash: 'commonjs lodash',
},
};
module.exports = config;

View File

@@ -31,14 +31,14 @@
},
"devDependencies": {
"dbgate-plugin-tools": "^1.0.7",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21",
"pg": "^8.11.5",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"pg-copy-streams": "^6.0.6"
"pg-copy-streams": "^6.0.6",
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21",
"pg": "^8.11.5"
}
}

View File

@@ -35,6 +35,14 @@ var config = {
},
}),
],
externals: {
'dbgate-tools': 'commonjs dbgate-tools',
'dbgate-query-splitter': 'commonjs dbgate-query-splitter',
lodash: 'commonjs lodash',
pg: 'commonjs pg',
'pg-copy-streams': 'commonjs pg-copy-streams',
}
};
module.exports = config;

View File

@@ -30,11 +30,13 @@
},
"devDependencies": {
"dbgate-plugin-tools": "^1.0.7",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"dbgate-query-splitter": "^4.11.2",
"dbgate-tools": "^5.0.0-alpha.1",
"lodash": "^4.17.21",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"async": "^3.2.3",
"ioredis": "^5.4.1",
"node-redis-dump2": "^0.5.0"

View File

@@ -18,6 +18,14 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
'dbgate-tools': 'commmonjs dbgate-tools',
'dbgate-query-splitter': 'commmonjs dbgate-query-splitter',
lodash: 'commmonjs lodash',
async: 'commmonjs async',
ioredis: 'commmonjs ioredis',
'node-redis-dump2': 'commmonjs node-redis-dump2',
},
};
module.exports = config;

View File

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

View File

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

View File

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

View File

@@ -31,9 +31,11 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"node-xml-stream-parser": "^1.0.12",
"dbgate-plugin-tools": "^1.0.7",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"node-xml-stream-parser": "^1.0.12"
}
}

View File

@@ -18,6 +18,9 @@ var config = {
// optimization: {
// minimize: false,
// },
externals: {
'node-xml-stream-parser': 'commonjs node-xml-stream-parser',
},
};
module.exports = config;