Skip to content

Commit

Permalink
feat: consistent exports (#37)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: no more default export

- removed default export
- name files properly

* Use default exports
  • Loading branch information
TrySound authored and jquense committed Jun 18, 2019
1 parent c545d42 commit 6b51ec6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"repository": "jquense/uncontrollable",
"license": "MIT",
"main": "lib/index.js",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"keywords": [
"uncontrolled-component",
Expand All @@ -22,9 +22,9 @@
"test": "jest",
"tdd": "jest --watch",
"lint": "eslint src test",
"build:cjs": "NODE_ENV=production babel src --out-dir lib/",
"build:esm": "NODE_ENV=production BABEL_ENV=esm babel src --out-dir lib/esm && mv lib/esm/index-esm.js lib/esm/index.js",
"build": "rimraf lib && yarn build:cjs && yarn build:esm && cp package.json lib/",
"build:cjs": "NODE_ENV=production babel src --out-dir lib/cjs",
"build:esm": "NODE_ENV=production BABEL_ENV=esm babel src --out-dir lib/esm",
"build": "rimraf lib && yarn build:cjs && yarn build:esm",
"prepublishOnly": "npm run build",
"semantic-release": "semantic-release",
"travis-deploy-once": "travis-deploy-once"
Expand Down
7 changes: 2 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
const { default: uncontrollable, useUncontrolled } = require('./index-esm')

module.exports = uncontrollable
module.exports.useUncontrolled = useUncontrolled
module.exports.uncontrollable = uncontrollable
export { default as useUncontrolled } from './hook.js';
export { default as uncontrollable } from './uncontrollable.js';
6 changes: 1 addition & 5 deletions src/index-esm.js → src/uncontrollable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import React from 'react'
import invariant from 'invariant'
import * as Utils from './utils'

export { default as useUncontrolled } from './hook.js'

export function uncontrollable(Component, controlledValues, methods = []) {
export default function uncontrollable(Component, controlledValues, methods = []) {
let displayName = Component.displayName || Component.name || 'Component'
let canAcceptRef = Utils.canAcceptRef(Component)

Expand Down Expand Up @@ -147,5 +145,3 @@ export function uncontrollable(Component, controlledValues, methods = []) {

return WrappedComponent
}

export default uncontrollable

0 comments on commit 6b51ec6

Please sign in to comment.