diff --git a/CHANGES.md b/CHANGES.md index 76810f3..892fb9d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +2015-01-12, Version 2.6.1 +========================= + + * Fix "incompatible loopback version" check & msg (Miroslav Bajtoš) + + 2015-01-08, Version 2.6.0 ========================= diff --git a/lib/executor.js b/lib/executor.js index 0e151d5..a4f51b9 100644 --- a/lib/executor.js +++ b/lib/executor.js @@ -4,6 +4,7 @@ var semver = require('semver'); var debug = require('debug')('loopback:boot:executor'); var async = require('async'); var path = require('path'); +var format = require('util').format; /** * Execute bootstrap instructions gathered by `boot.compile`. @@ -73,12 +74,17 @@ function assertLoopBackVersion(app) { var RANGE = '1.x || 2.x'; var loopback = app.loopback; - if (!semver.satisfies(loopback.version || '1.0.0', RANGE)) { - throw new Error( - 'The `app` is powered by an incompatible loopback version %s. ' + - 'Supported versions: %s', - loopback.version || '(unknown)', + // remove any pre-release tag from the version string, + // because semver has special treatment of pre-release versions, + // while loopback-boot treats pre-releases the same way as regular versions + var version = (loopback.version || '1.0.0').replace(/-.*$/, ''); + if (!semver.satisfies(version, RANGE)) { + var msg = format( + 'The `app` is powered by an incompatible loopback version %s. ' + + 'Supported versions: %s', + loopback.version || '(unknown)', RANGE); + throw new Error(msg); } } diff --git a/package.json b/package.json index 3852a5b..d7b16bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopback-boot", - "version": "2.6.0", + "version": "2.6.1", "description": "Convention-based bootstrapper for LoopBack applications", "keywords": [ "StrongLoop",