mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-28 11:33:43 +03:00
feat: add notification about new version available (#2100)
This commit is contained in:
parent
250f6d12b2
commit
d6ca8cc53b
8
.github/workflows/e2e-tests.yml
vendored
8
.github/workflows/e2e-tests.yml
vendored
|
@ -6,7 +6,7 @@ jobs:
|
|||
build-and-e2e:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: npm ci
|
||||
- run: npm run bundle
|
||||
- run: npm run e2e
|
||||
- uses: actions/checkout@v3
|
||||
- run: npm ci && npm ci --prefix cli
|
||||
- run: npm run bundle
|
||||
- run: npm run e2e
|
||||
|
|
16
cli/index.ts
16
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,16 @@ function getObjectOrJSON(options) {
|
|||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
function notifyUpdateCliVersion() {
|
||||
const pkg = require('./package.json');
|
||||
const notifier = updateNotifier({
|
||||
pkg,
|
||||
updateCheckInterval: 0,
|
||||
shouldNotifyInNpmScript: true,
|
||||
});
|
||||
notifier.notify({
|
||||
message:
|
||||
'Run `{updateCommand}` to update.\nChangelog: https://github.com/Redocly/redoc/releases/tag/{latestVersion}',
|
||||
});
|
||||
}
|
||||
|
|
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.74",
|
||||
"styled-components": "^5.3.0",
|
||||
"update-notifier": "^5.0.1",
|
||||
"yargs": "^17.3.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
|
Loading…
Reference in New Issue
Block a user