Permalink
Browse files

Added module entry point

  • Loading branch information...
Andarist authored and jamiebuilds committed Feb 1, 2018
1 parent 6b0ff33 commit 03a41d1c3e4f391af92dff7da3292bd9fa64c118
Showing with 80 additions and 101 deletions.
  1. +1 −16 .babelrc
  2. +23 −0 .babelrc.js
  3. +7 −3 package.json
  4. +21 −0 rollup.config.js
  5. +28 −82 yarn.lock
@@ -1,16 +1 @@
{
"presets": [
[
"env",
{
"loose": true,
"targets": {
"browsers": ["last 1 version"]
}
}
],
"flow",
"react"
],
"plugins": ["transform-class-properties"]
}
{ "presets": ["./.babelrc.js"] }
@@ -0,0 +1,23 @@
const { BABEL_ENV, NODE_ENV } = process.env;
const cjs = BABEL_ENV === 'cjs' || NODE_ENV === 'test';
module.exports = {
presets: [
[
'env',
{
modules: false,
loose: true,
targets: {
browsers: ['last 1 version']
}
}
],
'flow',
'react'
],
plugins: [
'transform-class-properties',
cjs && 'transform-es2015-modules-commonjs'
].filter(Boolean)
};
@@ -3,13 +3,15 @@
"version": "1.0.1",
"description": "State ain't shit",
"main": "lib/unstated.js",
"module": "lib/unstated.es.js",
"repository": "https://github.com/thejameskyle/unstated",
"author": "James Kyle <me@thejameskyle.com>",
"license": "MIT",
"files": ["lib"],
"scripts": {
"clean": "rm -rf lib",
"build": "babel src -Dd lib && flow-copy-source src lib",
"build":
"rollup -c && flow-copy-source src lib && cp src/unstated.d.ts lib/unstated.d.ts",
"typecheck": "flow",
"test": "jest",
"format": "prettier --write **/*.{js,json,md}",
@@ -24,7 +26,7 @@
"react-dom": "^15.0.0 || ^16.0.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.6.1",
"babel-preset-flow": "^6.23.0",
@@ -42,7 +44,9 @@
"prop-types": "^15.6.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0"
"react-test-renderer": "^16.2.0",
"rollup": "^0.55.3",
"rollup-plugin-babel": "^3.0.3"
},
"lint-staged": {
"*.{js,json,md}": ["prettier --write", "git add"]
@@ -0,0 +1,21 @@
import babel from 'rollup-plugin-babel';
import pkg from './package.json';
export default {
input: 'src/unstated.js',
output: [
{
file: pkg.main,
format: 'cjs'
},
{
file: pkg.module,
format: 'es'
}
],
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {})
],
plugins: [babel()]
};
110 yarn.lock

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 03a41d1

Please sign in to comment.