Skip to content

Commit

Permalink
Merge pull request #418 from vivliostyle/epub
Browse files Browse the repository at this point in the history
feat: Add EPUB for output option
  • Loading branch information
spring-raining authored Jul 24, 2023
2 parents 63b7662 + 30ed466 commit ba2e7f7
Show file tree
Hide file tree
Showing 62 changed files with 4,813 additions and 2,944 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
node-version: ${{ matrix.node }}
- run: yarn install
- run: yarn playwright-core install chromium
- run: yarn build
- run: yarn test
build-and-push-image:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/examples
/vendors/index.js
178 changes: 90 additions & 88 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Options:
-l, --language <language> language
-s, --size <size> paper size
-T, --theme <theme> theme
--log-level <level> specify a log level of console outputs (choices: "silent", "info",
"verbose", "debug", default: "info")
-h, --help display help for command
```

Expand All @@ -68,58 +70,57 @@ vivliostyle build

```
Options:
-c, --config <config_file> path to vivliostyle.config.js [vivliostyle.config.js]
-o, --output <path> specify output file name or directory [<title>.pdf]
This option can be specified multiple, then each -o options
can be supplied one -f option.
ex: -o output1 -f webpub -o output2.pdf -f pdf
-f, --format <format> specify output format corresponding output target
If an extension is specified on -o option, this field will be
inferenced automatically.
-s, --size <size> output pdf size
preset: A5, A4, A3, B5, B4, JIS-B5, JIS-B4, letter, legal,
ledger
custom(comma separated): 182mm,257mm or 8.5in,11in
-m, --crop-marks print crop marks
--bleed <bleed> extent of the bleed area for printing with crop marks [3mm]
--crop-offset <offset> distance between the edge of the trim size and the edge of
the media size. [auto (13mm + bleed)]
--css <CSS> custom style CSS code. (ex: ":root {--my-color: lime;}")
--style <stylesheet> additional stylesheet URL or path
--user-style <user_stylesheet> user stylesheet URL or path
-d, --single-doc single HTML document input
-p, --press-ready make generated PDF compatible with press ready PDF/X-1a
[false]
This option is equivalent with "--preflight press-ready"
-t, --timeout <seconds> timeout limit for waiting Vivliostyle process [120]
-T, --theme <theme> theme path or package name
--title <title> title
--author <author> author
-l, --language <language> language
--render-mode <mode> if docker is set, Vivliostyle try to render PDF on Docker
container [local] (choices: "local", "docker")
--preflight <mode> apply the process to generate PDF for printing (choices:
"press-ready", "press-ready-local")
--preflight-option <options...> options for preflight process (ex: gray-scale,
enforce-outline)
Please refer the document of press-ready for further
information.
https://github.com/vibranthq/press-ready
--verbose verbose log output
--no-sandbox launch chrome without sandbox. use this option when
ECONNREFUSED error occurred.
--executable-browser <path> specify a path of executable browser you installed
--image <image> specify a docker image to render
--http launch an HTTP server hosting contents instead of file
protocol
It is useful that requires CORS such as external web fonts.
--viewer <URL> specify a URL of displaying viewer instead of
vivliostyle-cli's one
It is useful that using own viewer that has staging features.
(ex: https://vivliostyle.vercel.app/)
--viewer-param <parameters> specify viewer parameters.
(ex: "allowScripts=false&pixelRatio=16")
-h, --help display help for command
-c, --config <config_file> path to vivliostyle.config.js [vivliostyle.config.js]
-o, --output <path> specify output file name or directory [<title>.pdf]
This option can be specified multiple, then each -o options can
be supplied one -f option.
ex: -o output1 -f webpub -o output2.pdf -f pdf
-f, --format <format> specify output format corresponding output target
If an extension is specified on -o option, this field will be
inferenced automatically.
-s, --size <size> output pdf size
preset: A5, A4, A3, B5, B4, JIS-B5, JIS-B4, letter, legal,
ledger
custom(comma separated): 182mm,257mm or 8.5in,11in
-m, --crop-marks print crop marks
--bleed <bleed> extent of the bleed area for printing with crop marks [3mm]
--crop-offset <offset> distance between the edge of the trim size and the edge of the
media size. [auto (13mm + bleed)]
--css <CSS> custom style CSS code. (ex: ":root {--my-color: lime;}")
--style <stylesheet> additional stylesheet URL or path
--user-style <user_stylesheet> user stylesheet URL or path
-d, --single-doc single HTML document input
-p, --press-ready make generated PDF compatible with press ready PDF/X-1a [false]
This option is equivalent with "--preflight press-ready"
-t, --timeout <seconds> timeout limit for waiting Vivliostyle process [120]
-T, --theme <theme> theme path or package name
--title <title> title
--author <author> author
-l, --language <language> language
--reading-progression <direction> Direction of reading progression (choices: "ltr", "rtl")
--render-mode <mode> if docker is set, Vivliostyle try to render PDF on Docker
container [local] (choices: "local", "docker")
--preflight <mode> apply the process to generate PDF for printing (choices:
"press-ready", "press-ready-local")
--preflight-option <options...> options for preflight process (ex: gray-scale, enforce-outline)
Please refer the document of press-ready for further
information.
https://github.com/vibranthq/press-ready
--no-sandbox launch chrome without sandbox. use this option when
ECONNREFUSED error occurred.
--executable-browser <path> specify a path of executable browser you installed
--image <image> specify a docker image to render
--http launch an HTTP server hosting contents instead of file protocol
It is useful that requires CORS such as external web fonts.
--viewer <URL> specify a URL of displaying viewer instead of vivliostyle-cli's
one
It is useful that using own viewer that has staging features.
(ex: https://vivliostyle.vercel.app/)
--viewer-param <parameters> specify viewer parameters. (ex:
"allowScripts=false&pixelRatio=16")
--log-level <level> specify a log level of console outputs (choices: "silent",
"info", "verbose", "debug", default: "info")
-h, --help display help for command
```

### `preview`
Expand All @@ -134,42 +135,43 @@ vivliostyle preview

```
Options:
-c, --config <config_file> path to vivliostyle.config.js
-T, --theme <theme> theme path or package name
-s, --size <size> output pdf size
preset: A5, A4, A3, B5, B4, JIS-B5, JIS-B4, letter, legal,
ledger
custom(comma separated): 182mm,257mm or 8.5in,11in
-m, --crop-marks print crop marks
--bleed <bleed> extent of the bleed area for printing with crop marks [3mm]
--crop-offset <offset> distance between the edge of the trim size and the edge of
the media size. [auto (13mm + bleed)]
--css <CSS> custom style CSS code. (ex: ":root {--my-color: lime;}")
--style <stylesheet> additional stylesheet URL or path
--user-style <user_stylesheet> user stylesheet URL or path
-d, --single-doc single HTML document input
-q, --quick quick loading with rough page count
--title <title> title
--author <author> author
-l, --language <language> language
--verbose verbose log output
--no-sandbox launch chrome without sandbox (use this option to avoid
ECONNREFUSED error)
--executable-browser <path> specify a path of executable browser you installed
--http launch an HTTP server hosting contents instead of file
protocol
It is useful that requires CORS such as external web fonts.
--viewer <URL> specify a URL of displaying viewer instead of
vivliostyle-cli's one
It is useful that using own viewer that has staging features.
(ex: https://vivliostyle.vercel.app/)
--viewer-param <parameters> specify viewer parameters.
(ex: "allowScripts=false&pixelRatio=16")
--browser <browser> EXPERIMENTAL SUPPORT: Specify a browser type to launch
Vivliostyle viewer [chromium]
Currently, Firefox and Webkit support preview command only!
(choices: "chromium", "firefox", "webkit")
-h, --help display help for command
-c, --config <config_file> path to vivliostyle.config.js
-T, --theme <theme> theme path or package name
-s, --size <size> output pdf size
preset: A5, A4, A3, B5, B4, JIS-B5, JIS-B4, letter, legal,
ledger
custom(comma separated): 182mm,257mm or 8.5in,11in
-m, --crop-marks print crop marks
--bleed <bleed> extent of the bleed area for printing with crop marks [3mm]
--crop-offset <offset> distance between the edge of the trim size and the edge of the
media size. [auto (13mm + bleed)]
--css <CSS> custom style CSS code. (ex: ":root {--my-color: lime;}")
--style <stylesheet> additional stylesheet URL or path
--user-style <user_stylesheet> user stylesheet URL or path
-d, --single-doc single HTML document input
-q, --quick quick loading with rough page count
--title <title> title
--author <author> author
-l, --language <language> language
--reading-progression <direction> Direction of reading progression (choices: "ltr", "rtl")
--no-sandbox launch chrome without sandbox (use this option to avoid
ECONNREFUSED error)
--executable-browser <path> specify a path of executable browser you installed
--http launch an HTTP server hosting contents instead of file protocol
It is useful that requires CORS such as external web fonts.
--viewer <URL> specify a URL of displaying viewer instead of vivliostyle-cli's
one
It is useful that using own viewer that has staging features.
(ex: https://vivliostyle.vercel.app/)
--viewer-param <parameters> specify viewer parameters. (ex:
"allowScripts=false&pixelRatio=16")
--browser <browser> EXPERIMENTAL SUPPORT: Specify a browser type to launch
Vivliostyle viewer [chromium]
Currently, Firefox and Webkit support preview command only!
(choices: "chromium", "firefox", "webkit")
--log-level <level> specify a log level of console outputs (choices: "silent",
"info", "verbose", "debug", default: "info")
-h, --help display help for command
```

## User Guide
Expand Down
24 changes: 0 additions & 24 deletions jest.config.js

This file was deleted.

42 changes: 29 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,32 @@
"author": "spring_raining <[email protected]>",
"type": "module",
"scripts": {
"build": "yarn clean && run-p build:*",
"build": "yarn clean && run-s build:*",
"build:vendors": "node vendors/build.js",
"build:cli": "tsc && shx chmod +x dist/cli.js",
"generate:schema": "run-p generate:schema:*",
"generate:schema:pubManifest": "json2ts -i schemas/pubManifest/publication.schema.json -o src/schema/publication.schema.ts --cwd schemas/pubManifest",
"generate:schema:vivliostyleConfig": "json2ts -i schemas/vivliostyle/vivliostyleConfig.schema.json -o src/schema/vivliostyleConfig.schema.ts --cwd schemas/vivliostyle",
"clean": "shx rm -rf dist tmp",
"dev": "run-p dev:*",
"dev:vendors": "node vendors/build.js -w",
"dev:cli": "tsc -w --preserveWatchOutput",
"example": "yarn --cwd example build",
"pretest": "yarn build && playwright-core install chromium",
"pretest": "playwright-core install chromium",
"release": "release-it",
"release:pre": "release-it --preRelease --npm.tag=next",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage"
"test": "vitest run --coverage"
},
"dependencies": {
"@napi-rs/canvas": "0.1.41",
"@npmcli/arborist": "^6.1.3",
"@vivliostyle/jsdom": "22.1.0-vivliostyle-cli.1",
"@vivliostyle/vfm": "2.1.0",
"@vivliostyle/viewer": "2.25.2",
"ajv": "^8.11.2",
"ajv-formats": "^2.1.1",
"archiver": "^5.3.1",
"bcp-47-match": "^2.0.3",
"better-ajv-errors": "^1.2.0",
"chalk": "^4.1.2",
"cheerio": "^1.0.0-rc.10",
Expand All @@ -36,6 +42,7 @@
"execa": "^5.1.1",
"fast-glob": "3.2.12",
"fast-xml-parser": "^4.2.4",
"github-slugger": "^1.4.0",
"globby": "13.1.2",
"hast-util-to-html": "^7.1.3",
"hastscript": "^6.0.0",
Expand All @@ -52,41 +59,49 @@
"prettier": "^2.3.2",
"resolve-pkg": "^2.0.0",
"serve-handler": "^6.1.3",
"shelljs": "^0.8.5",
"slash": "4.0.0",
"terminal-link": "^2.1.1",
"tmp": "^0.2.1",
"upath": "^2.0.1",
"uuid": "^8.3.2",
"vfile": "^4.2.1"
"vfile": "^4.2.1",
"w3c-xmlserializer": "^4.0.0",
"whatwg-mimetype": "^3.0.0"
},
"devDependencies": {
"@hyrious/esbuild-plugin-commonjs": "^0.2.2",
"@release-it/conventional-changelog": "^5.1.1",
"@types/archiver": "^5.3.2",
"@types/command-exists": "1.2.0",
"@types/debug": "^4.1.7",
"@types/jest": "^29.2.4",
"@types/jsdom": "^16.2.13",
"@types/fs-extra": "^11.0.1",
"@types/github-slugger": "^1.3.0",
"@types/jsdom": "^21.1.1",
"@types/mime-types": "^2.1.1",
"@types/node": "^16.7.2",
"@types/npm-package-arg": "^6.1.1",
"@types/npmcli__arborist": "^5.6.0",
"@types/serve-handler": "^6.1.1",
"@types/tmp": "^0.2.1",
"@types/uuid": "^8.3.1",
"@types/w3c-xmlserializer": "^2.0.2",
"@types/whatwg-mimetype": "^3.0.0",
"@vitest/coverage-v8": "^0.33.0",
"esbuild": "^0.18.11",
"file-type": "^16.5.3",
"fs-extra": "^11.1.1",
"husky": "^4.3.8",
"jest": "^29.3.1",
"jsdom": "^17.0.0",
"json-schema-to-typescript": "^10.1.4",
"lint-staged": "^11.1.2",
"memfs": "^4.2.0",
"nodemon": "^2.0.12",
"npm-run-all": "^4.1.5",
"prettier-plugin-organize-imports": "^2.3.3",
"pretty-quick": "^3.1.1",
"release-it": "^15.6.0",
"shx": "^0.3.3",
"ts-jest": "^29.0.3",
"typescript": "^4.9.3"
"typescript": "^4.9.3",
"upath": "^2.0.1",
"vitest": "^0.33.0"
},
"main": "dist/index.js",
"module": "dist/index.js",
Expand All @@ -107,7 +122,8 @@
"files": [
"dist",
"schemas",
"types"
"types",
"vendors"
],
"husky": {
"hooks": {
Expand Down
Loading

0 comments on commit ba2e7f7

Please sign in to comment.