Skip to content

Commit 8bf269e

Browse files
authored
fix: build output (#799)
* fix: build output * fix types
1 parent 1d4c735 commit 8bf269e

File tree

5 files changed

+1568
-70
lines changed

5 files changed

+1568
-70
lines changed

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@
2929
],
3030
"scripts": {
3131
"bootstrap": "yarn && yarn --cwd www",
32-
"build": "rimraf lib && yarn build:cjs && yarn build:esm && yarn build:pick",
33-
"build:cjs": "babel src -d lib/cjs && rollup src/popper.ts --file lib/cjs/popper.js --format cjs --name popper --plugin @rollup/plugin-node-resolve",
34-
"build:esm": "babel src -d lib/esm --env-name esm",
35-
"build:pick": "cherry-pick ../src --cjs-dir=cjs --esm-dir=esm --cwd=lib",
32+
"build": "rimraf lib && 4c build src && yarn build:popper && yarn build:pick",
33+
"build:pick": "cherry-pick --cwd=lib --input-dir=../src --cjs-dir=cjs --esm-dir=esm",
34+
"build:popper": "rollup src/popper.ts --file lib/cjs/popper.js --format cjs --name popper --plugin @rollup/plugin-node-resolve",
3635
"deploy-docs": "yarn --cwd www build --prefix-paths && gh-pages -d www/public",
3736
"lint": "eslint www/*.js www/src src test *.js --ext .js,.ts,.tsx",
3837
"prepublishOnly": "yarn build",
@@ -75,6 +74,7 @@
7574
"react-dom": ">=16.3.0"
7675
},
7776
"devDependencies": {
77+
"@4c/cli": "^2.1.7",
7878
"@4c/rollout": "^2.1.6",
7979
"@4c/tsconfig": "^0.3.1",
8080
"@babel/cli": "^7.8.4",

src/usePopper.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ const initialPopperStyles: Partial<CSSStyleDeclaration> = {
1414
const initialArrowStyles = {};
1515

1616
// until docjs supports type exports...
17-
export type Modifier<T> = Popper.Modifier<T>;
17+
export type Modifier<Name, Options> = Popper.Modifier<Name, Options>;
1818
export type Options = Popper.Options;
1919
export type Instance = Popper.Instance;
2020
export type Placement = Popper.Placement;
2121
export type VirtualElement = Popper.VirtualElement;
2222
export type State = Popper.State;
2323

24-
export type ModifierMap = Record<string, Partial<Modifier<any>>>;
24+
export type ModifierMap = Record<string, Partial<Modifier<any, any>>>;
2525
export type Modifiers =
26-
| Partial<Modifier<any>>[]
27-
| Record<string, Partial<Modifier<any>>>;
26+
| Popper.Options['modifiers']
27+
| Record<string, Partial<Modifier<any, any>>>;
2828

2929
export function toModifierMap(modifiers: Modifiers | undefined) {
3030
const result: Modifiers = {};
@@ -114,7 +114,7 @@ function usePopper(
114114
}),
115115
);
116116

117-
const updateModifier = useMemo<Modifier<any>>(
117+
const updateModifier = useMemo<Modifier<'updateStateModifier', any>>(
118118
() => ({
119119
name: 'updateStateModifier',
120120
enabled: true,
@@ -123,7 +123,7 @@ function usePopper(
123123
fn: (data) => {
124124
setState({
125125
scheduleUpdate,
126-
outOfBoundaries: data.state.modifiersData.hide?.isReferenceHidden,
126+
outOfBoundaries: !!data.state.modifiersData.hide?.isReferenceHidden,
127127
placement: data.state.placement,
128128
styles: { ...data.state.styles?.popper },
129129
arrowStyles: { ...data.state.styles?.arrow },

tsconfig.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"extends": "@4c/tsconfig/web.json",
33
"compilerOptions": {
4-
"rootDir": "."
4+
"rootDir": "src",
5+
"outDir": "lib"
56
},
6-
"include": ["src", "www/src", "test"]
7+
"include": ["src"]
78
}

www/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "@4c/tsconfig/web.json",
3+
"compilerOptions": {
4+
"rootDir": "..",
5+
"noImplicitAny": false
6+
},
7+
"include": ["src", "../src"]
8+
}

0 commit comments

Comments
 (0)