Skip to content

Commit

Permalink
feat(build): new es2015 esm build, package.json#es2015
Browse files Browse the repository at this point in the history
Bundles have changed. main, module and browser fields of package.json still point to the same bundle
types. es2015 field points to the es2015 code bundle for browser. The build process has been
simplified. IMPORTANT: dist/netflux.umd.js changed to dist/netflux.browser.es5.umd.js.
  • Loading branch information
kalitine committed Jul 25, 2018
1 parent 4e62b92 commit 36bf93c
Show file tree
Hide file tree
Showing 19 changed files with 1,738 additions and 4,029 deletions.
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,41 @@ Documentation: <https://coast-team.github.io/netflux>
- Universal API (works in Chrome/Firefox and NodeJS).
- TypeScript declaration files are included.
- Simple and familiar API usage.
- 4 builds (ES5 code):
- `dist/netflux.cjs.js` CommonJS format for NodeJS (see _package.json#main_).
- `dist/esm/index.node.js` ES module format for NodeJS (see _package.json#module_).
- `dist/esm/index.browser.js` ES module format for browsers (see _package.json#browser_).
- `dist/netflux.umd.js` UMD format for browsers.
- Multiple bundles for any configuration:
- For NodeJS
- `dist/netflux.node.es5.cjs.js` commonjs format, es5 code (see _package.json#main_).
- `dist/netflux.node.es5.esm.js` ES module format, es5 code (see _package.json#module_).
- For browsers
- `dist/netflux.browser.es5.umd.js` UMD format, es5 code
- `dist/netflux.browser.es5.esm.js` ES module format, es5 code (see _package.json#browser_).
- `dist/netflux.browser.es2015.esm.js` ES module format, es2015 code (see _package.json#es2015_).
- `dist/netflux.browser.esnext.esm.js` ES module format, esnext code (see _package.json#esnext_).

## Install

```shell
npm install netflux
```

3 peer dependencies to be installed for some cases:

- `rxjs` is necessary for both NodeJS and browsers if you want to take advantage of EcmaScript modules, tree-shaking etc. Otherwise for it is already included into `dist/netflux.browser.es5.umd.js` and `dist/netflux.node.es5.cjs.js` bundles.

```shell
npm install rxjs
```

- `uws` and `text-encoding` if you target NodeJS (developing a bot):

```shell
npm install uws text-encoding
```

**Why peer dependencies?**

- Reduce the installation size by not omitting unused dependencies.
- Take advantage of new standards and techniques: EcmaScript modules, bundle tools like Webpack, RollupJS etc.

## Usage

Here is a basic usage example for client and server (checkout the [documenation](https://coast-team.github.io/netflux) for more details).
Expand Down
18 changes: 16 additions & 2 deletions manual/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,24 @@
## NPM

```shell
npm install -S netflux
npm install netflux
```

Netflux has an optional peer dependency: `wrtc`. This package provides WebRTC API in NodeJS, but for now it is not in use as more tests needed. Checkout [wrtc repository](https://github.com/js-platform/node-webrtc) for more info on it.
3 peer dependencies to be installed for some cases:

- `rxjs` is necessary for both NodeJS and browsers if you want to take advantage of EcmaScript modules, tree-shaking etc. Otherwise for it is already included into `dist/netflux.browser.es5.umd.js` and `dist/netflux.node.es5.cjs.js` bundles.

```shell
npm install rxjs
```

- `uws` and `text-encoding` if you target NodeJS (developing a bot):

```shell
npm install uws text-encoding
```

Netflux has an optional dependency: `wrtc`. This package provides WebRTC API in NodeJS, but for now it is not in use as more tests needed. Checkout [wrtc repository](https://github.com/js-platform/node-webrtc) for more info on it.

## What you need

Expand Down
Loading

0 comments on commit 36bf93c

Please sign in to comment.