From 5423d96296574fce266e8acd6cbc4fbef92343e2 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Sat, 12 May 2018 00:08:17 -0300 Subject: [PATCH] fix(docz-core): don't exit when catch prettier --- packages/docz-core/src/utils/format.ts | 1 - packages/docz-core/src/utils/plugin-hast.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/docz-core/src/utils/format.ts b/packages/docz-core/src/utils/format.ts index 086b06923..8417be56a 100644 --- a/packages/docz-core/src/utils/format.ts +++ b/packages/docz-core/src/utils/format.ts @@ -9,7 +9,6 @@ export const format = (code: string): string => { }) } catch (err) { console.log(err) - process.exit(1) return '' } } diff --git a/packages/docz-core/src/utils/plugin-hast.ts b/packages/docz-core/src/utils/plugin-hast.ts index be3a39a1e..38c13616c 100644 --- a/packages/docz-core/src/utils/plugin-hast.ts +++ b/packages/docz-core/src/utils/plugin-hast.ts @@ -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) @@ -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) } }