diff --git a/package.json b/package.json index f2db3c131..37646513d 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,7 @@ "test": "yarn run jest", "type:dts": "nimbus typescript --build --reference-workspaces", "type-one": "nimbus typescript --build", - "docs": "yarn run docs:gen && node ./scripts/docs/index.js", - "docs:gen": "lerna run docs", - "prepare-release": "git checkout master && git pull --rebase origin master && yarn run docs && lerna updated", + "prepare-release": "git checkout master && git pull --rebase origin master && lerna updated", "release": "yarn run prepare-release && lerna publish --exact" }, "devDependencies": { @@ -58,7 +56,6 @@ "marked": "^0.7.0", "raf": "^3.4.0", "react": "^15.0.0-0 || ^16.0.0-0", - "react-docgen": "^5.3.0", "react-dom": "^15.0.0-0 || ^16.0.0-0", "react-test-renderer": "^16.8.6", "regenerator-runtime": "^0.10.5" diff --git a/packages/vx-bounds/Readme.md b/packages/vx-bounds/Readme.md index 183b96023..1993e3217 100644 --- a/packages/vx-bounds/Readme.md +++ b/packages/vx-bounds/Readme.md @@ -1,5 +1,11 @@ # @vx/bounds +

+ + + +

+ ``` npm install --save @vx/bounds ``` diff --git a/packages/vx-demo/src/components/DocPage.tsx b/packages/vx-demo/src/components/DocPage.tsx index 41a6c07e9..ad94eae32 100644 --- a/packages/vx-demo/src/components/DocPage.tsx +++ b/packages/vx-demo/src/components/DocPage.tsx @@ -1,3 +1,4 @@ +/* eslint-disable no-underscore-dangle */ import React from 'react'; import Markdown from 'react-markdown/with-html'; @@ -8,7 +9,7 @@ import Page from './Page'; import { DocGenInfo, VxPackage } from '../types'; type Props = { - components?: DocGenInfo[]; + components?: unknown[]; vxPackage: VxPackage; readme: string; }; @@ -27,10 +28,12 @@ export default function DocPage({ components, vxPackage, readme }: Props) {

Components

APIs

- {components.map(component => ( - - ))} + {components.map(component => { + // @ts-ignore TS doesn't know about docgenInfo + const docgenInfo = component.__docgenInfo as DocGenInfo | undefined; + return docgenInfo ? ( + + ) : null; + })} )} diff --git a/packages/vx-demo/src/components/PackageList.tsx b/packages/vx-demo/src/components/PackageList.tsx index 904ef8ac5..4c7f30b92 100644 --- a/packages/vx-demo/src/components/PackageList.tsx +++ b/packages/vx-demo/src/components/PackageList.tsx @@ -122,7 +122,7 @@ export default function PackageList({ {!compact &&

Utilities for clip-path elements

}
  • - @vx/event + @vx/event {!compact && (

    Utilities for computing svg coordinates from mouse or touch events

    )} diff --git a/packages/vx-demo/src/pages/docs/Annotation.tsx b/packages/vx-demo/src/pages/docs/Annotation.tsx index 6d85d87a5..357310303 100644 --- a/packages/vx-demo/src/pages/docs/Annotation.tsx +++ b/packages/vx-demo/src/pages/docs/Annotation.tsx @@ -1,14 +1,9 @@ import React from 'react'; - import AnnotationReadme from '!!raw-loader!../../../../vx-annotation/Readme.md'; import LinePathAnnotation from '../../../../vx-annotation/src/annotations/LinePathAnnotation'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - LinePathAnnotation.__docgenInfo, -] as DocGenInfo[]; +const components = [LinePathAnnotation]; export default () => ( diff --git a/packages/vx-demo/src/pages/docs/Axis.tsx b/packages/vx-demo/src/pages/docs/Axis.tsx index b913ed692..64485afec 100644 --- a/packages/vx-demo/src/pages/docs/Axis.tsx +++ b/packages/vx-demo/src/pages/docs/Axis.tsx @@ -6,19 +6,7 @@ import AxisLeft from '../../../../vx-axis/src/axis/AxisLeft'; import AxisRight from '../../../../vx-axis/src/axis/AxisRight'; import AxisTop from '../../../../vx-axis/src/axis/AxisTop'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - Axis.__docgenInfo, - // @ts-ignore - AxisBottom.__docgenInfo, - // @ts-ignore - AxisLeft.__docgenInfo, - // @ts-ignore - AxisRight.__docgenInfo, - // @ts-ignore - AxisTop.__docgenInfo, -] as DocGenInfo[]; +const components = [Axis, AxisBottom, AxisLeft, AxisRight, AxisTop]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Brush.tsx b/packages/vx-demo/src/pages/docs/Brush.tsx index 3bd294b4b..3c19f645a 100644 --- a/packages/vx-demo/src/pages/docs/Brush.tsx +++ b/packages/vx-demo/src/pages/docs/Brush.tsx @@ -2,11 +2,7 @@ import React from 'react'; import BrushReadme from '!!raw-loader!../../../../vx-brush/Readme.md'; import Brush from '../../../../vx-brush/src/Brush'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - Brush.__docgenInfo, -] as DocGenInfo[]; +const components = [Brush]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Chord.tsx b/packages/vx-demo/src/pages/docs/Chord.tsx index 8de35d9be..86fd1cbe1 100644 --- a/packages/vx-demo/src/pages/docs/Chord.tsx +++ b/packages/vx-demo/src/pages/docs/Chord.tsx @@ -1,16 +1,9 @@ import React from 'react'; - import ChordReadme from '!!raw-loader!../../../../vx-chord/Readme.md'; import Chord from '../../../../vx-chord/src/Chord'; import DocPage from '../../components/DocPage'; import Ribbon from '../../../../vx-chord/src/Ribbon'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - Chord.__docgenInfo, - // @ts-ignore - Ribbon.__docgenInfo, -] as DocGenInfo[]; +const components = [Chord, Ribbon]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Clip-Path.tsx b/packages/vx-demo/src/pages/docs/Clip-Path.tsx index 220d66254..95635189a 100644 --- a/packages/vx-demo/src/pages/docs/Clip-Path.tsx +++ b/packages/vx-demo/src/pages/docs/Clip-Path.tsx @@ -4,16 +4,8 @@ import ClipPath from '../../../../vx-clip-path/src/clip-paths/ClipPath'; import CircleClipPath from '../../../../vx-clip-path/src/clip-paths/CircleClipPath'; import RectClipPath from '../../../../vx-clip-path/src/clip-paths/RectClipPath'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - ClipPath.__docgenInfo, - // @ts-ignore - CircleClipPath.__docgenInfo, - // @ts-ignore - RectClipPath.__docgenInfo, -] as DocGenInfo[]; +const components = [ClipPath, CircleClipPath, RectClipPath]; export default () => ( diff --git a/packages/vx-demo/src/pages/docs/Drag.tsx b/packages/vx-demo/src/pages/docs/Drag.tsx index 57f697ef9..a96b528c3 100644 --- a/packages/vx-demo/src/pages/docs/Drag.tsx +++ b/packages/vx-demo/src/pages/docs/Drag.tsx @@ -2,11 +2,7 @@ import React from 'react'; import DragReadme from '!!raw-loader!../../../../vx-drag/Readme.md'; import Drag from '../../../../vx-drag/src/Drag'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - Drag.__docgenInfo, -] as DocGenInfo[]; +const components = [Drag]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Geo.tsx b/packages/vx-demo/src/pages/docs/Geo.tsx index fe5914319..72de25b31 100644 --- a/packages/vx-demo/src/pages/docs/Geo.tsx +++ b/packages/vx-demo/src/pages/docs/Geo.tsx @@ -10,27 +10,17 @@ import NaturalEarth from '../../../../vx-geo/src/projections/NaturalEarth'; import Orthographic from '../../../../vx-geo/src/projections/Orthographic'; import Projection from '../../../../vx-geo/src/projections/Projection'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; const components = [ - // @ts-ignore - Projection.__docgenInfo, - // @ts-ignore - Graticule.__docgenInfo, - // @ts-ignore - Albers.__docgenInfo, - // @ts-ignore - AlbersUsa.__docgenInfo, - // @ts-ignore - CustomProjection.__docgenInfo, - // @ts-ignore - EqualEarth.__docgenInfo, - // @ts-ignore - Mercator.__docgenInfo, - // @ts-ignore - NaturalEarth.__docgenInfo, - // @ts-ignore - Orthographic.__docgenInfo, -] as DocGenInfo[]; + Projection, + Graticule, + Albers, + AlbersUsa, + CustomProjection, + EqualEarth, + Mercator, + NaturalEarth, + Orthographic, +]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Glyph.tsx b/packages/vx-demo/src/pages/docs/Glyph.tsx index ace08b512..5935e630c 100644 --- a/packages/vx-demo/src/pages/docs/Glyph.tsx +++ b/packages/vx-demo/src/pages/docs/Glyph.tsx @@ -2,12 +2,13 @@ import React from 'react'; import GlyphReadme from '!!raw-loader!../../../../vx-glyph/Readme.md'; import * as Glyph from '../../../../vx-glyph/src'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = (Object.values(Glyph).map( - component => - // @ts-ignore - component.__docgenInfo, -) as DocGenInfo[]).sort((a, b) => (a.displayName ?? '').localeCompare(b.displayName ?? '')); +const components = Object.values(Glyph).sort((a, b) => + // @ts-ignore TS doesn't know about docgenInfo + (a?.__docgenInfo?.displayName ?? '').localeCompare( + // @ts-ignore TS doesn't know about docgenInfo + b?.__docgenInfo?.displayName ?? '', + ), +); export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Gradient.tsx b/packages/vx-demo/src/pages/docs/Gradient.tsx index 3227f3c63..8c77d9891 100644 --- a/packages/vx-demo/src/pages/docs/Gradient.tsx +++ b/packages/vx-demo/src/pages/docs/Gradient.tsx @@ -3,20 +3,20 @@ import GradientReadme from '!!raw-loader!../../../../vx-gradient/Readme.md'; import * as Gradients from '../../../../vx-gradient/src'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = (Object.values(Gradients).map( - component => - // @ts-ignore - component.__docgenInfo, -) as DocGenInfo[]).sort( - (a, b) => - (a.displayName === 'LinearGradient' && -2) || - (b.displayName === 'LinearGradient' && 2) || - (a.displayName === 'RadialGradient' && -1) || - (b.displayName === 'RadialGradient' && 1) || - (a.displayName ?? '').localeCompare(b.displayName ?? ''), -); +const components = Object.values(Gradients).sort((a, b) => { + // @ts-ignore TS doesn't know about docgenInfo + const aName = a?.__docgenInfo?.displayName ?? ''; + // @ts-ignore TS doesn't know about docgenInfo + const bName = b?.__docgenInfo?.displayName ?? ''; + return ( + (aName === 'LinearGradient' && -2) || + (bName === 'LinearGradient' && 2) || + (aName === 'RadialGradient' && -1) || + (bName === 'RadialGradient' && 1) || + aName.localeCompare(bName) + ); +}); export default () => ( diff --git a/packages/vx-demo/src/pages/docs/Grid.tsx b/packages/vx-demo/src/pages/docs/Grid.tsx index 7d89a789f..8f5135ede 100644 --- a/packages/vx-demo/src/pages/docs/Grid.tsx +++ b/packages/vx-demo/src/pages/docs/Grid.tsx @@ -4,12 +4,7 @@ import Grid from '../../../../vx-grid/src/grids/Grid'; import GridRows from '../../../../vx-grid/src/grids/GridRows'; import GridColumns from '../../../../vx-grid/src/grids/GridColumns'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [GridRows, GridColumns, Grid].map( - c => - // @ts-ignore - c.__docgenInfo, -) as DocGenInfo[]; +const components = [GridRows, GridColumns, Grid]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Group.tsx b/packages/vx-demo/src/pages/docs/Group.tsx index caec50287..66eed2c19 100644 --- a/packages/vx-demo/src/pages/docs/Group.tsx +++ b/packages/vx-demo/src/pages/docs/Group.tsx @@ -2,11 +2,7 @@ import React from 'react'; import GroupReadme from '!!raw-loader!../../../../vx-group/Readme.md'; import Group from '../../../../vx-group/src/Group'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - Group.__docgenInfo, -] as DocGenInfo[]; +const components = [Group]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Heatmap.tsx b/packages/vx-demo/src/pages/docs/Heatmap.tsx index 16eed06f8..dd0e345dc 100644 --- a/packages/vx-demo/src/pages/docs/Heatmap.tsx +++ b/packages/vx-demo/src/pages/docs/Heatmap.tsx @@ -3,13 +3,7 @@ import HeatmapReadme from '!!raw-loader!../../../../vx-heatmap/Readme.md'; import HeatmapRect from '../../../../vx-heatmap/src/heatmaps/HeatmapRect'; import HeatmapCircle from '../../../../vx-heatmap/src/heatmaps/HeatmapCircle'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - HeatmapRect.__docgenInfo, - // @ts-ignore - HeatmapCircle.__docgenInfo, -] as DocGenInfo[]; +const components = [HeatmapRect, HeatmapCircle]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Hierarchy.tsx b/packages/vx-demo/src/pages/docs/Hierarchy.tsx index 68dfa8533..01238de04 100644 --- a/packages/vx-demo/src/pages/docs/Hierarchy.tsx +++ b/packages/vx-demo/src/pages/docs/Hierarchy.tsx @@ -6,13 +6,8 @@ import Partition from '../../../../vx-hierarchy/src/hierarchies/Partition'; import Tree from '../../../../vx-hierarchy/src/hierarchies/Tree'; import Treemap from '../../../../vx-hierarchy/src/hierarchies/Treemap'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [Cluster, Pack, Partition, Tree, Treemap].map( - c => - // @ts-ignore - c.__docgenInfo, -) as DocGenInfo[]; +const components = [Cluster, Pack, Partition, Tree, Treemap]; export default () => ( diff --git a/packages/vx-demo/src/pages/docs/Legend.tsx b/packages/vx-demo/src/pages/docs/Legend.tsx index b0efc96b0..22cca61e1 100644 --- a/packages/vx-demo/src/pages/docs/Legend.tsx +++ b/packages/vx-demo/src/pages/docs/Legend.tsx @@ -7,12 +7,7 @@ import Quantile from '../../../../vx-legend/src/legends/Quantile'; import Size from '../../../../vx-legend/src/legends/Size'; import Threshold from '../../../../vx-legend/src/legends/Threshold'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [Linear, Ordinal, Quantile, Size, Threshold, Legend].map( - c => - // @ts-ignore - c.__docgenInfo, -) as DocGenInfo[]; +const components = [Linear, Ordinal, Quantile, Size, Threshold, Legend]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Marker.tsx b/packages/vx-demo/src/pages/docs/Marker.tsx index b503a7469..7d2d70718 100644 --- a/packages/vx-demo/src/pages/docs/Marker.tsx +++ b/packages/vx-demo/src/pages/docs/Marker.tsx @@ -2,11 +2,7 @@ import React from 'react'; import MarkerReadme from '!!raw-loader!../../../../vx-marker/Readme.md'; import Marker from '../../../../vx-marker/src/markers/Marker'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - Marker.__docgenInfo, -] as DocGenInfo[]; +const components = [Marker]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Network.tsx b/packages/vx-demo/src/pages/docs/Network.tsx index fe542bb13..da28d0d1c 100644 --- a/packages/vx-demo/src/pages/docs/Network.tsx +++ b/packages/vx-demo/src/pages/docs/Network.tsx @@ -6,12 +6,7 @@ import Links from '../../../../vx-network/src/Links'; import DefaultNode from '../../../../vx-network/src/DefaultNode'; import DefaultLink from '../../../../vx-network/src/DefaultLink'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [Graph, Nodes, Links, DefaultNode, DefaultLink].map( - c => - // @ts-ignore - c.__docgenInfo, -) as DocGenInfo[]; +const components = [Graph, Nodes, Links, DefaultNode, DefaultLink]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Pattern.tsx b/packages/vx-demo/src/pages/docs/Pattern.tsx index c387953e4..7803d5c70 100644 --- a/packages/vx-demo/src/pages/docs/Pattern.tsx +++ b/packages/vx-demo/src/pages/docs/Pattern.tsx @@ -7,12 +7,7 @@ import Path from '../../../../vx-pattern/src/patterns/Path'; import Pattern from '../../../../vx-pattern/src/patterns/Pattern'; import Waves from '../../../../vx-pattern/src/patterns/Waves'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [Pattern, Circles, Hexagons, Lines, Path, Waves].map( - component => - // @ts-ignore - component.__docgenInfo, -) as DocGenInfo[]; +const components = [Pattern, Circles, Hexagons, Lines, Path, Waves]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Responsive.tsx b/packages/vx-demo/src/pages/docs/Responsive.tsx index ab3c65c7b..9e9c2dd66 100644 --- a/packages/vx-demo/src/pages/docs/Responsive.tsx +++ b/packages/vx-demo/src/pages/docs/Responsive.tsx @@ -3,13 +3,8 @@ import ResponsiveReadme from '!!raw-loader!../../../../vx-responsive/Readme.md'; import ParentSize from '../../../../vx-responsive/src/components/ParentSize'; import ScaleSVG from '../../../../vx-responsive/src/components/ScaleSVG'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ParentSize, ScaleSVG].map( - component => - // @ts-ignore - component.__docgenInfo, -) as DocGenInfo[]; +const components = [ParentSize, ScaleSVG]; export default () => ( diff --git a/packages/vx-demo/src/pages/docs/Shape.tsx b/packages/vx-demo/src/pages/docs/Shape.tsx index a5e06c240..e0047d3f8 100644 --- a/packages/vx-demo/src/pages/docs/Shape.tsx +++ b/packages/vx-demo/src/pages/docs/Shape.tsx @@ -2,15 +2,13 @@ import React from 'react'; import ShapeReadme from '!!raw-loader!../../../../vx-shape/Readme.md'; import * as Shapes from '../../../../vx-shape/src'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = Object.values(Shapes) - .map( - componentOrFunc => - // @ts-ignore - componentOrFunc.__docgenInfo, - ) - .filter(docgen => !!docgen) - .sort((a, b) => a.displayName.localeCompare(b.displayName)) as DocGenInfo[]; +const components = Object.values(Shapes).sort((a, b) => + // @ts-ignore TS doesn't know about docgenInfo + (a?.__docgenInfo?.displayName ?? '').localeCompare( + // @ts-ignore TS doesn't know about docgenInfo + b?.__docgenInfo?.displayName ?? '', + ), +); export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Stats.tsx b/packages/vx-demo/src/pages/docs/Stats.tsx index 433089a98..d21dc0753 100644 --- a/packages/vx-demo/src/pages/docs/Stats.tsx +++ b/packages/vx-demo/src/pages/docs/Stats.tsx @@ -3,12 +3,7 @@ import StatsReadme from '!!raw-loader!../../../../vx-stats/Readme.md'; import BoxPlot from '../../../../vx-stats/src/BoxPlot'; import ViolinPlot from '../../../../vx-stats/src/ViolinPlot'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [BoxPlot, ViolinPlot].map( - component => - // @ts-ignore - component.__docgenInfo, -) as DocGenInfo[]; +const components = [BoxPlot, ViolinPlot]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Text.tsx b/packages/vx-demo/src/pages/docs/Text.tsx index af96e5e55..c223dbc57 100644 --- a/packages/vx-demo/src/pages/docs/Text.tsx +++ b/packages/vx-demo/src/pages/docs/Text.tsx @@ -2,11 +2,7 @@ import React from 'react'; import TextReadme from '!!raw-loader!../../../../vx-text/Readme.md'; import Text from '../../../../vx-text/src/Text'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - Text.__docgenInfo, -] as DocGenInfo[]; +const components = [Text]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Threshold.tsx b/packages/vx-demo/src/pages/docs/Threshold.tsx index 2763559b4..e99f59c80 100644 --- a/packages/vx-demo/src/pages/docs/Threshold.tsx +++ b/packages/vx-demo/src/pages/docs/Threshold.tsx @@ -2,12 +2,8 @@ import React from 'react'; import ThresholdReadme from '!!raw-loader!../../../../vx-threshold/Readme.md'; import Threshold from '../../../../vx-threshold/src/Threshold'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - Threshold.__docgenInfo, -] as DocGenInfo[]; +const components = [Threshold]; export default () => ( diff --git a/packages/vx-demo/src/pages/docs/Voronoi.tsx b/packages/vx-demo/src/pages/docs/Voronoi.tsx index ac8540483..00e9f4021 100644 --- a/packages/vx-demo/src/pages/docs/Voronoi.tsx +++ b/packages/vx-demo/src/pages/docs/Voronoi.tsx @@ -3,13 +3,7 @@ import VoronoiReadme from '!!raw-loader!../../../../vx-voronoi/Readme.md'; import VoronoiPolygon from '../../../../vx-voronoi/src/components/VoronoiPolygon'; import voronoi from '../../../../vx-voronoi/src/voronoi'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - voronoi.__docgenInfo, - // @ts-ignore - VoronoiPolygon.__docgenInfo, -] as DocGenInfo[]; +const components = [voronoi, VoronoiPolygon]; export default () => ; diff --git a/packages/vx-demo/src/pages/docs/Zoom.tsx b/packages/vx-demo/src/pages/docs/Zoom.tsx index ad45a592d..202e2770a 100644 --- a/packages/vx-demo/src/pages/docs/Zoom.tsx +++ b/packages/vx-demo/src/pages/docs/Zoom.tsx @@ -2,11 +2,7 @@ import React from 'react'; import ZoomReadme from '!!raw-loader!../../../../vx-zoom/Readme.md'; import Zoom from '../../../../vx-zoom/src/Zoom'; import DocPage from '../../components/DocPage'; -import { DocGenInfo } from '../../types'; -const components = [ - // @ts-ignore - Zoom.__docgenInfo, -] as DocGenInfo[]; +const components = [Zoom]; export default () => ; diff --git a/scripts/buildDocs.sh b/scripts/buildDocs.sh deleted file mode 100755 index ad67c6cfc..000000000 --- a/scripts/buildDocs.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env node - -const fs = require('fs'); -const generateMarkdown = require('./genMarkdown'); -const path = require('path'); - -let json = ''; -process.stdin.setEncoding('utf8'); -process.stdin.on('readable', function() { - let chunk = process.stdin.read(); - if (chunk !== null) { - json += chunk; - } -}); -process.stdin.on('end', function() { - buildDocs(JSON.parse(json)); -}); - -function buildDocs(api) { - const dir = path.dirname(Object.keys(api)[0]); - const p = dir === '../src' ? '../../docs' : '../../../docs'; - const docPath = path.resolve(`${Object.keys(api)[0]}`, p); - - const toc = Object.keys(api) - .map(filepath => { - const name = getComponentName(filepath); - return ` - [${name}](#${name.toLowerCase()}-)`; - }) - .join('\n'); - - const md = Object.keys(api).map(filepath => { - var name = getComponentName(filepath); - return generateMarkdown(name, api[filepath]); - }); - - const apiDocs = md.join('\n'); - const install = fs.readFileSync(`${docPath}/install.md`, { encoding: 'utf-8' }); - const description = fs.readFileSync(`${docPath}/description.md`, { encoding: 'utf-8' }); - - const docs = [description, install, '## Components\n\n', toc, '## API\n\n', apiDocs].join('\n\n'); - - fs.writeFileSync('api.md', apiDocs); - process.stdout.write(' -> ' + 'api.md\n'); - fs.writeFileSync('docs.md', docs); - process.stdout.write(' -> ' + 'docs.md\n'); -} - -function getComponentName(filepath) { - let name = path.basename(filepath); - let ext; - while ((ext = path.extname(name))) { - name = name.substring(0, name.length - ext.length); - } - return name; -} diff --git a/scripts/docs/README.md b/scripts/docs/README.md deleted file mode 100644 index 6accb2d77..000000000 --- a/scripts/docs/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Doc Generating Script - -This script takes the README's from each of the packages and converts them into HTML. - -## Usage - -From the root of the project. -``` -node scripts/docs/index.js -``` diff --git a/scripts/docs/constants.js b/scripts/docs/constants.js deleted file mode 100644 index e4e6f7a33..000000000 --- a/scripts/docs/constants.js +++ /dev/null @@ -1,13 +0,0 @@ -const DOCS = 'packages/vx-demo/static/docs'; -const PACKAGES = 'packages'; -const README = 'README.md'; -const ASSETS = 'assets'; -const CSS_PATH = '../doc_styles.css'; - -module.exports = { - DOCS, - PACKAGES, - README, - ASSETS, - CSS_PATH -}; diff --git a/scripts/docs/index.js b/scripts/docs/index.js deleted file mode 100644 index 0c0784adc..000000000 --- a/scripts/docs/index.js +++ /dev/null @@ -1,126 +0,0 @@ -'use strict'; - -const jetpack = require('fs-jetpack'); // filesystem -const marked = require('marked'); // markdown parser -const { DOCS, PACKAGES, README } = require('./constants.js'); - -// Stop someone from running the script from it's directory -const ROOT = process.cwd(); -if (ROOT === __dirname) { - throw new Error(`Oops! It looks like you might not be running this from the project's - root directory.`); -} - -/** - * Returns a fs-jetpack file pointer to the packages directory. - */ -function atPackagesDirectory() { - return jetpack.cwd(ROOT).dir(PACKAGES); -} - -function atDocsDirectory() { - return jetpack.cwd(ROOT).dir(DOCS); -} - -/** - * Returns the text of a README at a specific package - */ -function getReadmeText(pkg) { - const pkgDir = atPackagesDirectory().dir(pkg); - const generatedDoc = pkgDir.read('./docs/docs.md'); - if (generatedDoc) pkgDir.write('Readme.md', generatedDoc); - const text = pkgDir.read(README); - if (text) return text; - return ''; // don't return "undefined" -} - -/** - * From a package directory, get the html from the markdown - * @return {pkg, html} - */ -function getDocObject(dir, info) { - const markdown = getReadmeText(dir); - const html = marked(markdown); - const cleanedHTML = prepareHTML(html, info); - return { pkg: dir, html: cleanedHTML }; -} - -/** - * Wraps HTML content in a proper and - * adds css. - */ -function prepareHTML(html, info) { - const cssPath = `../doc_styles.css`; - const nav = info.map(p => { - return `
  • ${p.name}
  • `; - }); - return ` - - - - - -
    -
    -
      -
    • Packages
    • - ${nav.join('')} -
    -
    -
    - ${html} -
    -
    - - `; -} - -function readDocs() { - const dirs = atPackagesDirectory().list(); // Get all the pkg directories - const info = dirs - .map(d => { - return atPackagesDirectory() - .dir(d) - .read('./package.json'); - }) - .map(JSON.parse); - const docs = []; - for (let pkg of dirs) { - docs.push(getDocObject(pkg, info)); - } - - return docs; -} - -function writeDocs(docs) { - const filePointer = atDocsDirectory(); - - docs.forEach(({ pkg, html }) => { - const fileName = `${pkg}.html`; - filePointer.write(fileName, html); - }); -} - -const docs = readDocs(); -writeDocs(docs); diff --git a/scripts/docs/package.json b/scripts/docs/package.json deleted file mode 100644 index 3793b6037..000000000 --- a/scripts/docs/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "docs", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "MIT", - "dependencies": { - "fs-jetpack": "^1.0.0", - "marked": "^0.3.6" - }, - "devDependencies": { - "react": "^15.6.1", - "react-dom": "^15.6.1" - } -} diff --git a/scripts/genMarkdown.js b/scripts/genMarkdown.js deleted file mode 100644 index be8b4d9b4..000000000 --- a/scripts/genMarkdown.js +++ /dev/null @@ -1,73 +0,0 @@ -function stringOfLength(string, length) { - let newString = ''; - for (let i = 0; i < length; i++) { - newString += string; - } - return newString; -} - -function generateTitle(name) { - const title = `

    <${name} />

    `; - return title + '\n'; -} - -function generateDesciption(description) { - return `\n${description}\n\n`; -} - -function generatePropType(type) { - let values; - if (Array.isArray(type.value)) { - values = - '(' + - type.value - .map(function(typeValue) { - return typeValue.name || typeValue.value; - }) - .join('|') + - ')'; - } else { - values = type.value; - } - - return '' + type.name + (values ? values : '') + ''; -} - -function generatePropDefaultValue(value) { - const strValue = `${value.value}`; - return `
    Default${strValue}
    `; -} - -function generateProp(propName, prop, name) { - const anchor = `${name}__${propName}`; - return ( - `# ` + - `*${name}*.**${propName}**${prop.type ? `<${generatePropType(prop.type)}>` : ''} ${ - prop.required ? '`required`' : '' - }` + - (prop.description ? `\n\n${prop.description}` + ' ' : ' ') + - `${prop.defaultValue ? generatePropDefaultValue(prop.defaultValue) : ''}` + - '\n' - ); -} - -function generateProps(props, name) { - if (!props || !Object.keys(props)) return ''; - return Object.keys(props) - .sort() - .map(function(propName) { - return generateProp(propName, props[propName], name); - }) - .join('\n'); -} - -function generateMarkdown(name, reactAPI) { - const markdownString = - generateTitle(name) + - generateDesciption(reactAPI.description) + - generateProps(reactAPI.props, name); - - return markdownString; -} - -module.exports = generateMarkdown; diff --git a/yarn.lock b/yarn.lock index 73b4a745b..9cd8b3ef8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1140,13 +1140,6 @@ dependencies: regenerator-runtime "^0.13.2" -"@babel/runtime@^7.7.6": - version "7.9.6" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.9.6.tgz#a9102eb5cadedf3f31d08a9ecf294af7827ea29f" - integrity sha512-64AF1xY3OAkFHqOb9s4jpgk1Mm5vDZ4L3acHvAml+53nO1XbXLuDodsVpO4OIUsmemlUHMxNdYMNJmsvOwLrvQ== - dependencies: - regenerator-runtime "^0.13.4" - "@babel/template@^7.7.0", "@babel/template@^7.7.4", "@babel/template@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.3.tgz#e02ad04fe262a657809327f578056ca15fd4d1b8" @@ -3437,11 +3430,6 @@ ast-types@0.13.2: resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.13.2.tgz#df39b677a911a83f3a049644fb74fdded23cea48" integrity sha512-uWMHxJxtfj/1oZClOxDEV1sQ1HCDkA4MG8Gr69KKeBjEVH0R84WlejZ0y2DcwyBlpAEMltmVYkVgqfLFb2oyiA== -ast-types@^0.13.2: - version "0.13.3" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.13.3.tgz#50da3f28d17bdbc7969a3a2d83a0e4a72ae755a7" - integrity sha512-XTZ7xGML849LkQP86sWdQzfhwbt3YwIO6MqbX9mUNYY98VKaaVZP7YNNm70IpwecbkkxmfC5IYAzOQ/2p29zRA== - astral-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" @@ -9025,11 +9013,6 @@ mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -min-indent@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.0.tgz#cfc45c37e9ec0d8f0a0ec3dd4ef7f7c3abe39256" - integrity sha1-z8RcN+nsDY8KDsPdTvf3w6vjklY= - mini-css-extract-plugin@0.4.3: version "0.4.3" resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.4.3.tgz#98d60fcc5d228c3e36a9bd15a1d6816d6580beb8" @@ -9375,13 +9358,6 @@ no-case@^2.2.0, no-case@^2.3.2: dependencies: lower-case "^1.1.1" -node-dir@^0.1.10: - version "0.1.17" - resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5" - integrity sha1-X1Zl2TNRM1yqvvjxxVRRbPXx5OU= - dependencies: - minimatch "^3.0.2" - node-fetch-npm@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/node-fetch-npm/-/node-fetch-npm-2.0.2.tgz#7258c9046182dca345b4208eda918daf33697ff7" @@ -11086,20 +11062,6 @@ react-docgen-typescript@^1.15.0: resolved "https://registry.yarnpkg.com/react-docgen-typescript/-/react-docgen-typescript-1.16.4.tgz#9a9674d25a02704c5e3dafa76f7ea928aca336a3" integrity sha512-9NkfxDnLB+zYPRE4JBWoNc/JB0N1YWkZEq91al4F/e6BGMKHtAOESaEmrqdooxBLlxDhGKUGCXhPGJHHsG6bFQ== -react-docgen@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-5.3.0.tgz#9aabde5e69f1993c8ba839fd9a86696504654589" - integrity sha512-hUrv69k6nxazOuOmdGeOpC/ldiKy7Qj/UFpxaQi0eDMrUFUTIPGtY5HJu7BggSmiyAMfREaESbtBL9UzdQ+hyg== - dependencies: - "@babel/core" "^7.7.5" - "@babel/runtime" "^7.7.6" - ast-types "^0.13.2" - commander "^2.19.0" - doctrine "^3.0.0" - neo-async "^2.6.1" - node-dir "^0.1.10" - strip-indent "^3.0.0" - "react-dom@^15.0.0-0 || ^16.0.0-0", react-dom@^16.9.0: version "16.12.0" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.12.0.tgz#0da4b714b8d13c2038c9396b54a92baea633fe11" @@ -11427,11 +11389,6 @@ regenerator-runtime@^0.13.2: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5" integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw== -regenerator-runtime@^0.13.4: - version "0.13.5" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697" - integrity sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA== - regenerator-transform@^0.14.0: version "0.14.1" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.1.tgz#3b2fce4e1ab7732c08f665dfdb314749c7ddd2fb" @@ -12511,13 +12468,6 @@ strip-indent@^2.0.0: resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" integrity sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g= -strip-indent@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001" - integrity sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ== - dependencies: - min-indent "^1.0.0" - strip-json-comments@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7"