🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@charlietango/react-docs

Package Overview
Dependencies
Maintainers
3
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@charlietango/react-docs - npm Package Compare versions

Comparing version

to
3.5.0

8

lib/index.js

@@ -17,2 +17,3 @@ //

const typeRegex = /type\s+?(\w+)\s+?=([\s\S]+?\n\|?})/;
const enumTypeRegex = /type\s+?(\w+)\s+?=([\s\S]+?\n\|?\s*$)/;
const defaultPropsRegex = /defaultProps\s+?=[\s\S]+?\n}/;

@@ -106,6 +107,7 @@ const descriptionRegex = /\n\/\*\*[\s\S]+?\*\//;

const types = typeRegex.exec(component.src);
const enumType = !types ? enumTypeRegex.exec(component.src) : undefined;
const defaultProps = defaultPropsRegex.exec(component.src);
const description = descriptionRegex.exec(component.src);
if (!types) {
if (!types && !enumType) {
throw new Error(

@@ -120,3 +122,3 @@ `Failed to find model for ${component.name} - ${chalk.grey(

component.name,
types ? types[2] : null,
types ? types[2] : enumType ? enumType[2] : undefined,
defaultProps ? defaultProps[0] : null,

@@ -149,3 +151,3 @@ description ? description[0] : null

const md = docsToMarkdown(component.docs, component.name, {
excludeKeys: 'children',
excludeKeys: ['children', 'ENUM_TYPE'],
excludeTypes: 'node',

@@ -152,0 +154,0 @@ });

@@ -5,2 +5,6 @@ /**

function fakeFlowComponent(name, propTypes, defaultProps, description = '') {
let props = propTypes ? propTypes.replace(/:\s+\| /, ': ').trim() : '{}';
if (!props.startsWith('{')) {
props = `{ENUM_TYPE: ${propTypes}}`;
}
return `

@@ -10,3 +14,3 @@ // @flow

type Props = ${propTypes ? propTypes.replace(/:\s+\| /, ': ') : '{}'};
type Props = ${props};

@@ -13,0 +17,0 @@ ${description || ''}

{
"name": "@charlietango/react-docs",
"description": "Generate docs using react-docgen, and output to Markdown, json or CSharp ViewModels.",
"version": "3.4.1",
"version": "3.5.0",
"main": "lib/index.js",

@@ -31,3 +31,3 @@ "bin": {

"dependencies": {
"@charlietango/react-docs-net": "^3.4.1",
"@charlietango/react-docs-net": "^3.5.0",
"ansi-colors": "^3.2.3",

@@ -54,3 +54,3 @@ "execa": "^1.0.0",

},
"gitHead": "bef4d6489f154b48f5e601e0560fa767d4359c8a"
"gitHead": "bcbfbf9674075be44a6aa426603b8ccc74ba81d6"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet