1 | # [Loom.js](https://loomx.io) [![Build Status](https://travis-ci.org/loomnetwork/loom-js.svg?branch=master)](https://travis-ci.org/loomnetwork/loom-js)
|
2 |
|
3 | JS library for building browser apps & NodeJS services that interact with Loom DAppChains.
|
4 |
|
5 | ## Install
|
6 |
|
7 | ### NodeJS
|
8 |
|
9 | ```
|
10 | # NPM
|
11 | npm install loom-js
|
12 | # Yarn
|
13 | yarn add loom-js
|
14 | ```
|
15 |
|
16 | ### Browser
|
17 |
|
18 | ```html
|
19 | <script src="https://cdn.jsdelivr.net/npm/loom-js@1.9.0/dist/loom.umd.js"></script>
|
20 | ```
|
21 |
|
22 | ## Development
|
23 |
|
24 | ```shell
|
25 | # build for Node
|
26 | yarn build
|
27 | # build for Browser
|
28 | yarn build:browser
|
29 | # run unit tests on Node & Browser
|
30 | yarn test
|
31 | # auto-format source files
|
32 | yarn format
|
33 | # run unit tests in Node
|
34 | yarn test:node
|
35 | # run unit tests in Electon
|
36 | yarn test:browser
|
37 | # run e2e test in Node (local DAppChain node must be running first)
|
38 | yarn e2e:node
|
39 | # run e2e test in Electron (local DAppChain node must be running first)
|
40 | yarn e2e:browser
|
41 | ```
|
42 |
|
43 | The e2e test environment can be configured by changing `.env.test` (see `.env.test.example` for
|
44 | default values).
|
45 |
|
46 | ### Regenerating Protobufs
|
47 |
|
48 | Whenever you change `src/proto/loom.proto`, or `src/tests/tests.proto` you will need to regenerate
|
49 | the corresponding `*_pb.js` by running:
|
50 |
|
51 | ```shell
|
52 | yarn proto
|
53 | ```
|
54 |
|
55 | The shell must be able to locate the `protoc` binary, which can be obtained from https://github.com/google/protobuf/releases
|
56 |
|
57 | ## License
|
58 |
|
59 | BSD 3-Clause, see `LICENSE` file for details.
|