Skip to content

Commit 85d9488

Browse files
committed
TSDoc rendering prototype
1 parent 6771de6 commit 85d9488

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+466
-83
lines changed

β€Žpackage.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"start": "env NODE_ENV=development ts-node -r tsconfig-paths/register devServer.ts"
1515
},
1616
"dependencies": {
17-
"@date-fns/docs": "0.5.0",
17+
"@date-fns/docs": "0.12.1",
1818
"@nyancss/css-modules-loader": "^1.1.0",
1919
"@nyancss/react": "^1.3.0",
2020
"@sentry/browser": "^5.30.0",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { db } from '@date-fns/docs'
2+
import * as admin from 'firebase-admin'
3+
4+
admin.initializeApp()
5+
6+
db.packages
7+
.all()
8+
.then((packages) =>
9+
Promise.all(
10+
packages.map((p) => db.packages.set(db.packages.id(p.data.name), p.data))
11+
)
12+
)

β€Žscripts/migrations/migrateV3.tsβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { db, JSDocFunction, JSDocPage, MarkdownPage } from '@date-fns/docs/db'
1+
import { db, DateFnsDocs } from '@date-fns/docs'
22
import * as admin from 'firebase-admin'
33
import { last } from 'lodash'
44
import { StringifiedJSON } from 'typeroo/json'
@@ -7,8 +7,8 @@ import { schema, Typesaurus } from 'typesaurus'
77
admin.initializeApp()
88

99
type Page =
10-
| MarkdownPage
11-
| (Omit<JSDocPage, 'doc'> & {
10+
| DateFnsDocs.MarkdownPage
11+
| (Omit<DateFnsDocs.JSDocPage, 'doc'> & {
1212
doc: { json: string }
1313
})
1414

@@ -25,7 +25,7 @@ processAll((pages) =>
2525
pages.map((page) => {
2626
if (page.data.type === 'markdown') return
2727
return db.pages.update(page.ref.id, {
28-
doc: page.data.doc.json as StringifiedJSON<JSDocFunction>,
28+
doc: page.data.doc.json as StringifiedJSON<DateFnsDocs.JSDocFunction>,
2929
})
3030
})
3131
)

β€Žsrc/ui/screens/Docs/Doc/JSDoc/Examples/index.tsxβ€Ž renamed to β€Žsrc/ui/components/DocExamples/index.tsxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface Props {
99
examples: string[] | string
1010
}
1111

12-
export const Examples: FunctionComponent<Props> = ({ examples }) => (
12+
export const DocExamples: FunctionComponent<Props> = ({ examples }) => (
1313
<section>
1414
<h2 id="examples">
1515
Examples
File renamed without changes.
File renamed without changes.

β€Žsrc/ui/components/DocParams/index.tsxβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { h, FunctionComponent, Fragment } from 'preact'
2-
import { JSDocParam, JSDocType } from '@date-fns/docs/db'
2+
import type { DateFnsDocs } from '@date-fns/docs'
33
import { Markdown } from '~/ui/components/Markdown'
44
import { OptionalLabel, PropsLabel } from './style.css'
55

66
interface Props {
7-
params: JSDocParam[]
7+
params: DateFnsDocs.JSDocParam[]
88
}
99

1010
export const DocParams: FunctionComponent<Props> = ({ params }) => (
@@ -40,7 +40,7 @@ const ParamOptionalLabel: FunctionComponent<{
4040
)
4141

4242
const ParamPropsTable: FunctionComponent<{
43-
props: JSDocParam[]
43+
props: DateFnsDocs.JSDocParam[]
4444
}> = ({ props }) => (
4545
<div>
4646
<PropsLabel>Properties:</PropsLabel>
@@ -62,7 +62,7 @@ const ParamPropsTable: FunctionComponent<{
6262
)
6363

6464
const ParamType: FunctionComponent<{
65-
type: JSDocType
65+
type: DateFnsDocs.JSDocType
6666
variable?: boolean
6767
}> = ({ type, variable }) => {
6868
const names = type.names
File renamed without changes.

β€Žsrc/ui/screens/Docs/Doc/JSDoc/Usage/index.tsxβ€Ž renamed to β€Žsrc/ui/components/DocUsage/index.tsxβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { h, FunctionComponent } from 'preact'
22
import { useEffect, useState } from 'preact/hooks'
3-
import { JSDocUsage } from '@date-fns/docs/db'
3+
import type { DateFnsDocs } from '@date-fns/docs/types'
44
import { Options, Option, OptionLink } from './style.css'
55
import { Content } from './Content'
66
import { DocHeaderAnchor } from '~/ui/components/DocHeaderAnchor'
@@ -9,13 +9,13 @@ const LOCALSTORAGE_KEY = 'usageSource'
99
const DEFAULT_SOURCE = 'commonjs'
1010

1111
interface Props {
12-
usage: JSDocUsage
12+
usage: DateFnsDocs.FnUsage
1313
usageTabs: string[]
1414
}
1515

1616
type FIXME = any
1717

18-
export const Usage: FunctionComponent<Props> = ({ usageTabs, usage }) => {
18+
export const DocUsage: FunctionComponent<Props> = ({ usageTabs, usage }) => {
1919
const [source, setSource] = useState(DEFAULT_SOURCE)
2020

2121
useEffect(() => {
File renamed without changes.

0 commit comments

Comments
Β (0)