Skip to content

Commit 221903b

Browse files
committed
chore: switch to Storybook and Rollup
1 parent 8ada8fc commit 221903b

21 files changed

+7220
-11203
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ node_modules
66

77
# builds
88
build
9-
dist
10-
.rpt2_cache
9+
lib
1110

1211
# misc
1312
.DS_Store

.storybook/main.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
"stories": [
3+
"../src/**/*.stories.tsx",
4+
],
5+
"addons": [
6+
"@storybook/addon-links",
7+
"@storybook/addon-essentials",
8+
"@storybook/addon-interactions"
9+
],
10+
"framework": "@storybook/react",
11+
"core": {
12+
"builder": "@storybook/builder-webpack5"
13+
}
14+
}

.storybook/preview.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export const parameters = {
2+
actions: {
3+
argTypesRegex: "^on[A-Z].*"
4+
},
5+
controls: {
6+
matchers: {
7+
color: /(background|color)$/i,
8+
date: /Date$/,
9+
},
10+
},
11+
}

package.json

Lines changed: 50 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
11
{
22
"name": "react-input-verification-code",
33
"version": "1.0.2",
4-
"description": "A verification code input, autocompletion friendly",
5-
"author": "ugogo",
6-
"license": "MIT",
4+
"description": "A React Verification Code Input, Autocompletion Friendly",
75
"repository": "ugogo/react-input-verification-code",
8-
"main": "dist/index.js",
9-
"module": "dist/index.modern.js",
10-
"source": "src/index.tsx",
6+
"main": "lib/cjs/index.js",
7+
"module": "lib/esm/index.js",
8+
"types": "lib/esm/index.d.ts",
9+
"files": [
10+
"lib"
11+
],
1112
"engines": {
1213
"node": ">=10"
1314
},
1415
"publishConfig": {
1516
"access": "public",
1617
"registry": "https://registry.npmjs.org/"
1718
},
19+
"keywords": [
20+
"react",
21+
"verify",
22+
"verification",
23+
"code",
24+
"pin-code",
25+
"authentication-code",
26+
"input",
27+
"autocompletion",
28+
"otp",
29+
"otp-code",
30+
"one-time-password"
31+
],
1832
"release-it": {
1933
"git": {
2034
"commitMessage": "v${version}"
@@ -25,11 +39,10 @@
2539
}
2640
},
2741
"scripts": {
28-
"build": "microbundle-crl --no-compress --format modern,cjs --css-modules false",
29-
"start": "microbundle-crl watch --no-compress --format modern,cjs --css-modules false",
30-
"start:playground": "npm start --prefix playground",
31-
"dev": "run-p start start:playground",
32-
"prepare": "run-s build",
42+
"prepack": "npm run build",
43+
"dev": "npm run storybook",
44+
"dev:watch": "rollup -cw",
45+
"build": "rollup -c",
3346
"test": "run-s test:unit test:lint test:build",
3447
"test:build": "run-s build",
3548
"test:lint": "eslint \"./src/**/*.+(ts|tsx)\"",
@@ -38,26 +51,40 @@
3851
"release": "npm run test && npm run prepare && dotenv release-it",
3952
"lint": "eslint . --ext .js,.ts,.tsx",
4053
"format": "prettier --write {src,playground}/**/*.{ts,tsx}",
41-
"format:check": "prettier --check {src,playground}/**/*.{ts,tsx}"
54+
"format:check": "prettier --check {src,playground}/**/*.{ts,tsx}",
55+
"storybook": "start-storybook -p 6006",
56+
"storybook:build": "build-storybook"
4257
},
4358
"peerDependencies": {
4459
"react": ">=16.0.0",
45-
"styled-components": ">=5.0.0"
60+
"react-dom": ">=16.0.0"
4661
},
4762
"devDependencies": {
63+
"@babel/core": "^7.19.1",
4864
"@babel/plugin-transform-react-jsx-self": "^7.16.7",
4965
"@babel/plugin-transform-react-jsx-source": "^7.16.7",
66+
"@rollup/plugin-commonjs": "^22.0.2",
67+
"@rollup/plugin-node-resolve": "^14.1.0",
68+
"@storybook/addon-actions": "^6.5.12",
69+
"@storybook/addon-essentials": "^6.5.12",
70+
"@storybook/addon-interactions": "^6.5.12",
71+
"@storybook/addon-links": "^6.5.12",
72+
"@storybook/builder-webpack5": "^6.5.12",
73+
"@storybook/manager-webpack5": "^6.5.12",
74+
"@storybook/react": "^6.5.12",
75+
"@storybook/testing-library": "^0.0.13",
5076
"@testing-library/jest-dom": "^5.16.3",
5177
"@testing-library/react": "^13.0.0",
5278
"@testing-library/user-event": "^14.0.4",
53-
"@types/jest": "^27.4.1",
79+
"@types/jest": "^29.0.3",
5480
"@types/node": "^17.0.23",
5581
"@types/react": "^17.0.43",
5682
"@types/react-dom": "^17.0.14",
5783
"@types/styled-components": "^5.1.24",
5884
"@typescript-eslint/eslint-plugin": "^5.18.0",
5985
"@typescript-eslint/parser": "^5.18.0",
6086
"babel-eslint": "^10.0.3",
87+
"babel-loader": "^8.2.5",
6188
"cross-env": "^7.0.3",
6289
"dotenv-cli": "^5.1.0",
6390
"eslint": "^8.12.0",
@@ -71,29 +98,18 @@
7198
"eslint-plugin-react": "^7.29.4",
7299
"eslint-plugin-standard": "^4.1.0",
73100
"gh-pages": "^3.2.3",
74-
"microbundle-crl": "^0.13.11",
75101
"npm-run-all": "^4.1.5",
102+
"postcss": "^8.4.16",
76103
"prettier": "^2.6.2",
77-
"react": "^18.0.0",
78-
"react-dom": "^18.0.0",
104+
"react": "^17.0.0",
105+
"react-dom": "^17.0.0",
79106
"react-scripts": "^5.0.0",
80107
"release-it": "^14.14.0",
81-
"typescript": "^4.6.3"
108+
"rollup": "^2.79.0",
109+
"rollup-plugin-postcss": "^4.0.2",
110+
"rollup-plugin-typescript2": "^0.34.0",
111+
"typescript": "^4.8.3"
82112
},
83-
"files": [
84-
"dist"
85-
],
86-
"keywords": [
87-
"react",
88-
"verify",
89-
"verification",
90-
"code",
91-
"pin-code",
92-
"authentication-code",
93-
"input",
94-
"autocompletion",
95-
"otp",
96-
"otp-code",
97-
"one-time-password"
98-
]
113+
"author": "Ugo Onali",
114+
"license": "MIT"
99115
}

playground/README.md

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

playground/package.json

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

playground/public/favicon.ico

-3.78 KB
Binary file not shown.

playground/public/index.html

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

playground/public/manifest.json

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

playground/src/index.css

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

0 commit comments

Comments
 (0)