make ready for npm package publication

This commit is contained in:
Daniel
2019-02-05 14:18:36 -06:00
parent 56b8dafcd4
commit baeb1986f5
2 changed files with 26 additions and 3 deletions
+14 -1
View File
@@ -20,13 +20,26 @@ The development of this library is sponsored by [nimiq](https://www.nimiq.com),
## Demo
See https://nimiq.github.io/qr-scanner/demo/
## Installation
To install via npm:
```bash
npm install --safe qr-scanner
```
To install via yarn:
```bash
yarn add qr-scanner
```
Or simply copy `qr-scanner.min.js` and `qr-scanner-worker.min.js` to your project.
## Setup
The QR Scanner consists of two files.
`qr-scanner.min.js` is the main API as an es6 module and can be imported as follows:
```js
import QrScanner from 'path/to/qr-scanner.min.js';
import QrScanner from 'path/to/qr-scanner.min.js'; // if using plain es6 import
import QrScanner from 'qr-scanner'; // if installed via package and bundling with webpack or rollup
```
This requires the importing script to also be an es6 module or a module script tag, e.g.:
```html
+12 -2
View File
@@ -1,10 +1,20 @@
{
"name": "qr-scanner",
"version": "0.5.0",
"version": "1.0.0",
"description": "A javascript QR scanner library",
"main": "qr-scanner.min.js",
"browser": "qr-scanner.min.js",
"module": "src/qr-scanner.js",
"types": "types/qr-scanner.d.ts",
"files": [
"LICENSE",
"qr-scanner.min.js",
"qr-scanner.min.js.map",
"qr-scanner-worker.min.js",
"qr-scanner-worker.min.js.map",
"src/qr-scanner.js",
"types/qr-scanner.d.ts"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "gulp"
@@ -21,7 +31,7 @@
"javascript",
"web"
],
"author": "Nimiq",
"author": "Nimiq (https://nimiq.com)",
"license": "MIT",
"bugs": {
"url": "https://github.com/nimiq/qr-scanner/issues"