File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed
Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ var webpack = require('webpack')
44var ExtractTextPlugin = require ( 'extract-text-webpack-plugin' )
55var deepExtend = require ( 'deep-extend' )
66var autoprefixer = require ( 'autoprefixer' )
7+ const { gitDescribeSync} = require ( 'git-describe' )
8+
9+ var pkg = require ( './package.json' )
10+ const gitInfo = gitDescribeSync ( __dirname )
711
812var loadersByExtension = require ( './build-tools/loadersByExtension' )
913
@@ -66,6 +70,11 @@ module.exports = function(options) {
6670 NODE_ENV : specialOptions . minimize ? JSON . stringify ( 'production' ) : null ,
6771 WEBPACK_INLINE_STYLES : ! Boolean ( specialOptions . separateStylesheets )
6872 } ,
73+ 'buildInfo' : JSON . stringify ( {
74+ PACKAGE_VERSION : pkg . version ,
75+ GIT_COMMIT : gitInfo . hash ,
76+ GIT_DIRTY : gitInfo . dirty
77+ } )
6978 } ) )
7079
7180 var cssLoader = 'css-loader!postcss-loader'
Original file line number Diff line number Diff line change 7272 "eslint-plugin-react" : " ^4.3.0" ,
7373 "extract-text-webpack-plugin" : " 0.8.2" ,
7474 "file-loader" : " 0.8.4" ,
75+ "git-describe" : " ^4.0.1" ,
7576 "html-webpack-plugin" : " ^2.28.0" ,
7677 "http-server" : " ^0.9.0" ,
7778 "imports-loader" : " 0.6.5" ,
Original file line number Diff line number Diff line change @@ -8,6 +8,12 @@ import LocalStoragePlugin from "./plugins/local-storage"
88import TopBarPlugin from "./plugins/topbar"
99import ValidationApiPlugin from "./plugins/validation/apis"
1010
11+ // eslint-disable-next-line no-undef
12+ const { GIT_DIRTY , GIT_COMMIT , PACKAGE_VERSION } = buildInfo
13+
14+ window . versions = window . versions || { }
15+ window . versions . swaggerEditor = `${ PACKAGE_VERSION } /${ GIT_COMMIT || "unknown" } ${ GIT_DIRTY ? "-dirty" : "" } `
16+
1117const defaults = {
1218 dom_id : "#swagger-editor" ,
1319 layout : "EditorLayout" ,
You can’t perform that action at this time.
0 commit comments