diff --git a/lib/consolidate.js b/lib/consolidate.js index 6a1199e..a46ecee 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -17,6 +17,7 @@ var fs = require('fs'); var path = require('path'); var Promise = require('bluebird'); +var semver = require('semver'); var join = path.join; var resolve = path.resolve; @@ -1771,6 +1772,11 @@ exports.twing = fromStringRenderer('twing'); */ exports.twing.render = function(str, options, cb) { + if(!semver.satisfies(process.version, '>=6.0.0')){ + return promisify(cb, function(cb) { + throw 'This node version is not supported for Twing. Please upgrade to at least node version 6.0.0 or a recommended version >=8.x'; + }); + } return promisify(cb, function(cb) { var engine = requires.twing || (requires.twing = require('twing')); try { diff --git a/package.json b/package.json index 62c2370..d884844 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "test": "mocha" }, "dependencies": { - "bluebird": "^3.1.1" + "bluebird": "^3.1.1", + "semver": "^6.3.0" }, "devDependencies": { "arc-templates": "^0.5.1", diff --git a/test/consolidate.js b/test/consolidate.js index defcac9..4df5af8 100644 --- a/test/consolidate.js +++ b/test/consolidate.js @@ -1,4 +1,5 @@ var cons = require('../'); +var semver = require('semver'); /*eslint-env node*/ /*eslint quotes: [2, "single"] */ require('./shared').test('jade'); @@ -72,4 +73,5 @@ require('./shared').test('razor'); require('./shared').test('squirrelly'); require('./shared/partials').test('squirrelly'); require('./shared/helpers').test('squirrelly'); -require('./shared').test('twing'); +if(semver.satisfies(process.version, '>=6.0.0')) + require('./shared').test('twing');