Skip to content

Commit 281e6a1

Browse files
committed
move lib to src/lib and compile src/lib to cjs,
add invariant and use that instead of fbjs update rollup config to include lib folder compilation
1 parent 2e4bc40 commit 281e6a1

File tree

7 files changed

+89
-8
lines changed

7 files changed

+89
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ node_modules
66

77
# builds
88
build
9+
./lib
910
dist
1011

1112
# misc

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
example
2+
src

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-text-selection-popover",
3-
"version": "1.1.0",
4-
"description": "",
3+
"version": "1.1.1",
4+
"description": "A popover component positioned according to the current selection in a contenteditable element",
55
"author": "juliankrispel",
66
"license": "MIT",
77
"repository": "juliankrispel/react-text-selection-popover",
@@ -28,6 +28,7 @@
2828
]
2929
},
3030
"dependencies": {
31+
"invariant": "^2.2.4",
3132
"lodash.debounce": "^4.0.8",
3233
"react-event-listener": "^0.6.1",
3334
"react-measure": "^2.1.2",
@@ -59,6 +60,7 @@
5960
"eslint-plugin-standard": "^3.0.1",
6061
"flow-bin": "^0.76.0",
6162
"gh-pages": "^1.1.0",
63+
"globby": "^8.0.1",
6264
"react": "^16.2.0",
6365
"react-dom": "^16.2.0",
6466
"react-scripts": "^1.1.1",

rollup.config.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ import external from "rollup-plugin-peer-deps-external";
44
import postcss from "rollup-plugin-postcss";
55
import resolve from "rollup-plugin-node-resolve";
66
import url from "rollup-plugin-url";
7+
import globby from 'globby'
78

89
import pkg from "./package.json";
910

10-
export default {
11+
const defaultConf = {
1112
input: 'src/index.js',
1213
external: [
1314
'react-measure',
1415
'lodash.debounce',
1516
'react',
17+
'invariant',
1618
'react-dom',
1719
'prop-types',
1820
'draft-js/lib/getVisibleSelectionRect',
@@ -41,4 +43,19 @@ export default {
4143
resolve(),
4244
commonjs()
4345
]
44-
};
46+
}
47+
48+
export default [
49+
defaultConf,
50+
...globby.sync('./src/lib/*.js')
51+
.map(filePath => ({
52+
...defaultConf,
53+
input: filePath,
54+
output: [
55+
{
56+
file: filePath.replace('src\/', ''),
57+
format: 'cjs'
58+
}
59+
],
60+
}))
61+
];

src/getVisibleSelectionRect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* of patent rights can be found in the PATENTS file in the same directory.
1010
*
1111
*/
12-
import invariant from "fbjs/lib/invariant";
12+
import invariant from "invariant";
1313

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

File renamed without changes.

yarn.lock

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@
8484
lodash "^4.2.0"
8585
to-fast-properties "^2.0.0"
8686

87+
"@mrmlnc/readdir-enhanced@^2.2.1":
88+
version "2.2.1"
89+
resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde"
90+
dependencies:
91+
call-me-maybe "^1.0.1"
92+
glob-to-regexp "^0.3.0"
93+
94+
"@nodelib/fs.stat@^1.0.1":
95+
version "1.1.2"
96+
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.2.tgz#54c5a964462be3d4d78af631363c18d6fa91ac26"
97+
8798
"@vue/component-compiler-utils@^1.0.0":
8899
version "1.3.1"
89100
resolved "https://registry.yarnpkg.com/@vue/component-compiler-utils/-/component-compiler-utils-1.3.1.tgz#686f0b913d59590ae327b2a1cb4b6d9b931bbe0e"
@@ -1541,6 +1552,10 @@ cache-base@^1.0.1:
15411552
union-value "^1.0.0"
15421553
unset-value "^1.0.0"
15431554

1555+
call-me-maybe@^1.0.1:
1556+
version "1.0.1"
1557+
resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b"
1558+
15441559
caller-path@^0.1.0:
15451560
version "0.1.0"
15461561
resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f"
@@ -2317,6 +2332,13 @@ diffie-hellman@^5.0.0:
23172332
miller-rabin "^4.0.0"
23182333
randombytes "^2.0.0"
23192334

2335+
dir-glob@^2.0.0:
2336+
version "2.0.0"
2337+
resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034"
2338+
dependencies:
2339+
arrify "^1.0.1"
2340+
path-type "^3.0.0"
2341+
23202342
dns-equal@^1.0.0:
23212343
version "1.0.0"
23222344
resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d"
@@ -3058,6 +3080,17 @@ fast-deep-equal@^2.0.1:
30583080
version "2.0.1"
30593081
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
30603082

3083+
fast-glob@^2.0.2:
3084+
version "2.2.2"
3085+
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.2.tgz#71723338ac9b4e0e2fff1d6748a2a13d5ed352bf"
3086+
dependencies:
3087+
"@mrmlnc/readdir-enhanced" "^2.2.1"
3088+
"@nodelib/fs.stat" "^1.0.1"
3089+
glob-parent "^3.1.0"
3090+
is-glob "^4.0.0"
3091+
merge2 "^1.2.1"
3092+
micromatch "^3.1.10"
3093+
30613094
fast-json-stable-stringify@^2.0.0:
30623095
version "2.0.0"
30633096
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
@@ -3399,6 +3432,10 @@ glob-parent@^3.1.0:
33993432
is-glob "^3.1.0"
34003433
path-dirname "^1.0.0"
34013434

3435+
glob-to-regexp@^0.3.0:
3436+
version "0.3.0"
3437+
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab"
3438+
34023439
glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2:
34033440
version "7.1.3"
34043441
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
@@ -3463,6 +3500,18 @@ globby@^6.1.0:
34633500
pify "^2.0.0"
34643501
pinkie-promise "^2.0.0"
34653502

3503+
globby@^8.0.1:
3504+
version "8.0.1"
3505+
resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.1.tgz#b5ad48b8aa80b35b814fc1281ecc851f1d2b5b50"
3506+
dependencies:
3507+
array-union "^1.0.1"
3508+
dir-glob "^2.0.0"
3509+
fast-glob "^2.0.2"
3510+
glob "^7.1.2"
3511+
ignore "^3.3.5"
3512+
pify "^3.0.0"
3513+
slash "^1.0.0"
3514+
34663515
got@^6.7.1:
34673516
version "6.7.1"
34683517
resolved "http://registry.npmjs.org/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0"
@@ -3773,7 +3822,7 @@ ignore-walk@^3.0.1:
37733822
dependencies:
37743823
minimatch "^3.0.4"
37753824

3776-
ignore@^3.3.3, ignore@^3.3.6:
3825+
ignore@^3.3.3, ignore@^3.3.5, ignore@^3.3.6:
37773826
version "3.3.10"
37783827
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043"
37793828

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

3869-
invariant@^2.2.0, invariant@^2.2.2:
3918+
invariant@^2.2.0, invariant@^2.2.2, invariant@^2.2.4:
38703919
version "2.2.4"
38713920
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
38723921
dependencies:
@@ -4879,6 +4928,10 @@ merge-source-map@^1.1.0:
48794928
dependencies:
48804929
source-map "^0.6.1"
48814930

4931+
merge2@^1.2.1:
4932+
version "1.2.2"
4933+
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.2.tgz#03212e3da8d86c4d8523cebd6318193414f94e34"
4934+
48824935
merge@^1.2.0:
48834936
version "1.2.0"
48844937
resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da"
@@ -4905,7 +4958,7 @@ micromatch@^2.1.5, micromatch@^2.3.11:
49054958
parse-glob "^3.0.4"
49064959
regex-cache "^0.4.2"
49074960

4908-
micromatch@^3.1.4:
4961+
micromatch@^3.1.10, micromatch@^3.1.4:
49094962
version "3.1.10"
49104963
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23"
49114964
dependencies:
@@ -5510,6 +5563,12 @@ path-type@^2.0.0:
55105563
dependencies:
55115564
pify "^2.0.0"
55125565

5566+
path-type@^3.0.0:
5567+
version "3.0.0"
5568+
resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f"
5569+
dependencies:
5570+
pify "^3.0.0"
5571+
55135572
pbkdf2@^3.0.3:
55145573
version "3.0.16"
55155574
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.16.tgz#7404208ec6b01b62d85bf83853a8064f8d9c2a5c"

0 commit comments

Comments
 (0)