diff --git a/.gitignore b/.gitignore index 00f6d3c..30f2690 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,52 @@ +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# The rest... node_modules dist/ *log -.DS_Store \ No newline at end of file +.DS_Store +coverage diff --git a/.travis.yml b/.travis.yml index 2c59434..c23bf9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,7 @@ language: node_js install: - yarn - - yarn build:source - - yarn build:docs + - yarn build jobs: include: @@ -14,6 +13,7 @@ jobs: script: - yarn lint - yarn test + - yarn test:dist - stage: benchmark node_js: - "6" @@ -28,6 +28,6 @@ jobs: provider: script skip_cleanup: true script: - - npm publish + - ./scripts/release on: tags: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 288f92c..39f38de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Re-factored code to typescript. - use `isPointer` internally now. - Now exports an optimized `npm pack` with minimal file system foot-print. +- Refactor `typings.d.ts` to `./types/index.ts`, we now compile and package our types. +- Improved package scripts, now cleaner and more verbose. +- Simplify package scripts without losing any functionality. ### Remove - Object manipulation functionality has been dropped from JST (the `merge`, @@ -30,6 +33,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `dereference` circular schema dereferencing. - fixed linting - `lodash` imports, build size reduced. +- benchmark messages returning out of sync with test run. ## [1.0.0] - 2017-06-25 diff --git a/benchmarks/benchmark.ts b/benchmarks/benchmark.ts deleted file mode 100644 index d7ca24d..0000000 --- a/benchmarks/benchmark.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Suite } from 'benchmark'; -import * as chalk from 'chalk'; - -type Test = { - id: string, - deferred: boolean, - exec: any, -}; - -const benchmark = (title: string, description: string, tests: Test[]) => { - const suite = new Suite(); - const h1 = chalk.bgBlack.white; - const h2 = chalk.white; - - tests.forEach((t) => { - if (!t.deferred) { - suite.add(t.id, t.exec); - } else { - suite.add(t.id, { - defer: true, - fn: function(deferred) { - t.exec(deferred); - } - }); - } - }); - - suite.on('cycle', function(event) { - console.log(String(event.target)); - }).on('complete', function() { - const fastest = this.filter('fastest').map('name'); - console.log('\n', chalk.white(`Fastest: ${chalk.green(fastest)}`), '\n'); - }); - - console.log(h1('\n', `Benchmark: ${title}`), '\n'); - console.log(h2(description), '\n', '\n', chalk.blue.bold('-------'), '\n'); - - return suite.run({ - async: false, - }); -}; - -export default benchmark; diff --git a/benchmarks/dereference-address-schema.benchmark.ts b/benchmarks/dereference-address-schema.benchmark.ts deleted file mode 100755 index 2dfcdfe..0000000 --- a/benchmarks/dereference-address-schema.benchmark.ts +++ /dev/null @@ -1,28 +0,0 @@ -import * as derefSync from 'json-schema-deref-sync'; -import { dereference } from './../dist/index'; -import resolve from './../tests/mockResolve'; -import benchmark from './benchmark'; - -const title = 'jst/dereference comparision: http://footown.com/generic/address#'; -const description = - 'This benchmark tests the performance of the jst/dereference function using ' + - 'a basic schema of our own invention and a variety of other similar open source ' + - 'tools.'; -const tests = [ - { - id: 'jst/dereference', - deferred: false, - exec: () => { - dereference(resolve('http://footown.com/generic/address#'), resolve); - }, - }, - { - id: 'json-schema-deref-sync', - deferred: false, - exec: () => { - derefSync(resolve('http://footown.com/generic/address#')); - } - } -]; - -benchmark(title, description, tests); diff --git a/benchmarks/dereference-petstore-swagger.benchmark.ts b/benchmarks/dereference-petstore-swagger.benchmark.ts deleted file mode 100755 index 15532bb..0000000 --- a/benchmarks/dereference-petstore-swagger.benchmark.ts +++ /dev/null @@ -1,42 +0,0 @@ -import * as derefSync from 'json-schema-deref-sync'; -import * as $RefParser from 'json-schema-ref-parser'; -import { dereference } from './../dist/index'; -import resolve from './../tests/mockResolve'; -import benchmark from './benchmark'; - -const title = 'jst/dereference comparision - petstore.swagger.json'; -const description = - 'This benchmark tests the performance of the jst/dereference function using ' + - 'the demo Petstore API swagger from the open api homepage. This is a medium ' + - 'sized json payload.'; -const refParser = new $RefParser(); -const tests = [ - { - id: 'jst/dereference', - deferred: false, - exec: () => { - dereference(require('./../resources/petstore.swagger.json'), resolve) - }, - }, - { - id: 'json-schema-deref-sync', - deferred: false, - exec: () => { - derefSync(require('./../resources/petstore.swagger.json')); - } - }, - { - id: 'json-schmea-ref-parser', - deferred: true, - exec: (defer) => { - refParser.dereference( - require('./../resources/petstore.swagger.json'), - (err, x) => { - defer.resolve(); - } - ); - }, - }, -]; - -benchmark(title, description, tests); diff --git a/benchmarks/dereference-temando-swagger.benchmark.ts b/benchmarks/dereference-temando-swagger.benchmark.ts deleted file mode 100755 index bb7da5f..0000000 --- a/benchmarks/dereference-temando-swagger.benchmark.ts +++ /dev/null @@ -1,41 +0,0 @@ -import * as derefSync from 'json-schema-deref-sync'; -import * as $RefParser from 'json-schema-ref-parser'; -import { dereference } from './../dist/index'; -import resolve from './../tests/mockResolve'; -import benchmark from './benchmark'; - -const title = 'jst/dereference comparision - temando.swagger.json'; -const description = - 'This benchmark tests the performance of the jst/dereference function using ' + - 'the Temando Phoenix API swagger payload. This is a large json payload.'; -const refParser = new $RefParser(); -const tests = [ - { - id: 'jst/dereference', - deferred: false, - exec: () => { - dereference(require('./../resources/temando.swagger.json'), resolve) - }, - }, - { - id: 'json-schema-deref-sync', - deferred: false, - exec: () => { - derefSync(require('./../resources/temando.swagger.json')); - } - }, - { - id: 'json-schmea-ref-parser', - deferred: true, - exec: (defer) => { - refParser.dereference( - require('./../resources/temando.swagger.json'), - (err, x) => { - defer.resolve(); - } - ); - }, - }, -]; - -benchmark(title, description, tests); diff --git a/benchmarks/index.benchmark.ts b/benchmarks/index.benchmark.ts deleted file mode 100644 index 1103bbc..0000000 --- a/benchmarks/index.benchmark.ts +++ /dev/null @@ -1,4 +0,0 @@ -require('./traversal-shallow-benchmark'); -require('./dereference-address-schema.benchmark'); -require('./dereference-petstore-swagger.benchmark'); -require('./dereference-temando-swagger.benchmark'); diff --git a/docs/CNAME b/docs/CNAME index df3e90d..63c891a 100644 --- a/docs/CNAME +++ b/docs/CNAME @@ -1 +1 @@ -www.jwije.com \ No newline at end of file +www.jwije.com diff --git a/docs/dereference.html b/docs/dereference.html index ed3c05d..7cf98cd 100644 --- a/docs/dereference.html +++ b/docs/dereference.html @@ -56,13 +56,6 @@

Table of Contents

- -
  • - - typings.d.ts - -
  • - @@ -88,7 +81,7 @@

    Usage

    Arguments

    Returns