From e5af4c6bc332533bc4dbd240bf7c476c5578683d Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Thu, 21 Sep 2017 22:31:20 +0200 Subject: [PATCH] Add `grapesjs.version` --- index.html | 2 ++ package.json | 1 + src/grapesjs/index.js | 3 +++ webpack.config.js | 7 +++++++ yarn.lock | 9 ++++++++- 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 51a4ca956..b7e0b315f 100755 --- a/index.html +++ b/index.html @@ -1337,6 +1337,8 @@ }); editor.render(); + + console.log('version', grapesjs.version); diff --git a/package.json b/package.json index 37f8b99eb..d6e9a52ec 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "mocha": "^3.1.2", "node-sass": "^4.5.3", "sinon": "^3.2.1", + "string-replace-loader": "^1.3.0", "webpack": "^3.5.5", "webpack-dev-server": "^2.7.1" }, diff --git a/src/grapesjs/index.js b/src/grapesjs/index.js index a0b056d2a..8fb20022e 100644 --- a/src/grapesjs/index.js +++ b/src/grapesjs/index.js @@ -9,6 +9,9 @@ module.exports = (() => { return { + // Will be replaced on build + version: '<# VERSION #>', + editors, plugins, diff --git a/webpack.config.js b/webpack.config.js index 91b94c6aa..0f33bc9ea 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -35,6 +35,13 @@ module.exports = { plugins: plugins, module: { loaders: [{ + test: /grapesjs\/index\.js$/, + loader: 'string-replace-loader', + query: { + search: '<# VERSION #>', + replace: pkg.version + } + },{ test: /\.js$/, loader: 'babel-loader', include: /src/, diff --git a/yarn.lock b/yarn.lock index a50741d42..5b678eec3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3625,7 +3625,7 @@ lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" -lodash@^4.0.0, lodash@^4.11.1, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.3.0, lodash@~4.17.4: +lodash@^4, lodash@^4.0.0, lodash@^4.11.1, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.3.0, lodash@~4.17.4: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -5393,6 +5393,13 @@ stream-shift@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" +string-replace-loader@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string-replace-loader/-/string-replace-loader-1.3.0.tgz#1d404a7bf5e2ec21b08ffc76d89445fbe49bc01d" + dependencies: + loader-utils "^1.1.0" + lodash "^4" + string-template@~0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/string-template/-/string-template-0.2.1.tgz#42932e598a352d01fc22ec3367d9d84eec6c9add"