Skip to content

Commit

Permalink
Add Shiny.version to Javascript (#1826)
Browse files Browse the repository at this point in the history
* Add Shiny.version to Javascript

* Grunt
  • Loading branch information
wch committed Aug 23, 2017
1 parent 587bf94 commit 4f3d26c
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 15 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Expand Up @@ -9,6 +9,8 @@ shiny 1.0.5.9000

### Minor new features and improvements

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

### Bug fixes

### Library updates
Expand Down
16 changes: 9 additions & 7 deletions inst/www/shared/shiny.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions inst/www/shared/shiny.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny.min.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions srcjs/_start.js
Expand Up @@ -3,6 +3,8 @@

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

exports.version = "{{ VERSION }}"; // Version number inserted by Grunt

var origPushState = window.history.pushState;
window.history.pushState = function() {
var result = origPushState.apply(this, arguments);
Expand Down
16 changes: 16 additions & 0 deletions tools/Gruntfile.js
Expand Up @@ -74,6 +74,20 @@ module.exports = function(grunt) {
},
},

"string-replace": {
version: {
files: {
'temp_concat/': './temp_concat/shiny.js'
},
options: {
replacements: [{
pattern: /{{ VERSION }}/g,
replacement: pkgInfo().version
}]
}
}
},

babel: {
options: {
sourceMap: true,
Expand Down Expand Up @@ -174,6 +188,7 @@ module.exports = function(grunt) {

grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-string-replace');
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-contrib-uglify');
Expand All @@ -191,6 +206,7 @@ module.exports = function(grunt) {

grunt.registerTask('default', [
'newer:concat',
'newer:string-replace',
'newer:eslint',
'configureBabel',
'newer:babel',
Expand Down
3 changes: 2 additions & 1 deletion tools/package.json
Expand Up @@ -11,6 +11,7 @@
"grunt-contrib-uglify": "1.0.1",
"grunt-contrib-watch": "^1.0.0",
"grunt-eslint": "^18.0.0",
"grunt-newer": "^1.1.2"
"grunt-newer": "^1.1.2",
"grunt-string-replace": "^1.3.1"
}
}
15 changes: 14 additions & 1 deletion tools/yarn.lock
Expand Up @@ -83,6 +83,12 @@ async@^1.5.0, async@^1.5.2, async@~1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"

async@^2.0.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/async/-/async-2.5.0.tgz#843190fd6b7357a0b9e1c956edddd5ec8462b54d"
dependencies:
lodash "^4.14.0"

async@~0.2.6:
version "0.2.10"
resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
Expand Down Expand Up @@ -1120,6 +1126,13 @@ grunt-newer@^1.1.2:
async "^1.5.2"
rimraf "^2.5.2"

grunt-string-replace@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/grunt-string-replace/-/grunt-string-replace-1.3.1.tgz#633a03bc78482a0e0e1f9df7f645811fc1fbb162"
dependencies:
async "^2.0.0"
chalk "^1.0.0"

grunt@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/grunt/-/grunt-1.0.1.tgz#e8778764e944b18f32bb0f10b9078475c9dfb56b"
Expand Down Expand Up @@ -1386,7 +1399,7 @@ lodash@^3.10.1, lodash@~3.10.1:
version "3.10.1"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"

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

Expand Down

0 comments on commit 4f3d26c

Please sign in to comment.