254 - Knex sqlite added

This commit is contained in:
Abdussamed 2023-03-19 14:30:20 +03:00
parent 8e45c0b89c
commit 6d866dfbff
3 changed files with 3142 additions and 7 deletions

View File

@ -1,10 +1,9 @@
const fs = require("fs"); const fs = require("fs");
const path = require("path"); const {resolve} = require("path");
const { const {
createContext, createContext,
runInContext runInContext
} = require("vm"); } = require("vm");
const { const {
StartSelenium, StartSelenium,
ClearElement, ClearElement,
@ -25,10 +24,20 @@ const {
GoForward, GoForward,
Refresh Refresh
} = require("./Core/index"); } = require("./Core/index");
const {
knex
} = require("knex");
const DB = knex({
client: "sqlite3",
connection:{
filename: resolve("./data/database.db")
}
});
async function runFile(file) async function runFile(file)
{ {
let fileContext = fs.readFileSync(path.resolve(file),"utf-8"); let fileContext = fs.readFileSync(resolve(file),"utf-8");
let context = createContext({ let context = createContext({
StartSelenium, StartSelenium,
ClearElement, ClearElement,
@ -47,9 +56,10 @@ async function runFile(file)
GetCurrentTabIndex, GetCurrentTabIndex,
GoBack, GoBack,
GoForward, GoForward,
Refresh Refresh,
DB
}); });
let scope = await runInContext(fileContext + '\n\nmain();', context); await runInContext(fileContext + '\n\nmain();', context);
} }
process.nextTick(runFile,"./projects/index.js"); process.nextTick(runFile,"./projects/index.js");

3124
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,9 @@
{ {
"dependencies": { "dependencies": {
"chromedriver": "^111.0.0", "chromedriver": "^111.0.0",
"selenium-webdriver": "^4.8.1" "exceljs": "^4.3.0",
"knex": "^2.4.2",
"selenium-webdriver": "^4.8.1",
"sqlite3": "^5.1.6"
} }
} }