Merge branch 'master' into bug/update-dev-dependencies
This commit is contained in:
@@ -52,6 +52,7 @@ module.exports = function(rules, options) {
|
||||
hot: false,
|
||||
separateStylesheets: true,
|
||||
minimize: false,
|
||||
mangle: false,
|
||||
longTermCaching: false,
|
||||
sourcemaps: false,
|
||||
}, options._special)
|
||||
@@ -69,6 +70,10 @@ module.exports = function(rules, options) {
|
||||
|
||||
plugins.push(
|
||||
new UglifyJsPlugin({
|
||||
uglifyOptions: {
|
||||
mangle: specialOptions.mangle,
|
||||
beautify: !specialOptions.mangle,
|
||||
},
|
||||
sourceMap: true,
|
||||
}),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import React from "react"
|
||||
import URL from "url-parse"
|
||||
|
||||
import PropTypes from "prop-types"
|
||||
import { sanitizeUrl } from "core/utils"
|
||||
import win from "core/window"
|
||||
|
||||
export default class OnlineValidatorBadge extends React.Component {
|
||||
static propTypes = {
|
||||
@@ -11,20 +14,28 @@ export default class OnlineValidatorBadge extends React.Component {
|
||||
|
||||
constructor(props, context) {
|
||||
super(props, context)
|
||||
let { specSelectors, getConfigs } = props
|
||||
let { getConfigs } = props
|
||||
let { validatorUrl } = getConfigs()
|
||||
this.state = {
|
||||
url: specSelectors.url(),
|
||||
url: this.getDefinitionUrl(),
|
||||
validatorUrl: validatorUrl === undefined ? "https://online.swagger.io/validator" : validatorUrl
|
||||
}
|
||||
}
|
||||
|
||||
getDefinitionUrl = () => {
|
||||
// TODO: test this behavior by stubbing `window.location` in an Enzyme/JSDom env
|
||||
let { specSelectors } = this.props
|
||||
|
||||
const urlObject = new URL(specSelectors.url(), win.location)
|
||||
return urlObject.toString()
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
let { specSelectors, getConfigs } = nextProps
|
||||
let { getConfigs } = nextProps
|
||||
let { validatorUrl } = getConfigs()
|
||||
|
||||
this.setState({
|
||||
url: specSelectors.url(),
|
||||
url: this.getDefinitionUrl(),
|
||||
validatorUrl: validatorUrl === undefined ? "https://online.swagger.io/validator" : validatorUrl
|
||||
})
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ module.exports = require("./make-webpack-config.js")(rules, {
|
||||
_special: {
|
||||
separateStylesheets: true,
|
||||
minimize: true,
|
||||
mangle: true,
|
||||
sourcemaps: true,
|
||||
},
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ module.exports = require("./make-webpack-config.js")(rules, {
|
||||
_special: {
|
||||
separateStylesheets: true,
|
||||
minimize: true,
|
||||
mangle: true,
|
||||
sourcemaps: true,
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user