Skip to content

Commit

Permalink
Merge pull request #5107 from micuat/add-version-const
Browse files Browse the repository at this point in the history
get version constant from package.json
  • Loading branch information
lmccart authored Mar 20, 2021
2 parents aa1f8fe + cd609b1 commit a1ce015
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

const _PI = Math.PI;

/**
* Version of this p5.js.
* @property {String} VERSION
* @final
*/
export const VERSION =
'VERSION_CONST_WILL_BE_REPLACED_BY_BROWSERIFY_BUILD_PROCESS';

// GRAPHICS RENDERER
/**
* The default, two-dimensional renderer.
Expand Down
5 changes: 5 additions & 0 deletions tasks/build/browserify.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ module.exports = function(grunt) {
code += data;
})
.on('end', function() {
code = code.replace(
`'VERSION_CONST_WILL_BE_REPLACED_BY_BROWSERIFY_BUILD_PROCESS'`,
grunt.template.process(`'<%= pkg.version %>'`)
);

// "code" is complete: create the distributable UMD build by running
// the bundle through derequire
// (Derequire changes the bundle's internal "require" function to
Expand Down

0 comments on commit a1ce015

Please sign in to comment.