Skip to content

Commit 74bdf89

Browse files
committed
initial commit
0 parents  commit 74bdf89

16 files changed

+10984
-0
lines changed

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
node_modules
3+
build
4+
dist
5+
.rpt2_cache
6+
.DS_Store
7+
.env
8+
.env.local
9+
.env.development.local
10+
.env.test.local
11+
.env.production.local
12+
npm-debug.log*
13+
yarn-debug.log*
14+
yarn-error.log*
15+

.npmignore

Whitespace-only changes.

.storybook/addons.js

Whitespace-only changes.

.storybook/config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { configure } from "@storybook/react";
2+
3+
const req = require.context("../stories", true, /.stories.tsx$/);
4+
5+
function loadStories() {
6+
req.keys().forEach(filename => req(filename));
7+
}
8+
9+
configure(loadStories, module);

.storybook/webpack.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = async ({ config, mode }) => {
2+
config.module.rules.push({
3+
test: /\.(ts|tsx)$/,
4+
use: [
5+
{
6+
loader: require.resolve("babel-loader")
7+
},
8+
{
9+
loader: require.resolve("awesome-typescript-loader")
10+
}
11+
]
12+
});
13+
14+
config.resolve.extensions.push(".ts", ".tsx", ".json");
15+
return config;
16+
};

Readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# react-image-enlarger
2+
3+
A medium.com style image zoom component with gesture dismissal
4+
5+
## Install
6+
7+
```
8+
yarn add react-image-enlarger
9+
```

babel.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
"@babel/preset-env",
5+
{
6+
useBuiltIns: "usage",
7+
corejs: 2,
8+
targets: { node: "6" }
9+
}
10+
],
11+
"@babel/preset-react",
12+
"@babel/preset-typescript"
13+
],
14+
env: {
15+
test: {
16+
plugins: ["require-context-hook"]
17+
}
18+
}
19+
};

jest.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
roots: ["<rootDir>/src"],
3+
transform: {
4+
"^.+\\.tsx?$": "ts-jest"
5+
},
6+
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
7+
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"]
8+
};

package.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"name": "react-image-enlarger",
3+
"version": "1.0.0",
4+
"description": "A medium.com style image zoom component with gesture dismissal",
5+
"main": "cjs/index.js",
6+
"module": "esm/index.js",
7+
"typings": "esm/index.d.ts",
8+
"author": "Ben McMahen",
9+
"license": "MIT",
10+
"private": false,
11+
"scripts": {
12+
"test": "jest",
13+
"test-watch": "jest -w",
14+
"storybook": "start-storybook -p 6006",
15+
"build-esm": "rimraf esm && tsc",
16+
"build-other": "rimraf umd && rimraf cjs && rollup -c",
17+
"build": "yarn run build-esm && yarn run build-other",
18+
"prepublishOnly": "yarn run build"
19+
},
20+
"peerDependencies": {
21+
"react": "^16.8.6",
22+
"react-dom": "^16.8.6"
23+
},
24+
"devDependencies": {
25+
"@babel/core": "^7.4.0",
26+
"@babel/preset-env": "^7.4.2",
27+
"@babel/preset-react": "^7.0.0",
28+
"@babel/preset-typescript": "^7.3.3",
29+
"@storybook/react": "^5.0.5",
30+
"@types/jest": "^24.0.11",
31+
"@types/storybook__react": "^4.0.1",
32+
"awesome-typescript-loader": "^5.2.1",
33+
"babel-core": "^6.26.3",
34+
"babel-jest": "^24.5.0",
35+
"babel-loader": "^8.0.5",
36+
"babel-plugin-require-context-hook": "^1.0.0",
37+
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
38+
"jest": "^24.5.0",
39+
"react": "^16.8.6",
40+
"react-dom": "^16.8.6",
41+
"react-gesture-responder": "^2.1.0",
42+
"rimraf": "^2.6.3",
43+
"rollup": "^1.7.4",
44+
"rollup-plugin-babel": "^4.3.2",
45+
"rollup-plugin-cleanup": "^3.1.1",
46+
"rollup-plugin-commonjs": "^9.2.2",
47+
"rollup-plugin-filesize": "^6.0.1",
48+
"rollup-plugin-json": "^4.0.0",
49+
"rollup-plugin-node-resolve": "^4.0.1",
50+
"rollup-plugin-sourcemaps": "^0.4.2",
51+
"rollup-plugin-typescript2": "^0.20.1",
52+
"rollup-plugin-uglify": "^6.0.2",
53+
"ts-jest": "^24.0.1",
54+
"typescript": "^3.5.3",
55+
"webpack": "^4.29.6"
56+
},
57+
"dependencies": {
58+
"@types/react": "^16.8.10",
59+
"@types/react-dom": "^16.8.3",
60+
"react-spring": "^9.0.0-beta.31",
61+
"tslib": "^1.9.3",
62+
"use-scroll-lock": "^1.0.0"
63+
},
64+
"sideEffects": false
65+
}

rollup.config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import resolve from "rollup-plugin-node-resolve";
2+
import filesize from "rollup-plugin-filesize";
3+
import pkg from "./package.json";
4+
import commonjs from "rollup-plugin-commonjs";
5+
import cleanup from "rollup-plugin-cleanup";
6+
import json from "rollup-plugin-json";
7+
import typescript from "rollup-plugin-typescript2";
8+
9+
const input = "src/index.ts";
10+
11+
const plugins = [
12+
resolve(),
13+
typescript({
14+
typescript: require("typescript")
15+
}),
16+
commonjs(),
17+
json(),
18+
cleanup(),
19+
filesize()
20+
];
21+
22+
const externals = [
23+
...Object.keys(pkg.dependencies || {}),
24+
...Object.keys(pkg.peerDependencies || {})
25+
];
26+
27+
export default [
28+
{
29+
input,
30+
output: [
31+
{
32+
file: pkg.main,
33+
format: "cjs",
34+
sourcemap: true
35+
}
36+
],
37+
external: externals,
38+
plugins
39+
}
40+
];

src/index.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test("hello", () => {
2+
expect("hello").toBeTruthy();
3+
});

0 commit comments

Comments
 (0)