Skip to content

Commit

Permalink
add release to travis
Browse files Browse the repository at this point in the history
  • Loading branch information
0x3bfc committed Jul 3, 2020
1 parent c7152df commit f3dd76f
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ script:

notifications:
email: false

deploy:
- provider: npm
email: '[email protected]'
api_key: ${NPM_TOKEN}
skip_cleanup: true
on:
tags: true
9 changes: 9 additions & 0 deletions CHANGELOG.md
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
56 changes: 56 additions & 0 deletions scripts/typedoc.js
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()

0 comments on commit f3dd76f

Please sign in to comment.