Merge branch 'master' of gitlab.com:MrFry/mrfrys-node-server

This commit is contained in:
mrfry 2021-04-28 17:39:02 +02:00
commit ac0b4bfd87
3 changed files with 2054 additions and 1637 deletions

3656
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,24 +3,24 @@
"main": "src/server.js",
"dependencies": {
"@types/express": "^4.17.9",
"@types/node": "^14.14.9",
"@types/node": "^15.0.1",
"babel-eslint": "^10.1.0",
"better-sqlite3": "^6.0.1",
"better-sqlite3": "^7.1.5",
"connect-busboy": "0.0.2",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"ejs": "^1.0.0",
"ejs": "^3.1.6",
"eslint-plugin-typescript": "^0.14.0",
"express": "^4.6.1",
"express-ejs-layouts": "^1.1.0",
"express-ejs-layouts": "^2.5.0",
"express-fileupload": "^1.2.1",
"queue-microtask": "^1.2.3",
"sqlite3": "^4.1.1",
"sqlite3": "^5.0.2",
"ts-node": "^9.0.0",
"typescript": "^4.1.2",
"typescript-eslint": "0.0.1-alpha.0",
"url": "^0.11.0",
"uuid": "^7.0.3",
"uuid": "^8.3.2",
"vhost": "^3.0.2"
},
"scripts": {

View file

@ -121,12 +121,9 @@ function removePossibleAnswersDuplicates(path) {
count++
})
let removed = 0
dirs.forEach((currDir) => {
const contents = fs.readdirSync(path + '/' + currDir)
let removed = 0
log(
`Processing ${C('green')}${currDir}${C()} (${contents.length} files) ...`
)
contents.forEach((currFile) => {
const currPath = path + '/' + currDir + '/' + currFile
@ -173,10 +170,8 @@ function removePossibleAnswersDuplicates(path) {
})
})
})
log(`Removed ${C('red')}${removed}${C()} files`)
hr()
})
log(`Removed ${C('red')}${removed}${C()} files total`)
log(`${C('green')}Deleting empty directories ...${C()}`)
count = dirs.length
@ -415,14 +410,19 @@ function hr() {
}
function log(text) {
process.stdout.clearLine()
process.stdout.cursorTo(0)
utils.AppendToFile(text, globalLog)
if (process.stdout.isTTY) {
process.stdout.clearLine()
process.stdout.cursorTo(0)
}
console.log(text)
utils.AppendToFile(text, globalLog)
}
function writeInSameLine(text, returnToLineStart) {
if (!process.stdout.isTTY) {
return
}
process.stdout.clearLine()
process.stdout.cursorTo(0)
process.stdout.write(text)
@ -434,6 +434,9 @@ function writeInSameLine(text, returnToLineStart) {
}
function printProgressBar(current, total) {
if (!process.stdout.isTTY) {
return
}
const width = process.stdout.columns - 30
if (width <= 0) {