@sanity/tsdoc-to-portable-text
v0.4.3
Published
_Work in progress._
Downloads
118
Maintainers
Keywords
Readme
@sanity/tsdoc-to-portable-text
Work in progress.
Installation
npm i @sanity/tsdoc-to-portable-text
Using the CLI
# Extract to etc/<version>.json using `tsdoc-to-portable-text etl` command
tsdoc-to-portable-text etl dist/index.d.ts --outDir etc/ --tsconfig tsconfig.dist.json
Using the Node.js API
import {extract, load, transform} from '@sanity/tsdoc-to-portable-text'
// Path to a package with a package.json file
const packagePath = __dirname
const result = await extract('dist/index.d.ts', {
packagePath,
tsconfigPath: 'tsconfig.dist.json',
})
const docs = transform(result, {package: {scope: null, name: 'mylib', version: '1.0.0'}})
await load(docs, {fs: {path: path.resolve(packagePath, 'etc/1.0.0.json')}})