* chore(node): upgrade to version 12

* update package-lock.json

* upgrade bcrypt

* upgrade node-sass

* update deps

* fix deprecation

* downgrade amplitude

* fix client side tests

* fix common and integration tests, upgrade mongoose
This commit is contained in:
Matteo Pagliazzi
2019-08-19 22:43:17 +02:00
committed by GitHub
parent 8b5129cd4f
commit e621e781ed
9 changed files with 3654 additions and 2479 deletions

2
.nvmrc
View File

@@ -1 +1 @@
10 12

View File

@@ -1,6 +1,6 @@
language: node_js language: node_js
node_js: node_js:
- '10' - '12'
services: services:
- mongodb - mongodb
cache: cache:

View File

@@ -1,4 +1,4 @@
FROM node:10 FROM node:12
ENV ADMIN_EMAIL admin@habitica.com ENV ADMIN_EMAIL admin@habitica.com
ENV AMAZON_PAYMENTS_CLIENT_ID amzn1.application-oa2-client.68ed9e6904ef438fbc1bf86bf494056e ENV AMAZON_PAYMENTS_CLIENT_ID amzn1.application-oa2-client.68ed9e6904ef438fbc1bf86bf494056e

View File

@@ -1,5 +1,5 @@
FROM node:10 FROM node:12
WORKDIR /code WORKDIR /code
COPY package*.json /code/ COPY package*.json /code/
RUN npm install RUN npm install
RUN npm install -g gulp-cli mocha RUN npm install -g gulp-cli mocha

6058
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,7 @@
"accepts": "^1.3.5", "accepts": "^1.3.5",
"amazon-payments": "^0.2.7", "amazon-payments": "^0.2.7",
"amplitude": "^3.5.0", "amplitude": "^3.5.0",
"amplitude-js": "^5.0.0", "amplitude-js": "^5.2.2",
"apidoc": "^0.17.5", "apidoc": "^0.17.5",
"apn": "^2.2.0", "apn": "^2.2.0",
"autoprefixer": "^9.4.0", "autoprefixer": "^9.4.0",
@@ -28,7 +28,7 @@
"babel-preset-es2015": "^6.6.0", "babel-preset-es2015": "^6.6.0",
"babel-register": "^6.6.0", "babel-register": "^6.6.0",
"babel-runtime": "^6.11.6", "babel-runtime": "^6.11.6",
"bcrypt": "^3.0.5", "bcrypt": "^3.0.6",
"body-parser": "^1.18.3", "body-parser": "^1.18.3",
"bootstrap": "^4.1.1", "bootstrap": "^4.1.1",
"bootstrap-vue": "^2.0.0-rc.18", "bootstrap-vue": "^2.0.0-rc.18",
@@ -64,11 +64,11 @@
"method-override": "^3.0.0", "method-override": "^3.0.0",
"moment": "^2.22.1", "moment": "^2.22.1",
"moment-recur": "^1.0.7", "moment-recur": "^1.0.7",
"mongoose": "^5.4.19", "mongoose": "^5.6.9",
"morgan": "^1.7.0", "morgan": "^1.7.0",
"nconf": "^0.10.0", "nconf": "^0.10.0",
"node-gcm": "^1.0.2", "node-gcm": "^1.0.2",
"node-sass": "^4.9.0", "node-sass": "^4.12.0",
"ora": "^3.2.0", "ora": "^3.2.0",
"pageres": "^5.1.0", "pageres": "^5.1.0",
"passport": "^0.4.0", "passport": "^0.4.0",
@@ -80,6 +80,7 @@
"postcss-easy-import": "^3.0.0", "postcss-easy-import": "^3.0.0",
"ps-tree": "^1.0.0", "ps-tree": "^1.0.0",
"pug": "^2.0.3", "pug": "^2.0.3",
"regenerator-runtime": "^0.13.3",
"rimraf": "^2.4.3", "rimraf": "^2.4.3",
"sass-loader": "^7.0.3", "sass-loader": "^7.0.3",
"shelljs": "^0.8.2", "shelljs": "^0.8.2",
@@ -115,7 +116,7 @@
}, },
"private": true, "private": true,
"engines": { "engines": {
"node": "^10", "node": "^12",
"npm": "^6" "npm": "^6"
}, },
"scripts": { "scripts": {

View File

@@ -11,8 +11,6 @@
], ],
"plugins": [ "plugins": [
"transform-object-rest-spread", "transform-object-rest-spread",
"syntax-async-functions",
"transform-regenerator",
], ],
"comments": false, "comments": false,
} }

View File

@@ -60,7 +60,7 @@ const baseConfig = {
}), }),
postcss: [ postcss: [
autoprefixer({ autoprefixer({
browsers: ['last 2 versions'], overrideBrowserslist: ['last 2 versions'],
}), }),
postcssEasyImport(), postcssEasyImport(),
], ],

View File

@@ -37,6 +37,23 @@ export const taskIsGroupOrChallengeQuery = {
], ],
}; };
const reminderSchema = new Schema({
_id: false,
id: {$type: String, validate: [v => validator.isUUID(v), 'Invalid uuid.'], default: shared.uuid, required: true},
startDate: {$type: Date},
time: {$type: Date, required: true},
}, {
strict: true,
minimize: false, // So empty objects are returned
_id: false,
typeKey: '$type', // So that we can use a field named `type`
});
reminderSchema.plugin(baseModel, {
noSet: ['_id', 'id'],
_id: false,
});
// Important // Important
// When something changes here remember to update the client side model at common/script/libs/taskDefaults // When something changes here remember to update the client side model at common/script/libs/taskDefaults
export let TaskSchema = new Schema({ export let TaskSchema = new Schema({
@@ -57,20 +74,14 @@ export let TaskSchema = new Schema({
}, },
msg: 'Task short names cannot be uuids.', msg: 'Task short names cannot be uuids.',
}, { }, {
validator (alias) { async validator (alias) {
return new Promise((resolve, reject) => { const taskDuplicated = await Task.findOne({ // eslint-disable-line no-use-before-define
Task.findOne({ // eslint-disable-line no-use-before-define _id: { $ne: this._id },
_id: { $ne: this._id }, userId: this.userId,
userId: this.userId, alias,
alias, }).exec();
}).exec().then((task) => {
let aliasAvailable = !task;
return aliasAvailable ? resolve() : reject(); return taskDuplicated ? false : true;
}).catch(() => {
reject();
});
});
}, },
msg: 'Task alias already used on another task.', msg: 'Task alias already used on another task.',
}], }],
@@ -116,12 +127,7 @@ export let TaskSchema = new Schema({
sharedCompletion: {$type: String, enum: _.values(SHARED_COMPLETION), default: SHARED_COMPLETION.single}, sharedCompletion: {$type: String, enum: _.values(SHARED_COMPLETION), default: SHARED_COMPLETION.single},
}, },
reminders: [{ reminders: [reminderSchema],
_id: false,
id: {$type: String, validate: [v => validator.isUUID(v), 'Invalid uuid.'], default: shared.uuid, required: true},
startDate: {$type: Date},
time: {$type: Date, required: true},
}],
}, _.defaults({ }, _.defaults({
minimize: false, // So empty objects are returned minimize: false, // So empty objects are returned
strict: true, strict: true,