diff --git a/.travis.yml b/.travis.yml index 245e29e9c..63b820c11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,3 +32,11 @@ script: notifications: email: false + +deploy: + - provider: npm + email: 'devops@oceanprotocol.com' + api_key: ${NPM_TOKEN} + skip_cleanup: true + on: + tags: true \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..287888c63 --- /dev/null +++ b/CHANGELOG.md @@ -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 diff --git a/scripts/typedoc.js b/scripts/typedoc.js new file mode 100755 index 000000000..50b1695b8 --- /dev/null +++ b/scripts/typedoc.js @@ -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() \ No newline at end of file