Skip to content

Commit

Permalink
chore: fix npm build scripts on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
alisd23 committed Oct 19, 2016
1 parent a6a50a6 commit f00eedc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions modules/TransitionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,20 @@ const enterHooks = new PendingHooks()
const changeHooks = new PendingHooks()

function createTransitionHook(hook, route, asyncArity, pendingHooks) {
const isSync = hook.length < asyncArity

const transitionHook = (...args) => {
hook.apply(route, args)

if (hook.length < asyncArity) {
if (isSync) {
let callback = args[args.length - 1]
// Add synchronous hook to pendingHooks (gets removed instantly later)
pendingHooks.add(transitionHook)
// Assume hook executes synchronously and
// automatically call the callback.
callback()
}
}

if (hook.length >= asyncArity) {
pendingHooks.add(transitionHook)
}
pendingHooks.add(transitionHook)

return transitionHook
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"bugs": "https://github.com/ReactTraining/react-router/issues",
"scripts": {
"build": "npm run build-cjs && npm run build-es",
"build-cjs": "rimraf lib && cross-env BABEL_ENV=cjs babel ./modules -d lib --ignore '__tests__'",
"build-es": "rimraf es && cross-env BABEL_ENV=es babel ./modules -d es --ignore '__tests__'",
"build-cjs": "rimraf lib && cross-env BABEL_ENV=cjs babel ./modules -d lib --ignore __tests__",
"build-es": "rimraf es && cross-env BABEL_ENV=es babel ./modules -d es --ignore __tests__",
"build-umd": "cross-env NODE_ENV=development webpack modules/index.js umd/ReactRouter.js",
"build-min": "cross-env NODE_ENV=production webpack -p modules/index.js umd/ReactRouter.min.js",
"lint": "eslint examples modules scripts tools *.js",
Expand Down

0 comments on commit f00eedc

Please sign in to comment.