From b9fd2c87f342a5769afa7fea0cc2f5a983e2d9c6 Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak Date: Sun, 28 Feb 2021 15:54:56 -0700 Subject: [PATCH] chore: bump deps (#9335) * chore: bump deps * fix: husky git hooks --- .husky/.gitignore | 1 + .husky/commit-msg | 4 +++ .husky/pre-commit | 4 +++ install/package.json | 67 +++++++++++++++++++------------------------ src/cli/index.js | 18 ++++++------ src/database/mongo.js | 9 +++--- 6 files changed, 51 insertions(+), 52 deletions(-) create mode 100644 .husky/.gitignore create mode 100755 .husky/commit-msg create mode 100755 .husky/pre-commit diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 0000000000..31354ec138 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 0000000000..e8511eaeaf --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install commitlint --edit $1 diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000000..d37daa075e --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install lint-staged diff --git a/install/package.json b/install/package.json index cd8f5c0452..68014eb1e1 100644 --- a/install/package.json +++ b/install/package.json @@ -11,8 +11,8 @@ "main": "app.js", "scripts": { "start": "node loader.js", - "lint": "npx eslint --cache ./nodebb .", - "test": "npx nyc --reporter=html --reporter=text-summary npx mocha", + "lint": "eslint --cache ./nodebb .", + "test": "nyc --reporter=html --reporter=text-summary mocha", "coverage": "nyc report --reporter=text-lcov > ./coverage/lcov.info", "coveralls": "nyc report --reporter=text-lcov | coveralls && rm -r coverage" }, @@ -22,22 +22,15 @@ "test/*" ] }, - "husky": { - "hooks": { - "pre-commit": "npx lint-staged", - "commit-msg": "npx commitlint -E HUSKY_GIT_PARAMS" - } - }, "lint-staged": { "*.js": [ - "eslint --fix", - "git add" + "eslint --fix" ] }, "dependencies": { "@adactive/bootstrap-tagsinput": "^0.8.2", - "ace-builds": "^1.4.9", - "archiver": "^5.0.0", + "ace-builds": "^1.4.12", + "archiver": "^5.2.0", "async": "^3.2.0", "autoprefixer": "10.2.4", "bcryptjs": "2.4.3", @@ -45,31 +38,31 @@ "body-parser": "^1.19.0", "bootbox": "5.5.2", "bootstrap": "^3.4.1", - "chart.js": "^2.9.3", + "chart.js": "^2.9.4", "cli-graph": "^3.2.2", "clipboard": "^2.0.6", "colors": "^1.4.0", - "commander": "^6.0.0", + "commander": "^7.1.0", "compare-versions": "3.6.0", "compression": "^1.7.4", "connect-ensure-login": "^0.1.1", "connect-flash": "^0.1.1", - "connect-mongo": "3.2.0", + "connect-mongo": "4.2.0", "connect-multiparty": "^2.2.0", - "connect-pg-simple": "^6.1.0", + "connect-pg-simple": "^6.2.1", "connect-redis": "5.1.0", "cookie-parser": "^1.4.5", "cron": "^1.8.2", - "cropperjs": "^1.5.6", + "cropperjs": "^1.5.11", "csurf": "^1.11.0", "daemon": "^1.1.0", "diff": "^5.0.0", "express": "^4.17.1", - "express-session": "^1.17.0", - "express-useragent": "^1.0.13", - "graceful-fs": "^4.2.3", - "helmet": "^4.0.0", - "html-to-text": "6.0.0", + "express-session": "^1.17.1", + "express-useragent": "^1.0.15", + "graceful-fs": "^4.2.6", + "helmet": "^4.4.1", + "html-to-text": "7.0.0", "ipaddr.js": "^2.0.0", "jquery": "3.5.1", "jquery-deserialize": "2.0.0-rc1", @@ -80,20 +73,20 @@ "json2csv": "5.0.6", "jsonwebtoken": "^8.5.1", "less": "^3.11.1", - "lodash": "^4.17.15", - "logrotate-stream": "^0.2.6", + "lodash": "^4.17.21", + "logrotate-stream": "^0.2.7", "lru-cache": "6.0.0", "material-design-lite": "^1.3.0", - "mime": "^2.4.4", + "mime": "^2.5.2", "mkdirp": "^1.0.4", "mongodb": "3.6.4", "morgan": "^1.10.0", "mousetrap": "^1.6.5", "@nodebb/bootswatch": "3.4.2", - "nconf": "^0.11.0", + "nconf": "^0.11.2", "nodebb-plugin-composer-default": "6.5.12", "nodebb-plugin-dbsearch": "4.2.0", - "nodebb-plugin-emoji": "^3.3.0", + "nodebb-plugin-emoji": "^3.5.0", "nodebb-plugin-emoji-android": "2.0.5", "nodebb-plugin-markdown": "8.12.6", "nodebb-plugin-mentions": "2.13.7", @@ -104,35 +97,35 @@ "nodebb-theme-slick": "1.4.3", "nodebb-theme-vanilla": "11.4.5", "nodebb-widget-essentials": "5.0.3", - "nodemailer": "^6.4.6", + "nodemailer": "^6.5.0", "nprogress": "0.2.0", "passport": "^0.4.1", "passport-http-bearer": "^1.0.1", "passport-local": "1.0.0", - "pg": "^8.0.2", - "pg-cursor": "^2.1.9", + "pg": "^8.5.1", + "pg-cursor": "^2.5.2", "postcss": "8.2.6", "postcss-clean": "1.2.0", - "promise-polyfill": "^8.1.3", - "prompt": "^1.0.0", + "promise-polyfill": "^8.2.0", + "prompt": "^1.1.0", "redis": "3.0.2", "request": "2.88.2", - "request-promise-native": "^1.0.8", + "request-promise-native": "^1.0.9", "requirejs": "2.3.6", "rimraf": "3.0.2", "rss": "^1.2.2", - "sanitize-html": "^2.0.0", - "semver": "^7.2.1", + "sanitize-html": "^2.3.2", + "semver": "^7.3.4", "serve-favicon": "^2.5.0", "sharp": "0.27.2", - "sitemap": "^6.1.0", + "sitemap": "^6.4.0", "slideout": "1.0.1", "socket.io": "3.1.2", "socket.io-adapter-cluster": "^1.0.1", "socket.io-client": "3.1.2", "socket.io-redis": "6.0.1", "sortablejs": "1.13.0", - "spdx-license-list": "^6.1.0", + "spdx-license-list": "^6.4.0", "spider-detector": "2.0.0", "textcomplete": "^0.17.1", "textcomplete.contenteditable": "^0.1.1", diff --git a/src/cli/index.js b/src/cli/index.js index 84f0ad981d..fafc4857ad 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -116,7 +116,7 @@ program .command('start') .description('Start the NodeBB server') .action(() => { - require('./running').start(program); + require('./running').start(program.opts()); }); program .command('slog', null, { @@ -124,8 +124,7 @@ program }) .description('Start the NodeBB server and view the live output log') .action(() => { - program.log = true; - require('./running').start(program); + require('./running').start({ ...program.opts(), log: true }); }); program .command('dev', null, { @@ -133,34 +132,33 @@ program }) .description('Start NodeBB in verbose development mode') .action(() => { - program.dev = true; process.env.NODE_ENV = 'development'; global.env = 'development'; - require('./running').start(program); + require('./running').start({ ...program.opts(), dev: true }); }); program .command('stop') .description('Stop the NodeBB server') .action(() => { - require('./running').stop(program); + require('./running').stop(program.opts()); }); program .command('restart') .description('Restart the NodeBB server') .action(() => { - require('./running').restart(program); + require('./running').restart(program.opts()); }); program .command('status') .description('Check the running status of the NodeBB server') .action(() => { - require('./running').status(program); + require('./running').status(program.opts()); }); program .command('log') .description('Open the output log (useful for debugging)') .action(() => { - require('./running').log(program); + require('./running').log(program.opts()); }); // management commands @@ -193,7 +191,7 @@ program .description(`Compile static assets ${'(JS, CSS, templates, languages)'.red}`) .option('-s, --series', 'Run builds in series without extra processes') .action((targets, options) => { - if (program.dev) { + if (program.opts().dev) { process.env.NODE_ENV = 'development'; global.env = 'development'; } diff --git a/src/database/mongo.js b/src/database/mongo.js index a139a6ada3..7fbbaf52e9 100644 --- a/src/database/mongo.js +++ b/src/database/mongo.js @@ -4,7 +4,6 @@ const winston = require('winston'); const nconf = require('nconf'); -const session = require('express-session'); const semver = require('semver'); const prompt = require('prompt'); const utils = require('../utils'); @@ -66,11 +65,11 @@ mongoModule.init = async function () { }; mongoModule.createSessionStore = async function (options) { - const client = await connection.connect(options); + const { default: MongoStore } = require('connect-mongo'); const meta = require('../meta'); - const sessionStore = require('connect-mongo')(session); - const store = new sessionStore({ - client: client, + + const store = MongoStore.create({ + clientPromise: connection.connect(options), ttl: meta.getSessionTTLSeconds(), });