Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
Support for node 8 (#282)
Browse files Browse the repository at this point in the history
* Support for node 8

* Arrow function
  • Loading branch information
Wardormeur authored and DanielBrierton committed Dec 20, 2017
1 parent 967bd1a commit c7364a4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
build:
working_directory: ~/cp-users-service
docker:
- image: nodesource/node:0.10.45
- image: node:8
environment:
NODE_ENV: testing
steps:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mhart/alpine-node:0.10.48
FROM node:8-alpine
MAINTAINER butlerx <[email protected]>
ENV NODE_ENV=production
ARG DEP_VERSION=latest
Expand Down
7 changes: 6 additions & 1 deletion config/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';
var path = require('path');
var camelCase = require('camelcase'); // Lodash functions for that are stripping $ which we use for special keys
var decamelize = require('decamelize');
var CpTranslations = require('cp-translations');

module.exports = function (options) {
Expand All @@ -9,7 +11,10 @@ module.exports = function (options) {
host: process.env.POSTGRES_HOST || '127.0.0.1',
port: process.env.POSTGRES_PORT || 5432,
username: process.env.POSTGRES_USERNAME,
password: process.env.POSTGRES_PASSWORD
password: process.env.POSTGRES_PASSWORD,
nolimit: true,
fromColumnName: (attr) => camelCase(attr),
toColumnName: (attr) => decamelize(attr)
};
}

Expand Down
2 changes: 1 addition & 1 deletion dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mhart/alpine-node:0.10.48
FROM node:8-alpine
MAINTAINER butlerx <[email protected]>
ENV NODE_ENV=development
RUN apk add --update git build-base python postgresql-client && \
Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "test"
},
"scripts": {
"test": "npm run lint && bash -c 'source ./config/development.env; ./node_modules/.bin/lab --ignore __core-js_shared__ --flat --threshold 50 -r html -o ./coverage/coverage.html -r lcov -o ./coverage/lcov.info -r json -o ./coverage/coverage.json -r lab-quieter-reporter -o stdout -m 5000'",
"test": "npm run lint && sh -c '. ./config/development.env; ./node_modules/.bin/lab --ignore __core-js_shared__ --flat --threshold 50 -r html -o ./coverage/coverage.html -r lcov -o ./coverage/lcov.info -r json -o ./coverage/coverage.json -r lab-quieter-reporter -o stdout -m 5000'",
"testdata": "node test/lib/service.js",
"covrep": "bash test/covrep.sh",
"lint": "./node_modules/.bin/semistandard *.js config/config.js",
Expand All @@ -28,11 +28,13 @@
},
"dependencies": {
"async": "0.9.0",
"camelcase": "^4.1.0",
"cp-i18n-lib": "git+https://github.com/CoderDojo/cp-i18n-lib.git",
"cp-logs-lib": "git://github.com/CoderDojo/cp-logs-lib#1.1.0",
"cp-permissions-plugin": "git://github.com/CoderDojo/cp-permissions-plugin#1.0.4",
"cp-translations": "^1.0.4",
"cuid": "1.2.5",
"decamelize": "^1.2.0",
"ejs": "1.0.0",
"jed": "1.1.0",
"js-yaml": "3.2.7",
Expand All @@ -42,23 +44,24 @@
"newrelic": "1.19.2",
"node-uuid": "1.4.3",
"optimist": "0.6.1",
"pg": "4.4.0",
"pg": "5.1.0",
"pg-large-object": "0.0.1",
"po2json": "0.4.2",
"postgrator": "2.2.0",
"postgrator": "2.8.1",
"request": "2.58.0",
"seneca": "1.4",
"seneca-auth": "1.0",
"seneca-mail": "0.2.1",
"seneca-postgresql-store": "1.1.3",
"seneca-mail": "^0.2.2",
"seneca-postgresql-store": "2.3",
"seneca-store-query": "0.0.5",
"seneca-user": "1.0",
"shortid": "2.2.2",
"util": "^0.10.3",
"xoauth2": "1.1.0"
},
"devDependencies": {
"chai": "2.2.0",
"lab": "5.15.1",
"lab": "14.x",
"lab-quieter-reporter": "1.0.1",
"nodemon": "1.11.0",
"pre-commit": "1.1.2",
Expand Down
4 changes: 3 additions & 1 deletion service.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var config = require('./config/config.js')();
var seneca = require('seneca')(config);
var _ = require('lodash');
var store = require('seneca-postgresql-store');
var storeQuery = require('seneca-store-query');
var service = 'cp-users-service';
var log = require('cp-logs-lib')({name: service, level: 'warn'});
config.log = log.log;
Expand All @@ -21,6 +22,7 @@ if (process.env.NODE_ENV !== 'production') {
seneca.options(config);
seneca.decorate('customValidatorLogFormatter', require('./lib/custom-validator-log-formatter'));
seneca.use(store, config['postgresql-store']);
seneca.use(storeQuery);
if (process.env.MAILTRAP_ENABLED === 'true') {
seneca.use('mail', config.mailtrap);
} else {
Expand Down Expand Up @@ -89,7 +91,7 @@ require('./migrate-psql-db.js')(function (err) {
client.close();
});

var escape = require('seneca-postgresql-store/lib/relational-util').escapeStr;
var escape = require('seneca-standard-query/lib/relational-util').escapeStr;
['load', 'list'].forEach(function (cmd) {
seneca.wrap('role: entity, cmd: ' + cmd, function filterFields (args, cb) {
try {
Expand Down

0 comments on commit c7364a4

Please sign in to comment.