Skip to content

Commit

Permalink
Hardcode version string in src/raven.js (fixes GH-465)
Browse files Browse the repository at this point in the history
  • Loading branch information
benvinegar committed Jan 12, 2016
1 parent d73f9f8 commit 123430e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
9 changes: 8 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/raven.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down

0 comments on commit 123430e

Please sign in to comment.