Skip to content

Commit 4f3d26c

Browse files
authored
Add Shiny.version to Javascript (rstudio#1826)
* Add Shiny.version to Javascript * Grunt
1 parent 587bf94 commit 4f3d26c

File tree

9 files changed

+51
-15
lines changed

9 files changed

+51
-15
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ shiny 1.0.5.9000
99

1010
### Minor new features and improvements
1111

12+
* The version of Shiny is now accessible from Javascript, with `Shiny.version`. ([#1826](https://github.com/rstudio/shiny/pull/1826))
13+
1214
### Bug fixes
1315

1416
### Library updates

inst/www/shared/shiny.js

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/www/shared/shiny.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/www/shared/shiny.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/www/shared/shiny.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

srcjs/_start.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
var exports = window.Shiny = window.Shiny || {};
55

6+
exports.version = "{{ VERSION }}"; // Version number inserted by Grunt
7+
68
var origPushState = window.history.pushState;
79
window.history.pushState = function() {
810
var result = origPushState.apply(this, arguments);

tools/Gruntfile.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,20 @@ module.exports = function(grunt) {
7474
},
7575
},
7676

77+
"string-replace": {
78+
version: {
79+
files: {
80+
'temp_concat/': './temp_concat/shiny.js'
81+
},
82+
options: {
83+
replacements: [{
84+
pattern: /{{ VERSION }}/g,
85+
replacement: pkgInfo().version
86+
}]
87+
}
88+
}
89+
},
90+
7791
babel: {
7892
options: {
7993
sourceMap: true,
@@ -174,6 +188,7 @@ module.exports = function(grunt) {
174188

175189
grunt.loadNpmTasks('grunt-contrib-clean');
176190
grunt.loadNpmTasks('grunt-contrib-concat');
191+
grunt.loadNpmTasks('grunt-string-replace');
177192
grunt.loadNpmTasks('grunt-babel');
178193
grunt.loadNpmTasks('grunt-eslint');
179194
grunt.loadNpmTasks('grunt-contrib-uglify');
@@ -191,6 +206,7 @@ module.exports = function(grunt) {
191206

192207
grunt.registerTask('default', [
193208
'newer:concat',
209+
'newer:string-replace',
194210
'newer:eslint',
195211
'configureBabel',
196212
'newer:babel',

tools/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"grunt-contrib-uglify": "1.0.1",
1212
"grunt-contrib-watch": "^1.0.0",
1313
"grunt-eslint": "^18.0.0",
14-
"grunt-newer": "^1.1.2"
14+
"grunt-newer": "^1.1.2",
15+
"grunt-string-replace": "^1.3.1"
1516
}
1617
}

tools/yarn.lock

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ async@^1.5.0, async@^1.5.2, async@~1.5.2:
8383
version "1.5.2"
8484
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
8585

86+
async@^2.0.0:
87+
version "2.5.0"
88+
resolved "https://registry.yarnpkg.com/async/-/async-2.5.0.tgz#843190fd6b7357a0b9e1c956edddd5ec8462b54d"
89+
dependencies:
90+
lodash "^4.14.0"
91+
8692
async@~0.2.6:
8793
version "0.2.10"
8894
resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
@@ -1120,6 +1126,13 @@ grunt-newer@^1.1.2:
11201126
async "^1.5.2"
11211127
rimraf "^2.5.2"
11221128

1129+
grunt-string-replace@^1.3.1:
1130+
version "1.3.1"
1131+
resolved "https://registry.yarnpkg.com/grunt-string-replace/-/grunt-string-replace-1.3.1.tgz#633a03bc78482a0e0e1f9df7f645811fc1fbb162"
1132+
dependencies:
1133+
async "^2.0.0"
1134+
chalk "^1.0.0"
1135+
11231136
grunt@^1.0.1:
11241137
version "1.0.1"
11251138
resolved "https://registry.yarnpkg.com/grunt/-/grunt-1.0.1.tgz#e8778764e944b18f32bb0f10b9078475c9dfb56b"
@@ -1386,7 +1399,7 @@ lodash@^3.10.1, lodash@~3.10.1:
13861399
version "3.10.1"
13871400
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
13881401

1389-
lodash@^4.0.0, lodash@^4.0.1, lodash@^4.2.0, lodash@^4.3.0:
1402+
lodash@^4.0.0, lodash@^4.0.1, lodash@^4.14.0, lodash@^4.2.0, lodash@^4.3.0:
13901403
version "4.16.4"
13911404
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.16.4.tgz#01ce306b9bad1319f2a5528674f88297aeb70127"
13921405

0 commit comments

Comments
 (0)