mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-29 12:03:44 +03:00
Add version getter to ReDoc runtime
This commit is contained in:
parent
c80f13738f
commit
6f8ea60da7
|
@ -73,7 +73,7 @@ gulp.task('concatDeps', function() {
|
||||||
.pipe(gulp.dest('.'))
|
.pipe(gulp.dest('.'))
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('bundle', ['inlineTemplates'], function bundle(cb) {
|
gulp.task('bundle', ['injectVersionFile', 'inlineTemplates'], function bundle(cb) {
|
||||||
fs.existsSync('dist') || fs.mkdirSync('dist');
|
fs.existsSync('dist') || fs.mkdirSync('dist');
|
||||||
var builder = new Builder('./', 'system.config.js');
|
var builder = new Builder('./', 'system.config.js');
|
||||||
|
|
||||||
|
@ -122,3 +122,9 @@ gulp.task('concatPrism', function() {
|
||||||
.pipe(concat(path.join(paths.tmp, 'prismjs-bundle.js')))
|
.pipe(concat(path.join(paths.tmp, 'prismjs-bundle.js')))
|
||||||
.pipe(gulp.dest('.'))
|
.pipe(gulp.dest('.'))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// needs inlineTemplates run before to create .tmp/lib folder
|
||||||
|
gulp.task('injectVersionFile', ['inlineTemplates'], function() {
|
||||||
|
var version = require('../../package.json').version;
|
||||||
|
fs.writeFileSync(path.join(paths.tmp, 'lib/version.json'), JSON.stringify(version));
|
||||||
|
})
|
||||||
|
|
|
@ -5,6 +5,8 @@ import { bootstrap } from '@angular/platform-browser-dynamic';
|
||||||
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
|
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
|
||||||
import { RedocComponent, BaseComponent } from '../base';
|
import { RedocComponent, BaseComponent } from '../base';
|
||||||
|
|
||||||
|
import detectScollParent from 'scrollparent';
|
||||||
|
|
||||||
import { ApiInfo } from '../ApiInfo/api-info';
|
import { ApiInfo } from '../ApiInfo/api-info';
|
||||||
import { ApiLogo } from '../ApiLogo/api-logo';
|
import { ApiLogo } from '../ApiLogo/api-logo';
|
||||||
import { MethodsList } from '../MethodsList/methods-list';
|
import { MethodsList } from '../MethodsList/methods-list';
|
||||||
|
@ -13,8 +15,9 @@ import { SideMenu } from '../SideMenu/side-menu';
|
||||||
import { StickySidebar } from '../../shared/components/index';
|
import { StickySidebar } from '../../shared/components/index';
|
||||||
import SchemaManager from '../../utils/SchemaManager';
|
import SchemaManager from '../../utils/SchemaManager';
|
||||||
import { OptionsService, RedocEventsService } from '../../services/index';
|
import { OptionsService, RedocEventsService } from '../../services/index';
|
||||||
|
import redocVersion from '../../version.json!json';
|
||||||
|
|
||||||
|
|
||||||
import detectScollParent from 'scrollparent';
|
|
||||||
import './redoc-initial-styles.css!css';
|
import './redoc-initial-styles.css!css';
|
||||||
|
|
||||||
var dom = new BrowserDomAdapter();
|
var dom = new BrowserDomAdapter();
|
||||||
|
@ -118,6 +121,10 @@ export class Redoc extends BaseComponent {
|
||||||
redocEl.innerHTML = erroHtml;
|
redocEl.innerHTML = erroHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get version() {
|
||||||
|
return redocVersion;
|
||||||
|
}
|
||||||
|
|
||||||
static destroy() {
|
static destroy() {
|
||||||
let el = dom.query('redoc');
|
let el = dom.query('redoc');
|
||||||
let elClone;
|
let elClone;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user