Skip to content

Commit

Permalink
Bundle of love. Closes #24 (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreardon authored Jun 29, 2018
1 parent 2739329 commit 1eac004
Show file tree
Hide file tree
Showing 6 changed files with 735 additions and 534 deletions.
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ node_modules/
.DS_Store

# generated files
lib/
esm/
dist/

# editors
.idea
.vscode
.vscode

# yard
yarn-error.log
4 changes: 0 additions & 4 deletions .npmignore

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js
cache: yarn
node_js:
- '8.4'
- '8.11.3'
script:
- yarn run validate
- yarn run test
45 changes: 23 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "memoize-one",
"version": "3.1.1",
"description": "A memoization library which only remembers the latest invocation",
"main": "lib/index.js",
"module": "esm/index.js",
"main": "dist/memoize-one.cjs.js",
"module": "dist/memoize-one.esm.js",
"sideEffects": false,
"author": "Alex Reardon <[email protected]>",
"license": "MIT",
Expand All @@ -12,8 +12,7 @@
"url": "https://github.com/alexreardon/memoize-one.git"
},
"files": [
"/lib",
"/esm",
"/dist",
"/src"
],
"keywords": [
Expand All @@ -25,33 +24,35 @@
"dependencies": {},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-core": "6.26.0",
"babel-eslint": "8.2.2",
"babel-core": "6.26.3",
"babel-eslint": "8.2.5",
"babel-plugin-transform-flow-strip-types": "6.22.0",
"babel-plugin-transform-object-rest-spread": "6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-env": "^1.7.0",
"babel-preset-flow": "^6.23.0",
"chai": "4.1.2",
"cross-env": "^5.1.4",
"eslint": "4.19.0",
"eslint-plugin-flowtype": "^2.46.1",
"eslint-plugin-jest": "^21.15.0",
"flow-bin": "0.68.0",
"flow-copy-source": "1.3.0",
"jest": "^22.4.2",
"rimraf": "2.6.2"
"cross-env": "^5.2.0",
"eslint": "5.0.1",
"eslint-plugin-flowtype": "^2.49.3",
"eslint-plugin-jest": "^21.17.0",
"flow-bin": "0.75.0",
"jest": "^23.2.0",
"rimraf": "2.6.2",
"rollup": "^0.62.0",
"rollup-plugin-babel": "^3.0.5",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-uglify": "^4.0.0"
},
"scripts": {
"validate": "yarn run lint && yarn run typecheck",
"test": "cross-env NODE_ENV=test jest",
"typecheck": "flow check",
"lint": "eslint src test -",
"lint:fix": "yarn run lint --fix",
"build": "yarn run build:clean && yarn run build:lib && yarn run build:esm && yarn run build:flow",
"build:clean": "rimraf lib esm",
"build:lib": "cross-env NODE_ENV=cjs babel src -d lib",
"build:esm": "babel src --out-dir esm",
"build:flow": "flow-copy-source --verbose src lib && flow-copy-source --verbose src esm",
"lint": "eslint src test",
"build": "yarn run build:clean && yarn run build:dist && yarn run build:flow",
"build:clean": "rimraf dist",
"build:dist": "rollup -c",
"build:flow": "echo \"// @flow\n\nexport * from '../src';\" > dist/memoize-one.cjs.js.flow",
"prepublish": "yarn run build"
}
}
59 changes: 59 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// @flow
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
import { uglify } from 'rollup-plugin-uglify';

const input = 'src/index.js';

export default [
// Universal module definition (UMD) build
{
input,
output: {
file: 'dist/memoize-one.js',
format: 'umd',
name: 'memoizeOne',
},
plugins: [
// Setting development env before running babel etc
replace({ 'process.env.NODE_ENV': JSON.stringify('development') }),
babel(),
commonjs({ include: 'node_modules/**' }),
],
},
// Universal module definition (UMD) build (production)
{
input,
output: {
file: 'dist/memoize-one.min.js',
format: 'umd',
name: 'memoizeOne',
},
plugins: [
// Setting production env before running babel etc
replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
babel(),
commonjs({ include: 'node_modules/**' }),
uglify(),
],
},
// ESM build
{
input,
output: {
file: 'dist/memoize-one.esm.js',
format: 'es',
},
plugins: [babel()],
},
// CommonJS build
{
input,
output: {
file: 'dist/memoize-one.cjs.js',
format: 'cjs',
},
plugins: [babel()],
},
];
Loading

0 comments on commit 1eac004

Please sign in to comment.