Skip to content

Commit

Permalink
fix(docz-core): don't exit when catch prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed May 12, 2018
1 parent 78e1a26 commit 5423d96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion packages/docz-core/src/utils/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const format = (code: string): string => {
})
} catch (err) {
console.log(err)
process.exit(1)
return ''
}
}
4 changes: 2 additions & 2 deletions packages/docz-core/src/utils/plugin-hast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const isPropsTable = (name: string) => name === 'PropsTable'

const addCodeProp = (node: any) => {
const name = componentName(node.value)
const tagOpen = new RegExp(`^\\<${name}`)

if (isPlayground(name)) {
const tagOpen = new RegExp(`^\\<${name}`)
const code = format(nodeToString(node)).slice(1, Infinity)
const html = prism.highlight(code, prism.languages.jsx)

Expand Down Expand Up @@ -46,7 +46,7 @@ export const plugin = () => (tree: any, file: any) => {
visit(tree, 'jsx', visitor)

function visitor(node: any, idx: any, parent: any): void {
addComponentsProp(node)
addCodeProp(node)
addComponentsProp(node)
}
}

0 comments on commit 5423d96

Please sign in to comment.