Skip to content

Commit 123430e

Browse files
committed
Hardcode version string in src/raven.js (fixes GH-465)
1 parent d73f9f8 commit 123430e

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

Gruntfile.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,16 @@ module.exports = function(grunt) {
261261
// Custom Grunt tasks
262262
grunt.registerTask('version', function() {
263263
var pkg = grunt.config.get('pkg');
264+
265+
// Verify version string in source code matches what's in package.json
266+
var Raven = require('./src/raven');
267+
if (Raven.prototype.VERSION !== pkg.version) {
268+
return grunt.util.error('Mismatched version in src/raven.js: ' + Raven.prototype.VERSION +
269+
' (should be ' + pkg.version + ')');
270+
}
271+
264272
if (grunt.option('dev')) {
265273
pkg.release = 'dev';
266-
pkg.version = grunt.config.get('gitinfo').local.branch.current.shortSHA;
267274
} else {
268275
pkg.release = pkg.version;
269276
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"type": "git",
1212
"url": "git://github.com/getsentry/raven-js.git"
1313
},
14-
"main": "dist/raven.js",
14+
"main": "src/singleton.js",
1515
"devDependencies": {
1616
"browserify-versionify": "^1.0.6",
1717
"chai": "2.3.0",

src/raven.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ function Raven() {
6868
*/
6969

7070
Raven.prototype = {
71-
VERSION: '__VERSION__',
71+
// Hardcode version string so that raven source can be loaded directly via
72+
// webpack (using a build step causes webpack #1617). Grunt verifies that
73+
// this value matches package.json during build.
74+
// See: https://github.com/getsentry/raven-js/issues/465
75+
VERSION: '2.0.0',
7276

7377
debug: false,
7478

0 commit comments

Comments
 (0)