Skip to content

Commit

Permalink
Merge pull request #19 from Agoric/build-dist
Browse files Browse the repository at this point in the history
Add an npm build script that creates the different dist files
  • Loading branch information
katelynsills authored Feb 27, 2019
2 parents 5e67c7e + 6eb28f8 commit d534a05
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ typings/

# next.js build output
.next

# dist
dist/
42 changes: 0 additions & 42 deletions index-commonjs.js

This file was deleted.

6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"name": "@agoric/nat",
"version": "2.0.0",
"description": "Ensures that a number is within the natural numbers (0, 1, 2...) or throws a RangeError",
"main": "index-commonjs.js",
"module": "index.js",
"main": "dist/nat.cjs.js",
"module": "dist/nat.esm.js",
"browser": "dist/nat.umd.js",
"scripts": {
"test": "node test/test.js",
"create-cjs": "rollup index.js --file index-commonjs.js --format cjs",
"test": "node -r esm test/test.js",
"build": "rollup -c",
"lint-fix": "eslint --fix '**/*.{js,jsx}'",
"lint-check": "eslint '**/*.{js,jsx}'"
},
Expand All @@ -29,6 +30,7 @@
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "^7.12.4",
"esm": "^3.2.7",
"prettier": "1.16.4",
"rollup": "^1.1.2",
"tape": "^4.9.2"
Expand All @@ -40,5 +42,8 @@
"integer",
"int",
"overflow"
],
"files": [
"dist"
]
}
20 changes: 20 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export default [
{
input: 'src/index.js',
output: [
{
file: 'dist/nat.umd.js',
format: 'umd',
name: 'Nat',
},
{
file: 'dist/nat.esm.js',
format: 'esm',
},
{
file: 'dist/nat.cjs.js',
format: 'cjs',
},
],
},
];
File renamed without changes.
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint no-mixed-operators: "off" */

const test = require('tape');
const Nat = require('../index-commonjs.js');
import test from 'tape';
import Nat from '../src/index';

test('Nat() throws when not a natural number', t => {
t.equal(Nat(0), 0);
Expand Down

0 comments on commit d534a05

Please sign in to comment.