mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-25 01:53:44 +03:00
feat: add notification about new version available (#2100)
This commit is contained in:
parent
250f6d12b2
commit
d6ca8cc53b
2
.github/workflows/e2e-tests.yml
vendored
2
.github/workflows/e2e-tests.yml
vendored
|
@ -7,6 +7,6 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run: npm ci
|
- run: npm ci && npm ci --prefix cli
|
||||||
- run: npm run bundle
|
- run: npm run bundle
|
||||||
- run: npm run e2e
|
- run: npm run e2e
|
||||||
|
|
16
cli/index.ts
16
cli/index.ts
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
/* tslint:disable:no-implicit-dependencies */
|
/* tslint:disable:no-implicit-dependencies */
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import * as updateNotifier from 'update-notifier';
|
||||||
import { renderToString } from 'react-dom/server';
|
import { renderToString } from 'react-dom/server';
|
||||||
import { ServerStyleSheet } from 'styled-components';
|
import { ServerStyleSheet } from 'styled-components';
|
||||||
|
|
||||||
|
@ -111,6 +112,7 @@ const handlerForBuildCommand = async (argv: any) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
notifyUpdateCliVersion();
|
||||||
await bundle(argv.spec, config);
|
await bundle(argv.spec, config);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
handleError(e);
|
handleError(e);
|
||||||
|
@ -174,6 +176,7 @@ YargsParser.command(
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
notifyUpdateCliVersion();
|
||||||
await serve(argv.host as string, argv.port as number, argv.spec as string, config);
|
await serve(argv.host as string, argv.port as number, argv.spec as string, config);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
handleError(e);
|
handleError(e);
|
||||||
|
@ -468,3 +471,16 @@ function getObjectOrJSON(options) {
|
||||||
return {};
|
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",
|
"react-dom": "^17.0.1",
|
||||||
"redoc": "2.0.0-rc.74",
|
"redoc": "2.0.0-rc.74",
|
||||||
"styled-components": "^5.3.0",
|
"styled-components": "^5.3.0",
|
||||||
|
"update-notifier": "^5.0.1",
|
||||||
"yargs": "^17.3.1"
|
"yargs": "^17.3.1"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user