Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build output #799

Merged
merged 2 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
],
"scripts": {
"bootstrap": "yarn && yarn --cwd www",
"build": "rimraf lib && yarn build:cjs && yarn build:esm && yarn build:pick",
"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",
"build:esm": "babel src -d lib/esm --env-name esm",
"build:pick": "cherry-pick ../src --cjs-dir=cjs --esm-dir=esm --cwd=lib",
"build": "rimraf lib && 4c build src && yarn build:popper && yarn build:pick",
"build:pick": "cherry-pick --cwd=lib --input-dir=../src --cjs-dir=cjs --esm-dir=esm",
"build:popper": "rollup src/popper.ts --file lib/cjs/popper.js --format cjs --name popper --plugin @rollup/plugin-node-resolve",
"deploy-docs": "yarn --cwd www build --prefix-paths && gh-pages -d www/public",
"lint": "eslint www/*.js www/src src test *.js --ext .js,.ts,.tsx",
"prepublishOnly": "yarn build",
Expand Down Expand Up @@ -75,6 +74,7 @@
"react-dom": ">=16.3.0"
},
"devDependencies": {
"@4c/cli": "^2.1.7",
"@4c/rollout": "^2.1.6",
"@4c/tsconfig": "^0.3.1",
"@babel/cli": "^7.8.4",
Expand Down
12 changes: 6 additions & 6 deletions src/usePopper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ const initialPopperStyles: Partial<CSSStyleDeclaration> = {
const initialArrowStyles = {};

// until docjs supports type exports...
export type Modifier<T> = Popper.Modifier<T>;
export type Modifier<Name, Options> = Popper.Modifier<Name, Options>;
export type Options = Popper.Options;
export type Instance = Popper.Instance;
export type Placement = Popper.Placement;
export type VirtualElement = Popper.VirtualElement;
export type State = Popper.State;

export type ModifierMap = Record<string, Partial<Modifier<any>>>;
export type ModifierMap = Record<string, Partial<Modifier<any, any>>>;
export type Modifiers =
| Partial<Modifier<any>>[]
| Record<string, Partial<Modifier<any>>>;
| Popper.Options['modifiers']
| Record<string, Partial<Modifier<any, any>>>;

export function toModifierMap(modifiers: Modifiers | undefined) {
const result: Modifiers = {};
Expand Down Expand Up @@ -114,7 +114,7 @@ function usePopper(
}),
);

const updateModifier = useMemo<Modifier<any>>(
const updateModifier = useMemo<Modifier<'updateStateModifier', any>>(
() => ({
name: 'updateStateModifier',
enabled: true,
Expand All @@ -123,7 +123,7 @@ function usePopper(
fn: (data) => {
setState({
scheduleUpdate,
outOfBoundaries: data.state.modifiersData.hide?.isReferenceHidden,
outOfBoundaries: !!data.state.modifiersData.hide?.isReferenceHidden,
placement: data.state.placement,
styles: { ...data.state.styles?.popper },
arrowStyles: { ...data.state.styles?.arrow },
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "@4c/tsconfig/web.json",
"compilerOptions": {
"rootDir": "."
"rootDir": "src",
"outDir": "lib"
},
"include": ["src", "www/src", "test"]
"include": ["src"]
}
8 changes: 8 additions & 0 deletions www/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@4c/tsconfig/web.json",
"compilerOptions": {
"rootDir": "..",
"noImplicitAny": false
},
"include": ["src", "../src"]
}
Loading