mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-07 13:30:33 +03:00
Add version and revision to standalone bundle exports
This commit is contained in:
parent
57c424f6b5
commit
63dfdebf6a
2
custom.d.ts
vendored
2
custom.d.ts
vendored
|
@ -14,6 +14,8 @@ declare module '*.css' {
|
|||
}
|
||||
|
||||
declare var __DEV__: boolean;
|
||||
declare var __REDOC_VERSION__: string;
|
||||
declare var __REDOC_REVISION__: string;
|
||||
|
||||
declare type Dict<T> = {
|
||||
[key: string]: T;
|
||||
|
|
|
@ -3,6 +3,9 @@ import * as React from 'react';
|
|||
|
||||
import { RedocStandalone } from './components/RedocStandalone';
|
||||
|
||||
export const version = __REDOC_VERSION__;
|
||||
export const revision = __REDOC_REVISION__;
|
||||
|
||||
function attributesMap(element: Element) {
|
||||
var res = {};
|
||||
var elAttrs = element.attributes;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
"./custom.d.ts",
|
||||
"./demo/playground/hmr-playground.tsx",
|
||||
"./src/index.ts",
|
||||
"./src/standalone.tsx",
|
||||
"demo/*.tsx"
|
||||
],
|
||||
"awesomeTypescriptLoaderOptions": {
|
||||
|
|
|
@ -6,6 +6,14 @@ const nodeExternals = require('webpack-node-externals')({
|
|||
whitelist: ['swagger2openapi', 'reftools', /\.(?!(?:jsx?|json)$).{1,5}$/i],
|
||||
});
|
||||
|
||||
const VERSION = JSON.stringify(require('./package.json').version);
|
||||
const REVISION = JSON.stringify(
|
||||
require('child_process')
|
||||
.execSync('git rev-parse --short HEAD')
|
||||
.toString()
|
||||
.trim(),
|
||||
);
|
||||
|
||||
export default env => {
|
||||
env = env || {};
|
||||
|
||||
|
@ -101,6 +109,8 @@ export default env => {
|
|||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': env.prod ? '"production"' : '"development"',
|
||||
__REDOC_VERSION__: VERSION,
|
||||
__REDOC_REVISION__: REVISION,
|
||||
__DEV__: env.prod ? 'false' : 'true',
|
||||
}),
|
||||
new webpack.NamedModulesPlugin(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user