Skip to content

Commit 9f69f08

Browse files
No longer distributing a pre-bundled JS file.
1 parent 1ac61d4 commit 9f69f08

9 files changed

Lines changed: 23 additions & 16914 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@ node_modules
3838
# Test output
3939
/.nyc_output
4040
/coverage
41-
/dist/*.coverage.js

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ os:
1818

1919
before_script:
2020
- npm run lint
21+
- npm run build
2122

2223
script:
2324
- npm run test:typescript

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,38 +85,41 @@ $RefParser.dereference(mySchema)
8585
For more detailed examples, please see the [API Documentation](https://apidevtools.org/json-schema-ref-parser/docs/)
8686

8787

88+
8889
Installation
8990
--------------------------
90-
#### Node
9191
Install using [npm](https://docs.npmjs.com/about-npm/):
9292

9393
```bash
9494
npm install json-schema-ref-parser
9595
```
9696

97-
Then require it in your code:
97+
98+
99+
Usage
100+
--------------------------
101+
When using Json-Schema-Ref-Parser in Node.js apps, you'll probably want to use **CommonJS** syntax:
98102

99103
```javascript
100-
var $RefParser = require('json-schema-ref-parser');
104+
const $RefParser = require("json-schema-ref-parser");
101105
```
102106

103-
#### Web Browsers
104-
Reference [`ref-parser.js`](dist/ref-parser.js) or [`ref-parser.min.js`](dist/ref-parser.min.js) in your HTML:
105-
106-
```html
107-
<script src="https://unpkg.com/json-schema-ref-parser/dist/ref-parser.min.js"></script>
108-
<script>
109-
$RefParser.dereference(mySchema)
110-
.then(function(schema) {
111-
console.log(schema.definitions.person.properties.firstName);
112-
})
113-
.catch(function(err) {
114-
console.error(err);
115-
});
116-
</script>
107+
When using a transpiler such as [Babel](https://babeljs.io/) or [TypeScript](https://www.typescriptlang.org/), or a bundler such as [Webpack](https://webpack.js.org/) or [Rollup](https://rollupjs.org/), you can use **ECMAScript modules** syntax instead:
108+
109+
```javascript
110+
import $RefParser from "json-schema-ref-parser";
117111
```
118112

119113

114+
115+
Browser support
116+
--------------------------
117+
Json-Schema-Ref-Parser supports recent versions of every major web browser. Older browsers may require [Babel](https://babeljs.io/) and/or [polyfills](https://babeljs.io/docs/en/next/babel-polyfill).
118+
119+
To use Json-Schema-Ref-Parser in a browser, you'll need to use a bundling tool such as [Webpack](https://webpack.js.org/), [Rollup](https://rollupjs.org/), [Parcel](https://parceljs.org/), or [Browserify](http://browserify.org/). Some bundlers may require a bit of configuration, such as setting `browser: true` in [rollup-plugin-resolve](https://github.com/rollup/rollup-plugin-node-resolve).
120+
121+
122+
120123
API Documentation
121124
--------------------------
122125
Full API documentation is available [right here](https://apidevtools.org/json-schema-ref-parser/docs/)

banner.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)