Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade package versions #223

Merged
merged 4 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ cache:
directories:
- node_modules
node_js:
- v6
- v7
- v8
- v9
- v10
- v11
- v12
addons:
apt:
sources:
Expand Down
81 changes: 40 additions & 41 deletions generators/app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,70 +16,69 @@
},
"jest": {
"testEnvironment": "node",
"setupTestFrameworkScriptFile": "<rootDir>/test/setup.js"
"setupFilesAfterEnv": ["<rootDir>/test/setup.js"]
},
"devDependencies": {
"apidoc": "^0.17.6",
"apidoc-markdown": "^0.2.0",
"babel-eslint": "^8.0.1",
"babel-jest": "^20.0.3",
"cross-env": "^5.0.5",
"dotenv-safe": "^4.0.3",
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.1.0",
"jest-cli": "^20.0.4",
"mongodb-memory-server": "^1.7.3",
"nock": "^9.0.2",
"nodemon": "^1.10.2",
"opn-cli": "^3.1.0",
"apidoc": "^0.20.0",
"apidoc-markdown": "^0.2.1",
"babel-eslint": "^10.1.0",
"babel-jest": "^25.1.0",
"cross-env": "^7.0.2",
"dotenv-safe": "^8.2.0",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.0",
"eslint-plugin-standard": "^4.0.1",
"jest-cli": "^25.1.0",
"mongodb-memory-server": "^6.3.3",
"nock": "^12.0.2",
"nodemon": "^2.0.2",
"sinon": "^4.0.1",
"supertest": "^3.0.0"
"supertest": "^4.0.2"
},
"dependencies": {
"babel-core": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-1": "^6.24.1",
"babel-runtime": "^6.26.0",
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-export-default-from": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.8.4",
"@babel/register": "^7.8.3",
"@babel/runtime": "^7.8.4",
<%_ if (generateAuthApi && passwordSignup) { _%>
"bcrypt": "^2.0.1",
"bcrypt": "^4.0.1",
<%_ } _%>
"bluebird": "^3.5.1",
"body-parser": "^1.18.2",
"bodymen": "^1.0.3",
"compression": "^1.7.1",
"cors": "^2.8.4",
"express": "^4.16.2",
"bluebird": "^3.7.2",
"body-parser": "^1.19.0",
"bodymen": "^1.1.1",
"compression": "^1.7.4",
"cors": "^2.8.5",
"express": "^4.17.1",
<%_ if (https) { _%>
"express-force-ssl": "^0.3.2",
<%_ } _%>
<%_ if (generateAuthApi) { _%>
"jsonwebtoken": "^8.1.0",
"jsonwebtoken": "^8.5.1",
<%_ } _%>
"mongoose": "^5.1.0",
"mongoose-create-unique": "^0.4.4",
"mongoose": "^5.9.4",
"mongoose-keywords": "^0.4.0",
"morgan": "^1.7.0",
"morgan": "^1.9.1",
<%_ if (generateAuthApi) { _%>
"passport": "^0.4.0",
"passport": "^0.4.1",
<%_ if (passwordSignup) { _%>
"passport-http": "^0.3.0",
<%_ } _%>
"passport-http-bearer": "^1.0.1",
"passport-jwt": "^3.0.0",
"passport-jwt": "^4.0.0",
<%_ } _%>
"querymen": "^2.1.3",
"querymen": "^2.1.4",
<%_ if (generateAuthApi) { _%>
"rand-token": "^0.4.0",
<%_ } _%>
"request": "^2.83.0",
"request-promise": "^4.2.2"
"request": "^2.88.2",
"request-promise": "^4.2.5"
<%_ if (typeof sendgridKey !== 'undefined' && sendgridKey) { _%>,
"@sendgrid/mail": "^6.3.1"
"@sendgrid/mail": "^6.5.4"
<%_ } _%>
}
}
2 changes: 1 addition & 1 deletion generators/app/templates/api/password-reset/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const update = ({ params: { token }, bodymen: { body: { password } } }, r
if (!reset) return null
const { user } = reset
return user.set({ password }).save()
.then(() => PasswordReset.remove({ user }))
.then(() => PasswordReset.deleteMany({ user }))
.then(() => user.view(true))
})
.then(success(res))
Expand Down
2 changes: 1 addition & 1 deletion generators/app/templates/api/password-reset/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ test('PUT /password-resets/:token 200', async () => {
const { status, body } = await request(app())
.put(`${apiRoot}/${passwordReset.token}`)
.send({ password: '654321' })
const [ updatedUser, passwordResets ] = await Promise.all([
const [updatedUser, passwordResets] = await Promise.all([
User.findById(passwordReset.user.id),
PasswordReset.find({})
])
Expand Down
3 changes: 2 additions & 1 deletion generators/app/templates/api/user/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ userSchema.pre('save', function (next) {
<%_ } _%>
userSchema.methods = {
view (full) {
let view = {}
const view = {}
let fields = ['id', 'name', 'picture']

if (full) {
Expand All @@ -99,6 +99,7 @@ userSchema.methods = {
return bcrypt.compare(password, this.password).then((valid) => valid ? this : false)
}
<%_ } _%>

}

userSchema.statics = {
Expand Down
6 changes: 3 additions & 3 deletions generators/app/templates/babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"presets": [
"es2015",
"stage-1"
"@babel/preset-env"
],
"plugins": [
"transform-runtime"
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-export-default-from"
]
}
4 changes: 3 additions & 1 deletion generators/app/templates/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import api from './api'
const app = express(apiRoot, api)
const server = http.createServer(app)

mongoose.connect(mongo.uri)
if (mongo.uri) {
mongoose.connect(mongo.uri)
}
mongoose.Promise = Promise

setImmediate(() => {
Expand Down
10 changes: 5 additions & 5 deletions generators/app/templates/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const requireProcessEnv = (name) => {
/* istanbul ignore next */
if (process.env.NODE_ENV !== 'production') {
const dotenv = require('dotenv-safe')
dotenv.load({
dotenv.config({
path: path.join(__dirname, '../.env'),
sample: path.join(__dirname, '../.env.example')
example: path.join(__dirname, '../.env.example')
})
}

Expand All @@ -38,9 +38,9 @@ const config = {
<%_ } _%>
mongo: {
options: {
db: {
safe: true
}
useUnifiedTopology: true,
useNewUrlParser: true,
useCreateIndex: true
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion generators/app/templates/src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require('babel-core/register')
require('@babel/register')

exports = module.exports = require('./app')
2 changes: 1 addition & 1 deletion generators/app/templates/src/services/mongoose/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Promise from 'bluebird'
import mongoose from 'mongoose'
import { mongo } from '../../config'

Object.keys(mongo.options).forEach((key) => {
Object.keys(mongo.options || { }).forEach((key) => {
mongoose.set(key, mongo.options[key])
})

Expand Down
4 changes: 2 additions & 2 deletions generators/app/templates/test/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let mongoServer

beforeAll(async () => {
mongoServer = new MongodbMemoryServer()
const mongoUri = await mongoServer.getConnectionString()
const mongoUri = await mongoServer.getUri()
await mongoose.connect(mongoUri, (err) => {
if (err) console.error(err)
})
Expand All @@ -40,7 +40,7 @@ afterEach(async () => {
const { collections } = mongoose.connection
const promises = []
Object.keys(collections).forEach((collection) => {
promises.push(collections[collection].remove())
promises.push(collections[collection].deleteMany({}))
})
await Promise.all(promises)
})
19 changes: 10 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ gulp.task('pre-test', function () {
.pipe(istanbul.hookRequire());
});

gulp.task('test', ['pre-test'], function (cb) {
gulp.task('test', gulp.series('pre-test', function (cb) {
var mochaErr;

gulp.src('test/**/*.js')
return gulp.src('test/**/*.js')
.pipe(plumber())
.pipe(mocha({reporter: 'spec', timeout: 600000}))
.on('error', function (err) {
Expand All @@ -43,20 +43,21 @@ gulp.task('test', ['pre-test'], function (cb) {
.on('end', function () {
cb(mochaErr);
});
});
}));

gulp.task('watch', function () {
gulp.watch(['generators/**/*.js', 'test/**'], ['test']);
});

gulp.task('coveralls', ['test'], function () {
gulp.task('coveralls', gulp.series('test', function (cb) {
if (!process.env.CI) {
return;
return cb();
}

return gulp.src(path.join(__dirname, 'coverage/lcov.info'))
.pipe(coveralls());
});
.pipe(coveralls())
.on('end', cb);
}));

gulp.task('prepublish', [/* 'nsp' */]);
gulp.task('default', ['test', 'coveralls']);
gulp.task('prepublish', function(cb) { /* nsp? */ cb() });
gulp.task('default', gulp.series('coveralls'));
85 changes: 42 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"yeoman"
],
"dependencies": {
"bluebird": "^3.5.1",
"babel-eslint": "^10.1.0",
"bluebird": "^3.7.2",
"chalk": "^1.0.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-standard": "^2.3.1",
Expand All @@ -45,55 +46,53 @@
"yosay": "^1.0.0"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.1",
"babel-jest": "^20.0.3",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-1": "^6.24.1",
"babel-runtime": "^6.26.0",
"bcrypt": "^2.0.1",
"body-parser": "^1.18.2",
"bodymen": "^1.0.3",
"compression": "^1.7.1",
"cors": "^2.8.4",
"dotenv-safe": "^4.0.3",
"eslint": "^4.4.1",
"eslint-config-standard": "^10.2.1",
"eslint-config-xo-space": "^0.14.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-promise": "^3.0.0",
"eslint-plugin-standard": "^2.0.0",
"express": "^4.16.2",
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-export-default-from": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.8.4",
"@babel/register": "^7.8.3",
"@babel/runtime": "^7.8.4",
"bcrypt": "^4.0.1",
"body-parser": "^1.19.0",
"bodymen": "^1.1.1",
"compression": "^1.7.4",
"cors": "^2.8.5",
"dotenv-safe": "^8.2.0",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.0",
"eslint-plugin-standard": "^4.0.1",
"express": "^4.17.1",
"express-force-ssl": "^0.3.2",
"fs-extra": "^0.30.0",
"gulp": "^3.9.0",
"gulp-coveralls": "^0.1.0",
"gulp-eslint": "^2.0.0",
"gulp-exclude-gitignore": "^1.0.0",
"gulp-istanbul": "^1.0.0",
"gulp-line-ending-corrector": "^1.0.1",
"gulp": "^4.0.2",
"gulp-coveralls": "^0.1.4",
"gulp-eslint": "^6.0.0",
"gulp-exclude-gitignore": "^1.2.0",
"gulp-istanbul": "^1.1.3",
"gulp-line-ending-corrector": "^1.0.3",
"gulp-mocha": "^2.0.0",
"gulp-plumber": "^1.0.0",
"jest-cli": "^20.0.4",
"jsonwebtoken": "^8.1.0",
"mongodb-memory-server": "^1.7.3",
"mongoose": "^5.1.0",
"mongoose-create-unique": "^0.4.4",
"gulp-plumber": "^1.2.1",
"jest-cli": "^25.1.0",
"jsonwebtoken": "^8.5.1",
"mongodb-memory-server": "^6.3.3",
"mongoose": "^5.9.4",
"mongoose-keywords": "^0.4.0",
"morgan": "^1.7.0",
"nock": "^9.0.2",
"nodemon": "^1.10.2",
"passport": "^0.4.0",
"morgan": "^1.9.1",
"nock": "^12.0.2",
"nodemon": "^2.0.2",
"passport": "^0.4.1",
"passport-http": "^0.3.0",
"passport-http-bearer": "^1.0.1",
"passport-jwt": "^3.0.0",
"querymen": "^2.1.3",
"request": "^2.83.0",
"request-promise": "^4.2.2",
"@sendgrid/mail": "^6.3.1",
"passport-jwt": "^4.0.0",
"querymen": "^2.1.4",
"request": "^2.88.2",
"request-promise": "^4.2.5",
"@sendgrid/mail": "^6.5.4",
"sinon": "^4.0.1",
"supertest": "^3.0.0",
"supertest": "^4.0.2",
"yeoman-assert": "^2.0.0",
"yeoman-test": "^1.0.0"
},
Expand Down