feat: add notification about available new version

This commit is contained in:
Alex Varchuk 2022-07-27 17:15:01 +03:00
parent dcdab83890
commit 7e7b5e6b77
3 changed files with 1471 additions and 4 deletions

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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": {