Skip to content

Commit

Permalink
Twing starts with node version 6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
noel-schenk committed Sep 19, 2019
1 parent fb9ffce commit 7804ab7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion test/consolidate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var cons = require('../');
var semver = require('semver');
/*eslint-env node*/
/*eslint quotes: [2, "single"] */
require('./shared').test('jade');
Expand Down Expand Up @@ -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');

0 comments on commit 7804ab7

Please sign in to comment.