Skip to content

Commit a1ce015

Browse files
authored
Merge pull request #5107 from micuat/add-version-const
get version constant from package.json
2 parents aa1f8fe + cd609b1 commit a1ce015

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/core/constants.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66

77
const _PI = Math.PI;
88

9+
/**
10+
* Version of this p5.js.
11+
* @property {String} VERSION
12+
* @final
13+
*/
14+
export const VERSION =
15+
'VERSION_CONST_WILL_BE_REPLACED_BY_BROWSERIFY_BUILD_PROCESS';
16+
917
// GRAPHICS RENDERER
1018
/**
1119
* The default, two-dimensional renderer.

tasks/build/browserify.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ module.exports = function(grunt) {
7878
code += data;
7979
})
8080
.on('end', function() {
81+
code = code.replace(
82+
`'VERSION_CONST_WILL_BE_REPLACED_BY_BROWSERIFY_BUILD_PROCESS'`,
83+
grunt.template.process(`'<%= pkg.version %>'`)
84+
);
85+
8186
// "code" is complete: create the distributable UMD build by running
8287
// the bundle through derequire
8388
// (Derequire changes the bundle's internal "require" function to

0 commit comments

Comments
 (0)