254 - Knex sqlite added
This commit is contained in:
parent
8e45c0b89c
commit
6d866dfbff
20
index.js
20
index.js
|
@ -1,10 +1,9 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const {resolve} = require("path");
|
||||
const {
|
||||
createContext,
|
||||
runInContext
|
||||
} = require("vm");
|
||||
|
||||
const {
|
||||
StartSelenium,
|
||||
ClearElement,
|
||||
|
@ -25,10 +24,20 @@ const {
|
|||
GoForward,
|
||||
Refresh
|
||||
} = require("./Core/index");
|
||||
const {
|
||||
knex
|
||||
} = require("knex");
|
||||
|
||||
const DB = knex({
|
||||
client: "sqlite3",
|
||||
connection:{
|
||||
filename: resolve("./data/database.db")
|
||||
}
|
||||
});
|
||||
|
||||
async function runFile(file)
|
||||
{
|
||||
let fileContext = fs.readFileSync(path.resolve(file),"utf-8");
|
||||
let fileContext = fs.readFileSync(resolve(file),"utf-8");
|
||||
let context = createContext({
|
||||
StartSelenium,
|
||||
ClearElement,
|
||||
|
@ -47,9 +56,10 @@ async function runFile(file)
|
|||
GetCurrentTabIndex,
|
||||
GoBack,
|
||||
GoForward,
|
||||
Refresh
|
||||
Refresh,
|
||||
DB
|
||||
});
|
||||
let scope = await runInContext(fileContext + '\n\nmain();', context);
|
||||
await runInContext(fileContext + '\n\nmain();', context);
|
||||
}
|
||||
|
||||
process.nextTick(runFile,"./projects/index.js");
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue