Skip to content

Commit

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

* Add update for lab to avoid global as a leak

* Fix circle config for node 8,
fix package.json to use . instead of source

* Arrow functions
  • Loading branch information
Wardormeur authored and DanielBrierton committed Dec 20, 2017
1 parent 43ffaa4 commit 539924d
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-events-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,4 +1,6 @@
var path = require('path');
var camelCase = require('camelcase'); // Lodash functions for that are stripping $ which we use for special keys
var decamelize = require('decamelize');

module.exports = function (options) {
function pgConfig () {
Expand All @@ -7,7 +9,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)
};
}
function kueConfig () {
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 @@ -6,8 +6,8 @@
"scripts": {
"lint": "semistandard *.js config/config.js",
"testdata": "node test/lib/service.js",
"test": "sh -c 'source ./config/development.env; npm run lint && lab lib/controllers -P spec --ignore __core-js_shared__ '",
"coverage": "sh -c 'source ./config/development.env; lab --threshold 68 -r html -o ./coverage/coverage.html -r lcov -o ./coverage/lcov.info -r json -o ./coverage/coverage.json -r console -o stdout'",
"test": "sh -c '. ./config/development.env; npm run lint && lab lib/controllers -P spec --ignore __core-js_shared__ '",
"coverage": "sh -c '. ./config/development.env; lab --threshold 68 -r html -o ./coverage/coverage.html -r lcov -o ./coverage/lcov.info -r json -o ./coverage/coverage.json -r console -o stdout'",
"start": "node service.js",
"dev": "nodemon service.js"
},
Expand All @@ -25,7 +25,7 @@
},
"devDependencies": {
"chai": "^4.0",
"lab": "5.15.2",
"lab": "14.x",
"nodemon": "1.11.0",
"pre-commit": "1.1.2",
"semistandard": "7.0.3",
Expand All @@ -45,12 +45,15 @@
"lodash": "3.7.0",
"moment": "2.10.3",
"newrelic": "1.21.1",
"pg": "4.4.0",
"postgrator": "2.5.0",
"camelcase": "^4.1.0",
"decamelize": "^1.2.0",
"pg": "5.1.0",
"postgrator": "2.8.1",
"sanitize-html": "1.14.1",
"seneca": "1.4.0",
"seneca-kue": "git://github.com/wardormeur/seneca-kue.git",
"seneca-postgresql-store": "1.1.3",
"seneca-postgresql-store": "2.3",
"seneca-store-query": "0.0.5",
"seneca-queue": "^0.3.0",
"shortid": "2.2.2",
"utils": "^0.3.1",
Expand Down
4 changes: 3 additions & 1 deletion service.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var seneca = require('seneca')(config);
var util = require('util');
var _ = require('lodash');
var store = require('seneca-postgresql-store');
var storeQuery = require('seneca-store-query');
var dgram = require('dgram');
var service = 'cp-events-service';
var sanitizeHtml = require('sanitize-html');
Expand Down Expand Up @@ -41,6 +42,7 @@ seneca.options.sanitizeTextArea = {
};
seneca.decorate('customValidatorLogFormatter', require('./lib/custom-validator-log-formatter'));
seneca.use(store, config['postgresql-store']);
seneca.use(storeQuery);
seneca.use(require('./lib/cd-events'), { logger: log.logger });
seneca.use(require('cp-permissions-plugin'), {
config: __dirname + '/config/permissions'
Expand Down Expand Up @@ -90,7 +92,7 @@ require('./migrate-psql-db.js')(function (err) {
client.close();
});

var escape = require('seneca-postgresql-store/lib/relational-util').escapeStr;
var escape = require('seneca-store-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 539924d

Please sign in to comment.