Skip to content

Commit c96cd26

Browse files
committed
migrated build to rollup/npm
enabled react-jsx in runtime
1 parent 7104cf8 commit c96cd26

22 files changed

+141
-2265
lines changed

dist/css/styles.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.d.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

dist/react-ios-scroll-lock.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/types/IosScrollLock.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import './css/styles.css';
3+
export interface IosScrollLockProps {
4+
bgColor?: string;
5+
isInline?: boolean;
6+
className?: string;
7+
isOpen?: boolean;
8+
children: React.ReactNode;
9+
}
10+
declare function IosScrollLock({ children, isOpen, isInline, className, bgColor, }: IosScrollLockProps): React.JSX.Element;
11+
export default IosScrollLock;

dist/types/index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import IosScrollLock from './IosScrollLock';
2+
export default IosScrollLock;
3+
export { IosScrollLock };
4+
export type { IosScrollLockProps } from './IosScrollLock';
5+
export * from './IosScrollLock';

package.json

Lines changed: 41 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,48 @@
22
"name": "react-ios-scroll-lock",
33
"author": "Arsen Mkrtchyan (stripearmy)",
44
"private": false,
5-
"version": "1.0.7",
5+
"version": "1.0.10",
66
"description": "A lightweight CSS-only scroll lock solution for iOS Safari and Android",
7-
"type": "module",
8-
"main": "dist/react-ios-scroll-lock.umd.js",
9-
"module": "dist/react-ios-scroll-lock.es.js",
10-
"types": "dist/index.d.ts",
117
"repository": "https://github.com/stripearmy/react-ios-scroll-lock.git",
12-
"license": "MIT",
8+
"type": "module",
9+
"exports": {
10+
".": {
11+
"import": "./dist/react-ios-scroll-lock.esm.js",
12+
"require": "./dist/react-ios-scroll-lock.js",
13+
"types": "./dist/types/index.d.ts"
14+
},
15+
"./css": "./dist/css/index.js",
16+
"./styles.css": "./dist/css/styles.css"
17+
},
18+
"main": "dist/react-ios-scroll-lock.js",
19+
"module": "dist/react-ios-scroll-lock.esm.js",
20+
"types": "dist/types/index.d.ts",
21+
"files": [
22+
"dist"
23+
],
24+
"scripts": {
25+
"clean": "rm -rf dist",
26+
"build": "npx rollup -c",
27+
"prepare": "npm run build"
28+
},
29+
"peerDependencies": {
30+
"react": ">=16.8.0",
31+
"react-dom": ">=16.8.0"
32+
},
33+
"devDependencies": {
34+
"@rollup/plugin-commonjs": "^24.0.1",
35+
"@rollup/plugin-node-resolve": "^15.0.1",
36+
"@rollup/plugin-terser": "^0.4.3",
37+
"@rollup/plugin-typescript": "^11.0.0",
38+
"@types/node": "^20.11.0",
39+
"@types/react": "^18.0.28",
40+
"@types/react-dom": "^18.0.11",
41+
"rollup": "^3.29.4",
42+
"rollup-plugin-copy": "^3.5.0",
43+
"rollup-plugin-postcss": "^4.0.2",
44+
"tslib": "^2.6.2",
45+
"typescript": "^4.9.5"
46+
},
1347
"keywords": [
1448
"react",
1549
"scroll lock",
@@ -63,47 +97,5 @@
6397
"lightweight scroll lock css",
6498
"lightweight-scroll-lock-css"
6599
],
66-
"files": [
67-
"dist",
68-
"styles"
69-
],
70-
"exports": {
71-
".": {
72-
"types": "./dist/index.d.ts",
73-
"import": "./dist/react-ios-scroll-lock.umd.js"
74-
},
75-
"./css": {
76-
"types": "./dist/index.d.ts",
77-
"import": "./dist/react-ios-scroll-lock.css"
78-
}
79-
},
80-
"scripts": {
81-
"dev": "vite",
82-
"build": "tsc -b && vite build",
83-
"lint": "eslint .",
84-
"preview": "vite preview"
85-
},
86-
"peerDependencies": {
87-
"react": ">= 16.8.0",
88-
"react-dom": ">= 16.8.0"
89-
},
90-
"devDependencies": {
91-
"@eslint/js": "^9.21.0",
92-
"@types/node": "^22.13.10",
93-
"@types/react": "^19.0.10",
94-
"@types/react-dom": "^19.0.4",
95-
"@vitejs/plugin-react": "^4.3.4",
96-
"eslint": "^9.21.0",
97-
"eslint-plugin-react-hooks": "^5.1.0",
98-
"eslint-plugin-react-refresh": "^0.4.19",
99-
"globals": "^15.15.0",
100-
"prettier": "3.5.3",
101-
"typescript": "~5.7.2",
102-
"typescript-eslint": "^8.24.1",
103-
"vite": "^6.2.0",
104-
"vite-plugin-static-copy": "^2.3.0",
105-
"react": ">= 16.8.0",
106-
"react-dom": ">= 16.8.0",
107-
"vite-plugin-dts": "^4.5.3"
108-
}
100+
"license": "MIT"
109101
}

rollup.config.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import path from 'path';
2+
import commonjs from '@rollup/plugin-commonjs';
3+
import resolve from '@rollup/plugin-node-resolve';
4+
import typescript from '@rollup/plugin-typescript';
5+
import postcss from 'rollup-plugin-postcss';
6+
import terser from '@rollup/plugin-terser';
7+
import copy from 'rollup-plugin-copy';
8+
9+
export default {
10+
input: 'src/index.ts',
11+
output: [
12+
{
13+
file: 'dist/react-ios-scroll-lock.js',
14+
format: 'cjs',
15+
exports: 'named',
16+
sourcemap: false
17+
},
18+
{
19+
file: 'dist/react-ios-scroll-lock.esm.js',
20+
format: 'esm',
21+
exports: 'named',
22+
sourcemap: false
23+
}
24+
],
25+
plugins: [
26+
resolve(),
27+
commonjs(),
28+
typescript({
29+
tsconfig: './tsconfig.json',
30+
jsx: 'react',
31+
declaration: true,
32+
declarationDir: 'dist/types'
33+
}),
34+
postcss({
35+
extract: path.resolve('dist/css/styles.css'),
36+
minimize: true
37+
}),
38+
copy({
39+
targets: [
40+
{
41+
src: 'src/css/index.js',
42+
dest: 'dist/css'
43+
}
44+
]
45+
}),
46+
terser()
47+
],
48+
external: ['react', 'react-dom', 'react/jsx-runtime']
49+
};

src/IosScrollLock.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ interface IosScrollLockProps {
88
isOpen?: boolean;
99
children: React.ReactNode;
1010
}
11+
1112
declare function IosScrollLock({ children, isOpen, isInline, className, bgColor, }: IosScrollLockProps): import("react/jsx-runtime").JSX.Element;
13+
1214
export default IosScrollLock;

src/IosScrollLock.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, {useEffect} from 'react';
2-
import("./styles/styles.css");
2+
import './css/styles.css';
33

4-
interface IosScrollLockProps {
4+
export interface IosScrollLockProps {
55
bgColor?: string;
66
isInline?: boolean;
77
className?: string;

src/css/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './styles.css';

0 commit comments

Comments
 (0)