-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,11 @@ script: | |
|
||
notifications: | ||
email: false | ||
|
||
deploy: | ||
- provider: npm | ||
email: '[email protected]' | ||
api_key: ${NPM_TOKEN} | ||
skip_cleanup: true | ||
on: | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
### Changelog | ||
|
||
All notable changes to this project will be documented in this file. Dates are displayed in UTC. | ||
|
||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). | ||
|
||
#### 0.1.0 | ||
|
||
> 3 July 2020 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env node | ||
|
||
/* eslint-disable security/detect-non-literal-fs-filename */ | ||
|
||
const fs = require('fs') | ||
const TypeDoc = require('typedoc') | ||
const typescript = require('typescript') | ||
const ora = require('ora') | ||
const libJsPackage = require('../package.json') | ||
|
||
const { description, version } = libJsPackage | ||
|
||
// Setup our paths, relative to project root | ||
const outPath = './dist/lib-js.json' | ||
const files = ['./src/lib.ts'] | ||
|
||
// specifically point to tsconfig, otherwise TypeDoc fails | ||
const config = typescript.findConfigFile('./tsconfig.js', typescript.sys.fileExists) | ||
|
||
const generateJson = () => { | ||
const spinnerTypedoc = ora('Generating TypeDoc json...').start() | ||
|
||
// Setup our TypeDoc app | ||
const app = new TypeDoc.Application() | ||
app.options.addReader(new TypeDoc.TSConfigReader()) | ||
app.options.addReader(new TypeDoc.TypeDocReader()) | ||
|
||
app.bootstrap({ | ||
tsconfig: config | ||
}) | ||
|
||
const src = app.expandInputFiles(files) | ||
const project = app.convert(src) | ||
|
||
// Generate the JSON file | ||
app.generateJson(project, outPath) | ||
|
||
// Parse and modify json output | ||
const jsonOrig = JSON.parse(fs.readFileSync(outPath, 'utf8')) | ||
|
||
const jsonFinal = { | ||
info: { | ||
title: 'Lib-js', | ||
description, | ||
version, | ||
sourceUrl: 'https://github.com/oceanprotocol/ocean-lib-js/blob/master/' | ||
}, | ||
...jsonOrig | ||
} | ||
|
||
fs.writeFileSync(outPath, JSON.stringify(jsonFinal, null, 4)) | ||
|
||
spinnerTypedoc.succeed('Generated TypeDoc json.') | ||
} | ||
|
||
generateJson() |