mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-04 12:20:19 +03:00
feat: add notification about available new version
This commit is contained in:
parent
dcdab83890
commit
7e7b5e6b77
13
cli/index.ts
13
cli/index.ts
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env node
|
||||
/* tslint:disable:no-implicit-dependencies */
|
||||
import * as React from 'react';
|
||||
import * as updateNotifier from 'update-notifier';
|
||||
import { renderToString } from 'react-dom/server';
|
||||
import { ServerStyleSheet } from 'styled-components';
|
||||
|
||||
|
@ -111,6 +112,7 @@ const handlerForBuildCommand = async (argv: any) => {
|
|||
};
|
||||
|
||||
try {
|
||||
notifyUpdateCliVersion();
|
||||
await bundle(argv.spec, config);
|
||||
} catch (e) {
|
||||
handleError(e);
|
||||
|
@ -174,6 +176,7 @@ YargsParser.command(
|
|||
};
|
||||
|
||||
try {
|
||||
notifyUpdateCliVersion();
|
||||
await serve(argv.host as string, argv.port as number, argv.spec as string, config);
|
||||
} catch (e) {
|
||||
handleError(e);
|
||||
|
@ -468,3 +471,13 @@ function getObjectOrJSON(options) {
|
|||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
function notifyUpdateCliVersion() {
|
||||
const pkg = require('./package.json');
|
||||
const notifier = updateNotifier({
|
||||
pkg,
|
||||
updateCheckInterval: 0,
|
||||
shouldNotifyInNpmScript: true,
|
||||
});
|
||||
notifier.notify();
|
||||
}
|
||||
|
|
1461
cli/npm-shrinkwrap.json
generated
1461
cli/npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -21,6 +21,7 @@
|
|||
"react-dom": "^17.0.1",
|
||||
"redoc": "2.0.0-rc.72",
|
||||
"styled-components": "^5.3.0",
|
||||
"update-notifier": "^5.0.1",
|
||||
"yargs": "^17.3.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
|
Loading…
Reference in New Issue
Block a user