mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-16 18:00:33 +03:00
fix(cli): create directories when a path is specified in the --output option (#513)
Fixes #512
This commit is contained in:
parent
bf57c4d14b
commit
ac7372be6f
|
@ -14,6 +14,7 @@ import * as zlib from 'zlib';
|
|||
import { createStore, loadAndBundleSpec, Redoc } from 'redoc';
|
||||
|
||||
import { createReadStream, existsSync, readFileSync, ReadStream, watch, writeFileSync } from 'fs';
|
||||
import * as mkdirp from 'mkdirp';
|
||||
|
||||
import * as YargsParser from 'yargs';
|
||||
|
||||
|
@ -186,6 +187,7 @@ async function bundle(pathToSpec, options: Options = {}) {
|
|||
const spec = await loadAndBundleSpec(pathToSpec);
|
||||
const pageHTML = await getPageHTML(spec, pathToSpec, { ...options, ssr: true });
|
||||
|
||||
mkdirp.sync(dirname(options.output!));
|
||||
writeFileSync(options.output!, pageHTML);
|
||||
const sizeInKiB = Math.ceil(Buffer.byteLength(pageHTML) / 1024);
|
||||
const time = Date.now() - start;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
"dependencies": {
|
||||
"handlebars": "^4.0.11",
|
||||
"isarray": "^2.0.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"react": "^16.3.2",
|
||||
"react-dom": "^16.3.2",
|
||||
"redoc": "^2.0.0-alpha.20",
|
||||
|
@ -24,6 +25,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/handlebars": "^4.0.36",
|
||||
"@types/mkdirp": "^0.5.2",
|
||||
"ci-publish": "^1.3.1"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,16 @@
|
|||
version "4.0.37"
|
||||
resolved "https://registry.yarnpkg.com/@types/handlebars/-/handlebars-4.0.37.tgz#a3bc3eba0c0f03f753cac00841a5b21e26a02c03"
|
||||
|
||||
"@types/mkdirp@^0.5.2":
|
||||
version "0.5.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-0.5.2.tgz#503aacfe5cc2703d5484326b1b27efa67a339c1f"
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/node@*":
|
||||
version "10.1.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.1.3.tgz#5c16980936c4e3c83ce64e8ed71fb37bd7aea135"
|
||||
|
||||
agent-base@2:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-2.1.1.tgz#d6de10d5af6132d5bd692427d46fc538539094c7"
|
||||
|
@ -1450,7 +1460,7 @@ minimist@~0.0.1:
|
|||
version "0.0.10"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"
|
||||
|
||||
mkdirp@^0.5.0:
|
||||
mkdirp@^0.5.0, mkdirp@^0.5.1:
|
||||
version "0.5.1"
|
||||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
|
||||
dependencies:
|
||||
|
|
Loading…
Reference in New Issue
Block a user