Skip to content

Commit

Permalink
Merge pull request #91 from yokuze/yokuze/fix_install_from_git_hash_i…
Browse files Browse the repository at this point in the history
…ssue

build: prevent error thrown when installed from a git URL
  • Loading branch information
onebytegone authored Dec 27, 2022
2 parents c416a31 + 738a1b2 commit a40e9a6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ const sass = require('sass');
module.exports = function(grunt) {

var DEBUG = !!grunt.option('debug'),
config;
pkgJSON = grunt.file.readJSON('package.json'),
config, versionInfo;

try {
versionInfo = getCodeVersion.both();
} catch(e) {
// When this package is installed as a git URL, getCodeVersion throws an error and
// is not able to find the git version for this package. So, we fall back to using
// the version number from package.json
versionInfo = pkgJSON.version;
}

config = {
js: {
Expand Down Expand Up @@ -41,8 +51,8 @@ module.exports = function(grunt) {

grunt.initConfig({

pkg: grunt.file.readJSON('package.json'),
versionInfo: getCodeVersion.both(),
pkg: pkgJSON,
versionInfo: versionInfo,
config: config,

browserify: {
Expand Down

0 comments on commit a40e9a6

Please sign in to comment.