Skip to content

Commit

Permalink
Prepare for publish
Browse files Browse the repository at this point in the history
  • Loading branch information
samal-rasmussen committed Sep 15, 2020
1 parent 066e1d3 commit 448edc0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ It checks that the chunk layout is correct, and it checks that the crc code for
Usage
---

This library exposes a single function `pngValidator` that takes a single parameter, which is a Uint8Array with the raw Png file data. It will throw an error if the files is _not_ valid.
Png Validator is built both as a cjs and es bundle, so you can use it in the backend and frontend.

There is only a single function exposed called `pngValidator` that takes a single parameter, which is a Uint8Array with the raw Png file data. It will throw an error if the file is _not_ valid.

```
// node
const pngValidator = require('png-validator');
// browser / bundler
import { pngValidator } from 'png-validator';
try {
pngValidator(buffer);
// success
} catch (e) {
// file is corrupt
}
```

Png Validator is build both as a cjs and es bundle, so you can use it in the backend and frontend.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "Png validator checks Png files for corruption",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"browser": "dist/index.iife.js",
"types": "index.d.ts",
"types": "dist/index.d.ts",
"author": "Sámal Rasmussen",
"license": "MIT",
"repository": {
Expand All @@ -24,12 +23,13 @@
"correct",
"checker"
],
"sideEffects": false,
"scripts": {
"build": "rollup -c && tsc",
"lint": "eslint . --ext .ts",
"test": "yarn run build && tape test/test.js",
"publish-for-real": "npm publish --registry https://registry.npmjs.org/",
"publish-dry-run": "npm publish --registry https://registry.npmjs.org/ --dry-run"
"publish-for-real": "npm publish --registry https://registry.npmjs.org/ --access public",
"publish-dry-run": "npm publish --registry https://registry.npmjs.org/ --access public --dry-run"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
format: 'es',
},
{
file: pkg.browser,
file: 'dist/index.iife.js',
format: 'iife',
name: 'PngValidator',
},
Expand Down

0 comments on commit 448edc0

Please sign in to comment.