Skip to content

Commit bde3afa

Browse files
jkillianstipsan
authored andcommitted
Add module build (#106)
* add non-bundled build * clean up typings for this build
1 parent 5164900 commit bde3afa

File tree

4 files changed

+1169
-461
lines changed

4 files changed

+1169
-461
lines changed

.babelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "presets": ["env"] }

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
"name": "scroll-into-view-if-needed",
33
"version": "1.0.6",
44
"description": "Element.scrollIntoViewIfNeeded ponyfill that can animate the scrolling",
5-
"main": "dist/bundle.js",
5+
"main": "dist/index.js",
66
"typings": "typings.d.ts",
77
"scripts": {
88
"test": "echo \"Error: no test specified\" && exit 1",
9-
"build": "rollup src/index.js --format cjs -c --output dist/bundle.js && rollup test/index.js -c -f umd --output test/bundle.js",
9+
"build": "npm run clean && npm run build-module && npm run build-bundle",
10+
"build-module": "babel src -d dist",
11+
"build-bundle": "rollup src/index.js --format cjs -c --output dist/bundle.js && rollup test/index.js -c -f umd --output test/bundle.js",
12+
"clean": "rm -rf dist",
1013
"prepublish": "npm run build",
1114
"postversion": "git add package.json && git commit -m \"chore(package): update version\"",
1215
"postpublish": "gh-release"
@@ -32,7 +35,8 @@
3235
"amator": "^1.0.1"
3336
},
3437
"devDependencies": {
35-
"babel": "^6.5.2",
38+
"babel-cli": "^6.23.0",
39+
"babel-preset-env": "^1.2.1",
3640
"babel-preset-es2015-rollup": "^3.0.0",
3741
"gh-release": "^2.2.1",
3842
"rollup": "^0.41.4",

typings.d.ts

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
declare module 'scroll-into-view-if-needed' {
2-
interface ScrollIntoViewIfNeededOptions {
3-
centerIfNeeded?: boolean;
4-
duration?: number;
5-
easing?: 'ease' | 'easeIn' | 'easeOut' | 'easeInOut' | 'linear';
6-
}
7-
8-
interface ScrollIntoViewIfNeededFunction {
9-
(
10-
node: Element,
11-
centerIfNeeded: boolean,
12-
options?: ScrollIntoViewIfNeededOptions,
13-
): void;
14-
}
15-
const ScrollIntoViewIfNeeded: ScrollIntoViewIfNeededFunction;
16-
export = ScrollIntoViewIfNeeded;
1+
export interface ScrollIntoViewIfNeededOptions {
2+
centerIfNeeded?: boolean;
3+
duration?: number;
4+
easing?: 'ease' | 'easeIn' | 'easeOut' | 'easeInOut' | 'linear';
175
}
6+
7+
export default function(
8+
node: Element,
9+
centerIfNeeded: boolean,
10+
options?: ScrollIntoViewIfNeededOptions,
11+
): void;

0 commit comments

Comments
 (0)