mirror of
https://github.com/Redocly/redoc.git
synced 2024-09-21 11:18:48 +03:00
chore(cli): Lint and prettify cli/index.ts (#1074)
This commit is contained in:
parent
41a9b3c182
commit
6d9a401b3b
13
cli/index.ts
13
cli/index.ts
|
@ -14,7 +14,14 @@ import * as zlib from 'zlib';
|
||||||
import { createStore, loadAndBundleSpec, Redoc } from 'redoc';
|
import { createStore, loadAndBundleSpec, Redoc } from 'redoc';
|
||||||
|
|
||||||
import { watch } from 'chokidar';
|
import { watch } from 'chokidar';
|
||||||
import { createReadStream, existsSync, readFileSync, ReadStream, writeFileSync, lstatSync } from 'fs';
|
import {
|
||||||
|
createReadStream,
|
||||||
|
existsSync,
|
||||||
|
lstatSync,
|
||||||
|
readFileSync,
|
||||||
|
ReadStream,
|
||||||
|
writeFileSync,
|
||||||
|
} from 'fs';
|
||||||
import * as mkdirp from 'mkdirp';
|
import * as mkdirp from 'mkdirp';
|
||||||
|
|
||||||
import * as YargsParser from 'yargs';
|
import * as YargsParser from 'yargs';
|
||||||
|
@ -196,7 +203,7 @@ async function serve(port: number, pathToSpec: string, options: Options = {}) {
|
||||||
const watcher = watch(pathToSpecDirectory, watchOptions);
|
const watcher = watch(pathToSpecDirectory, watchOptions);
|
||||||
const log = console.log.bind(console);
|
const log = console.log.bind(console);
|
||||||
|
|
||||||
const handlePath = async path => {
|
const handlePath = async _path => {
|
||||||
try {
|
try {
|
||||||
spec = await loadAndBundleSpec(pathToSpec);
|
spec = await loadAndBundleSpec(pathToSpec);
|
||||||
pageHTML = await getPageHTML(spec, pathToSpec, options);
|
pageHTML = await getPageHTML(spec, pathToSpec, options);
|
||||||
|
@ -368,7 +375,7 @@ function getObjectOrJSON(options) {
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(
|
console.log(
|
||||||
`Encountered error:\n\n${options}\n\nis neither a file with a valid JSON object neither a stringified JSON object.`
|
`Encountered error:\n\n${options}\n\nis neither a file with a valid JSON object neither a stringified JSON object.`,
|
||||||
);
|
);
|
||||||
handleError(e);
|
handleError(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
"bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:standalone",
|
"bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:standalone",
|
||||||
"declarations": "tsc --emitDeclarationOnly -p tsconfig.lib.json && cp -R src/types typings/",
|
"declarations": "tsc --emitDeclarationOnly -p tsconfig.lib.json && cp -R src/types typings/",
|
||||||
"stats": "webpack --env.standalone --json --profile --mode=production > stats.json",
|
"stats": "webpack --env.standalone --json --profile --mode=production > stats.json",
|
||||||
"prettier": "prettier --write \"src/**/*.{ts,tsx}\"",
|
"prettier": "prettier --write \"cli/index.ts\" \"src/**/*.{ts,tsx}\"",
|
||||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
|
||||||
"lint": "tslint --project tsconfig.json",
|
"lint": "tslint --project tsconfig.json",
|
||||||
"benchmark": "node ./benchmark/benchmark.js",
|
"benchmark": "node ./benchmark/benchmark.js",
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
"e2e/**"
|
"e2e/**"
|
||||||
],
|
],
|
||||||
"include": [
|
"include": [
|
||||||
|
"cli/index.ts",
|
||||||
"./custom.d.ts",
|
"./custom.d.ts",
|
||||||
"./demo/playground/hmr-playground.tsx",
|
"./demo/playground/hmr-playground.tsx",
|
||||||
"./src/**/*.ts?",
|
"./src/**/*.ts?",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user