mirror of
https://github.com/Redocly/redoc.git
synced 2025-06-29 08:43:03 +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 __DEV__: boolean;
|
||||||
|
declare var __REDOC_VERSION__: string;
|
||||||
|
declare var __REDOC_REVISION__: string;
|
||||||
|
|
||||||
declare type Dict<T> = {
|
declare type Dict<T> = {
|
||||||
[key: string]: T;
|
[key: string]: T;
|
||||||
|
|
|
@ -3,6 +3,9 @@ import * as React from 'react';
|
||||||
|
|
||||||
import { RedocStandalone } from './components/RedocStandalone';
|
import { RedocStandalone } from './components/RedocStandalone';
|
||||||
|
|
||||||
|
export const version = __REDOC_VERSION__;
|
||||||
|
export const revision = __REDOC_REVISION__;
|
||||||
|
|
||||||
function attributesMap(element: Element) {
|
function attributesMap(element: Element) {
|
||||||
var res = {};
|
var res = {};
|
||||||
var elAttrs = element.attributes;
|
var elAttrs = element.attributes;
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
"./custom.d.ts",
|
"./custom.d.ts",
|
||||||
"./demo/playground/hmr-playground.tsx",
|
"./demo/playground/hmr-playground.tsx",
|
||||||
"./src/index.ts",
|
"./src/index.ts",
|
||||||
|
"./src/standalone.tsx",
|
||||||
"demo/*.tsx"
|
"demo/*.tsx"
|
||||||
],
|
],
|
||||||
"awesomeTypescriptLoaderOptions": {
|
"awesomeTypescriptLoaderOptions": {
|
||||||
|
|
|
@ -6,6 +6,14 @@ const nodeExternals = require('webpack-node-externals')({
|
||||||
whitelist: ['swagger2openapi', 'reftools', /\.(?!(?:jsx?|json)$).{1,5}$/i],
|
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 => {
|
export default env => {
|
||||||
env = env || {};
|
env = env || {};
|
||||||
|
|
||||||
|
@ -101,6 +109,8 @@ export default env => {
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env.NODE_ENV': env.prod ? '"production"' : '"development"',
|
'process.env.NODE_ENV': env.prod ? '"production"' : '"development"',
|
||||||
|
__REDOC_VERSION__: VERSION,
|
||||||
|
__REDOC_REVISION__: REVISION,
|
||||||
__DEV__: env.prod ? 'false' : 'true',
|
__DEV__: env.prod ? 'false' : 'true',
|
||||||
}),
|
}),
|
||||||
new webpack.NamedModulesPlugin(),
|
new webpack.NamedModulesPlugin(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user