Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output ESM build, and make module tree-shakeable #202

Merged
merged 1 commit into from Dec 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 12 additions & 3 deletions .babelrc
Expand Up @@ -3,7 +3,16 @@
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"rewire"
]
"env": {
"esm": {
"presets": [
["@babel/preset-env", { "modules": false }]
]
},
"test": {
"plugins": [
"rewire"
]
}
}
}
1 change: 1 addition & 0 deletions .eslintignore
@@ -1,3 +1,4 @@
examples/*
esm/*
lib/*
umd/*
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,5 +2,6 @@
*.log
*.swp
node_modules
esm
lib
umd
6 changes: 5 additions & 1 deletion package.json
Expand Up @@ -3,21 +3,25 @@
"version": "6.0.0",
"description": "A Redux binding for React Router v4",
"main": "lib/index.js",
"module": "esm/index.js",
"types": "./index.d.ts",
"sideEffects": false,
"author": "Supasate Choochaisri",
"license": "MIT",
"files": [
"*.md",
"*.js",
"*.ts",
"esm",
"lib",
"umd"
],
"scripts": {
"build:esm": "BABEL_ENV=esm babel src --out-dir esm",
"build:commonjs": "BABEL_ENV=commonjs babel src --out-dir lib",
"build:umd": "NODE_ENV=development webpack src/index.js umd/ConnectedReactRouter.js",
"build:umd:min": "NODE_ENV=production webpack -p src/index.js umd/ConnectedReactRouter.min.js",
"build": "npm run build:commonjs & npm run build:umd & npm run build:umd:min",
"build": "npm run build:esm & npm run build:commonjs & npm run build:umd & npm run build:umd:min",
"lint": "eslint .",
"test": "jest --config ./.jestrc.json",
"test:watch": "npm run test -- --watch",
Expand Down
15 changes: 0 additions & 15 deletions src/createAll.js

This file was deleted.

26 changes: 9 additions & 17 deletions src/immutable.js
@@ -1,19 +1,11 @@
import createAll from './createAll'
import createConnectedRouter from "./ConnectedRouter"
import createConnectRouter from "./reducer"
import createSelectors from "./selectors"
import immutableStructure from './structure/immutable'

export const {
LOCATION_CHANGE,
CALL_HISTORY_METHOD,
push,
replace,
go,
goBack,
goForward,
routerActions,
ConnectedRouter,
connectRouter,
routerMiddleware,
getLocation,
getAction,
createMatchSelector,
} = createAll(immutableStructure)
export { LOCATION_CHANGE, CALL_HISTORY_METHOD, push, replace, go, goBack, goForward, routerActions } from "./actions"
export { default as routerMiddleware } from "./middleware"

export const ConnectedRouter = /*#__PURE__*/ createConnectedRouter(immutableStructure)
export const connectRouter = /*#__PURE__*/ createConnectRouter(immutableStructure)
export const { getLocation, getAction, createMatchSelector } = /*#__PURE__*/ createSelectors(immutableStructure)
28 changes: 10 additions & 18 deletions src/index.js
@@ -1,19 +1,11 @@
import createAll from './createAll'
import plainStructure from './structure/plain'
import createConnectedRouter from "./ConnectedRouter"
import createConnectRouter from "./reducer"
import createSelectors from "./selectors"
import plainStructure from "./structure/plain"

export const {
LOCATION_CHANGE,
CALL_HISTORY_METHOD,
push,
replace,
go,
goBack,
goForward,
routerActions,
ConnectedRouter,
connectRouter,
routerMiddleware,
getLocation,
getAction,
createMatchSelector,
} = createAll(plainStructure)
export { LOCATION_CHANGE, CALL_HISTORY_METHOD, push, replace, go, goBack, goForward, routerActions } from "./actions"
export { default as routerMiddleware } from "./middleware"

export const ConnectedRouter = /*#__PURE__*/ createConnectedRouter(plainStructure)
export const connectRouter = /*#__PURE__*/ createConnectRouter(plainStructure)
export const { getLocation, getAction, createMatchSelector } = /*#__PURE__*/ createSelectors(plainStructure)
26 changes: 9 additions & 17 deletions src/seamless-immutable.js
@@ -1,19 +1,11 @@
import createAll from './createAll'
import createConnectedRouter from "./ConnectedRouter"
import createConnectRouter from "./reducer"
import createSelectors from "./selectors"
import immutableStructure from './structure/seamless-immutable'

export const {
LOCATION_CHANGE,
CALL_HISTORY_METHOD,
push,
replace,
go,
goBack,
goForward,
routerActions,
ConnectedRouter,
connectRouter,
routerMiddleware,
getLocation,
getAction,
createMatchSelector,
} = createAll(immutableStructure)
export { LOCATION_CHANGE, CALL_HISTORY_METHOD, push, replace, go, goBack, goForward, routerActions } from "./actions"
export { default as routerMiddleware } from "./middleware"

export const ConnectedRouter = /*#__PURE__*/ createConnectedRouter(immutableStructure)
export const connectRouter = /*#__PURE__*/ createConnectRouter(immutableStructure)
export const { getLocation, getAction, createMatchSelector } = /*#__PURE__*/ createSelectors(immutableStructure)