Skip to content

Commit

Permalink
move lib to src/lib and compile src/lib to cjs,
Browse files Browse the repository at this point in the history
add invariant and use that instead of fbjs
update rollup config to include lib folder compilation
  • Loading branch information
juliankrispel committed Sep 13, 2018
1 parent 2e4bc40 commit 281e6a1
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node_modules

# builds
build
./lib
dist

# misc
Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
example
src
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-text-selection-popover",
"version": "1.1.0",
"description": "",
"version": "1.1.1",
"description": "A popover component positioned according to the current selection in a contenteditable element",
"author": "juliankrispel",
"license": "MIT",
"repository": "juliankrispel/react-text-selection-popover",
Expand All @@ -28,6 +28,7 @@
]
},
"dependencies": {
"invariant": "^2.2.4",
"lodash.debounce": "^4.0.8",
"react-event-listener": "^0.6.1",
"react-measure": "^2.1.2",
Expand Down Expand Up @@ -59,6 +60,7 @@
"eslint-plugin-standard": "^3.0.1",
"flow-bin": "^0.76.0",
"gh-pages": "^1.1.0",
"globby": "^8.0.1",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-scripts": "^1.1.1",
Expand Down
21 changes: 19 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ import external from "rollup-plugin-peer-deps-external";
import postcss from "rollup-plugin-postcss";
import resolve from "rollup-plugin-node-resolve";
import url from "rollup-plugin-url";
import globby from 'globby'

import pkg from "./package.json";

export default {
const defaultConf = {
input: 'src/index.js',
external: [
'react-measure',
'lodash.debounce',
'react',
'invariant',
'react-dom',
'prop-types',
'draft-js/lib/getVisibleSelectionRect',
Expand Down Expand Up @@ -41,4 +43,19 @@ export default {
resolve(),
commonjs()
]
};
}

export default [
defaultConf,
...globby.sync('./src/lib/*.js')
.map(filePath => ({
...defaultConf,
input: filePath,
output: [
{
file: filePath.replace('src\/', ''),
format: 'cjs'
}
],
}))
];
2 changes: 1 addition & 1 deletion src/getVisibleSelectionRect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
import invariant from "fbjs/lib/invariant";
import invariant from "invariant";

var isChrome = /chrome/gi.test(window.navigator.userAgent);

Expand Down
File renamed without changes.
65 changes: 62 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@
lodash "^4.2.0"
to-fast-properties "^2.0.0"

"@mrmlnc/readdir-enhanced@^2.2.1":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde"
dependencies:
call-me-maybe "^1.0.1"
glob-to-regexp "^0.3.0"

"@nodelib/fs.stat@^1.0.1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.2.tgz#54c5a964462be3d4d78af631363c18d6fa91ac26"

"@vue/component-compiler-utils@^1.0.0":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@vue/component-compiler-utils/-/component-compiler-utils-1.3.1.tgz#686f0b913d59590ae327b2a1cb4b6d9b931bbe0e"
Expand Down Expand Up @@ -1541,6 +1552,10 @@ cache-base@^1.0.1:
union-value "^1.0.0"
unset-value "^1.0.0"

call-me-maybe@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b"

caller-path@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f"
Expand Down Expand Up @@ -2317,6 +2332,13 @@ diffie-hellman@^5.0.0:
miller-rabin "^4.0.0"
randombytes "^2.0.0"

dir-glob@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034"
dependencies:
arrify "^1.0.1"
path-type "^3.0.0"

dns-equal@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d"
Expand Down Expand Up @@ -3058,6 +3080,17 @@ fast-deep-equal@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"

fast-glob@^2.0.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.2.tgz#71723338ac9b4e0e2fff1d6748a2a13d5ed352bf"
dependencies:
"@mrmlnc/readdir-enhanced" "^2.2.1"
"@nodelib/fs.stat" "^1.0.1"
glob-parent "^3.1.0"
is-glob "^4.0.0"
merge2 "^1.2.1"
micromatch "^3.1.10"

fast-json-stable-stringify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
Expand Down Expand Up @@ -3399,6 +3432,10 @@ glob-parent@^3.1.0:
is-glob "^3.1.0"
path-dirname "^1.0.0"

glob-to-regexp@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab"

glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2:
version "7.1.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
Expand Down Expand Up @@ -3463,6 +3500,18 @@ globby@^6.1.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"

globby@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.1.tgz#b5ad48b8aa80b35b814fc1281ecc851f1d2b5b50"
dependencies:
array-union "^1.0.1"
dir-glob "^2.0.0"
fast-glob "^2.0.2"
glob "^7.1.2"
ignore "^3.3.5"
pify "^3.0.0"
slash "^1.0.0"

got@^6.7.1:
version "6.7.1"
resolved "http://registry.npmjs.org/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0"
Expand Down Expand Up @@ -3773,7 +3822,7 @@ ignore-walk@^3.0.1:
dependencies:
minimatch "^3.0.4"

ignore@^3.3.3, ignore@^3.3.6:
ignore@^3.3.3, ignore@^3.3.5, ignore@^3.3.6:
version "3.3.10"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043"

Expand Down Expand Up @@ -3866,7 +3915,7 @@ interpret@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614"

invariant@^2.2.0, invariant@^2.2.2:
invariant@^2.2.0, invariant@^2.2.2, invariant@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
dependencies:
Expand Down Expand Up @@ -4879,6 +4928,10 @@ merge-source-map@^1.1.0:
dependencies:
source-map "^0.6.1"

merge2@^1.2.1:
version "1.2.2"
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.2.tgz#03212e3da8d86c4d8523cebd6318193414f94e34"

merge@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da"
Expand All @@ -4905,7 +4958,7 @@ micromatch@^2.1.5, micromatch@^2.3.11:
parse-glob "^3.0.4"
regex-cache "^0.4.2"

micromatch@^3.1.4:
micromatch@^3.1.10, micromatch@^3.1.4:
version "3.1.10"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23"
dependencies:
Expand Down Expand Up @@ -5510,6 +5563,12 @@ path-type@^2.0.0:
dependencies:
pify "^2.0.0"

path-type@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f"
dependencies:
pify "^3.0.0"

pbkdf2@^3.0.3:
version "3.0.16"
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.16.tgz#7404208ec6b01b62d85bf83853a8064f8d9c2a5c"
Expand Down

0 comments on commit 281e6a1

Please sign in to comment.