Skip to content

Commit

Permalink
Use SVG screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
torifat committed Sep 15, 2019
1 parent 84517c3 commit 6ec1600
Show file tree
Hide file tree
Showing 6 changed files with 928 additions and 55 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
Main goal of this library is to provide relevant error messages like the following:

<img width="539" alt="Enum Validation Error" src="https://user-images.githubusercontent.com/208544/36072188-6f559ed4-0f6f-11e8-9a23-0c0477ca7f58.png">
<p align="center">
<img src="screenshot.svg">
</p>

## Installation

Expand Down Expand Up @@ -77,7 +79,10 @@ Default: `cli`
Values: `cli` `js`

Use default `cli` output format if you want to **print** beautiful validation errors like following:
<img width="539" alt="Enum Validation Error" src="https://user-images.githubusercontent.com/208544/36072188-6f559ed4-0f6f-11e8-9a23-0c0477ca7f58.png">

<p align="center">
<img src="screenshot.svg">
</p>

Or, use `js` if you are planning to use this with some API. Your output will look like following:

Expand Down
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@
"index.js",
"typings.d.ts"
],
"scripts": {
"prebuild": "rm -rf lib",
"build": "yarn build:modern && yarn build:legacy",
"build:modern": "BABEL_ENV=modern babel src -d lib/modern/",
"build:legacy": "BABEL_ENV=legacy babel src -d lib/legacy",
"prerelease": "yarn build",
"release": "changeset release",
"format": "prettier --write src/*.js src/**/*.js .changeset/*.js",
"test": "jest",
"test-ci": "jest --coverage --colors",
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=5 --width=80 --height=13 --at=1000 --no-cursor --term iterm2 --profile='deep' --window"
},
"dependencies": {
"@babel/code-frame": "^7.0.0",
"@babel/runtime": "^7.0.0",
Expand Down Expand Up @@ -52,22 +64,12 @@
"jest": "^24.9.0",
"jest-fixtures": "^0.6.0",
"prettier": "^1.14.2",
"pretty-quick": "^1.6.0"
"pretty-quick": "^1.6.0",
"svg-term-cli": "^2.1.1"
},
"peerDependencies": {
"ajv": "4.11.8 - 6"
},
"scripts": {
"prebuild": "rm -rf lib",
"build": "yarn build:modern && yarn build:legacy",
"build:modern": "BABEL_ENV=modern babel src -d lib/modern/",
"build:legacy": "BABEL_ENV=legacy babel src -d lib/legacy",
"prerelease": "yarn build",
"release": "changeset release",
"format": "prettier --write src/*.js src/**/*.js .changeset/*.js",
"test": "jest",
"test-ci": "jest --coverage --colors"
},
"jest": {
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.js"
Expand Down
1 change: 1 addition & 0 deletions usage.js → screenshot.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// iTerm2 Theme: https://raw.githubusercontent.com/mbadolato/iTerm2-Color-Schemes/master/schemes/deep.itermcolors
const Ajv = require('ajv');

const schema = require('./src/__fixtures__/schema.json');
Expand Down
1 change: 1 addition & 0 deletions screenshot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 5 additions & 10 deletions src/__fixtures__/data.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
{
"type": "doc",
"version": 1,
"content": [
{
"type": "table",
"type": "paragarph",
"content": [
{
"type": "tableRow",
"content": [
{
"type": "tableCell",
"content": []
}
]
"type": "text",
"text": "hello?"
}
]
}
],
"version": 1
]
}
Loading

0 comments on commit 6ec1600

Please sign in to comment.