diff --git a/Gruntfile.js b/Gruntfile.js index 3cf7579ea531..50ac5fe38a5c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -261,9 +261,16 @@ module.exports = function(grunt) { // Custom Grunt tasks grunt.registerTask('version', function() { var pkg = grunt.config.get('pkg'); + + // Verify version string in source code matches what's in package.json + var Raven = require('./src/raven'); + if (Raven.prototype.VERSION !== pkg.version) { + return grunt.util.error('Mismatched version in src/raven.js: ' + Raven.prototype.VERSION + + ' (should be ' + pkg.version + ')'); + } + if (grunt.option('dev')) { pkg.release = 'dev'; - pkg.version = grunt.config.get('gitinfo').local.branch.current.shortSHA; } else { pkg.release = pkg.version; } diff --git a/package.json b/package.json index 903bb3aff448..48d8c841941d 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "type": "git", "url": "git://github.com/getsentry/raven-js.git" }, - "main": "dist/raven.js", + "main": "src/singleton.js", "devDependencies": { "browserify-versionify": "^1.0.6", "chai": "2.3.0", diff --git a/src/raven.js b/src/raven.js index f7374244ef41..c4326d4d588a 100644 --- a/src/raven.js +++ b/src/raven.js @@ -68,7 +68,11 @@ function Raven() { */ Raven.prototype = { - VERSION: '__VERSION__', + // Hardcode version string so that raven source can be loaded directly via + // webpack (using a build step causes webpack #1617). Grunt verifies that + // this value matches package.json during build. + // See: https://github.com/getsentry/raven-js/issues/465 + VERSION: '2.0.0', debug: false,