Skip to content

Commit

Permalink
chore: vite integration, dependencies cleanup
Browse files Browse the repository at this point in the history
ChrisUser committed Dec 1, 2023
1 parent ee4bbbf commit c5fc3d1
Showing 21 changed files with 1,272 additions and 7,238 deletions.
41 changes: 41 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:@typescript-eslint/recommended'],
plugins: ['@typescript-eslint', 'react-hooks', 'prettier'],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true
}
},
env: {
browser: true,
node: true,
es6: true,
jest: true
},
rules: {
"no-control-regex": 0,
'no-undef': 0,
'no-unused-vars': 'off',
'react/prop-types': 0,
'@typescript-eslint/camelcase': 0,
'@typescript-eslint/no-unused-vars': 1,
'@typescript-eslint/no-use-before-define': 0,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/ban-ts-ignore': 0,
'@typescript-eslint/explicit-member-accessibility': 0,
'@typescript-eslint/member-delimiter-style': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-non-null-assertion': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn'
},
settings: {
react: {
version: 'detect'
}
}
}
31 changes: 26 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
node_modules/
docs-build/
coverage/
build/
/node_modules
/.pnp
.pnp.js

# testing

/coverage

# production

/dist
/docs-build

# misc

.eslintcache
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log\*
debug.log
.out
.out
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 160,
"tabWidth": 4,
"singleQuote": true,
"semi": false,
"trailingComma": "none",
"bracketSpacing": true
}
55 changes: 21 additions & 34 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,22 @@
module.exports = {
stories: ["../src/**/*.stories.tsx"],
addons: ["@storybook/addon-docs", "@storybook/addon-viewport", "@storybook/addon-a11y"],
typescript: {
reactDocgen: "react-docgen-typescript",
reactDocgenTypescriptOptions: {
compilerOptions: {
outDir: "build",
module: "esnext",
target: "esnext",
lib: ["es6", "dom", "es2016", "es2017"],
sourceMap: true,
allowJs: false,
jsx: "react",
declaration: true,
forceConsistentCasingInFileNames: true,
noImplicitReturns: true,
noImplicitThis: true,
noImplicitAny: true,
strictNullChecks: true,
suppressImplicitAnyIndexErrors: true,
noUnusedLocals: false,
noUnusedParameters: true,
esModuleInterop: true
}
import type { StorybookConfig } from '@storybook/react-vite'
import { withoutVitePlugins } from '@storybook/builder-vite'

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-onboarding', '@storybook/addon-interactions'],
framework: {
name: '@storybook/react-vite',
options: {}
},
docs: {
autodocs: 'tag'
},
viteFinal: async (config) => {
return {
...config,
plugins: await withoutVitePlugins(config.plugins, ['vite:lib-inject-css'])
}
}
},
framework: {
name: "@storybook/react-webpack5",
options: {}
},
docs: {
autodocs: true
}
};
}

export default config
18 changes: 10 additions & 8 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export const parameters = {
a11y: {
element: '#root',
config: {},
options: {},
manual: true,
},
};
import type { Preview } from '@storybook/react'

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {}
}
}

export default preview
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Cristiano Raimondi
Copyright (c) 2020 - 2023 Cristiano Raimondi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React Usage Bar</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
11 changes: 11 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es2020",
"allowSyntheticDefaultImports": false,
"baseUrl": "./src",
"paths": {
"*": ["src/*"]
}
},
"exclude": ["node_modules", "public", "build"]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
183 changes: 74 additions & 109 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,112 +1,77 @@
{
"name": "react-usage-bar",
"version": "1.2.1",
"description": "Usage bar, graphic component for React",
"main": "build/index.js",
"typings": "build/index.d.ts",
"files": [
"build/*"
],
"repository": {
"type": "git",
"url": "https://github.com/ChrisUser/react-usage-bar.git"
},
"scripts": {
"build": "rollup -c && tsc --emitDeclarationOnly",
"lint": "standard",
"format": "prettier-standard --format",
"test": "jest --coverage",
"storybook": "storybook dev",
"build-storybook": "storybook build -c .storybook -o docs-build .out"
},
"release": {
"branches": [
"main"
]
},
"keywords": [
"react",
"usage bar",
"design",
"component"
],
"author": {
"name": "ChrisUser",
"url": "https://github.com/ChrisUser"
},
"homepage": "http://ChrisUser.github.io/react-usage-bar",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.23.5",
"@babel/preset-env": "^7.23.5",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@storybook/addon-a11y": "^7.6.2",
"@storybook/addon-docs": "^7.6.2",
"@storybook/addon-viewport": "^7.6.2",
"@storybook/react": "^7.6.2",
"@storybook/react-webpack5": "^7.6.2",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
"@types/jest": "^29.5.10",
"@types/react": "^18.2.39",
"@types/react-dom": "^18.2.17",
"awesome-typescript-loader": "^5.2.1",
"babel-loader": "^9.1.3",
"esbuild": "^0.19.8",
"jest": "^29.7.0",
"postcss": "^8.4.24",
"prettier-standard": "^16.3.0",
"react": "^18.2.0",
"react-docgen-typescript-loader": "^3.7.2",
"react-dom": "^18.2.0",
"rollup": "^4.6.1",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-esbuild": "^6.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-peer-deps-external": "^2.2.2",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.36.0",
"standard": "^17.1.0",
"standard-prettier": "^1.0.1",
"storybook": "7.6.2",
"ts-jest": "^29.1.1",
"ts-loader": "^9.5.1",
"typescript": "^5.3.2"
},
"peerDependencies": {
"react": "^16",
"react-dom": "^16"
},
"resolutions": {
"minimist": "1.2.6",
"semver": "7.5.2"
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "jsdom",
"testPathIgnorePatterns": [
"build/"
]
},
"standard": {
"ignore": [
"node_modules/",
"build/"
"name": "react-usage-bar",
"version": "1.2.1",
"description": "Usage bar, graphic component for React",
"main": "dist/main.js",
"types": "dist/main.d.ts",
"files": [
"dist"
],
"globals": [
"describe",
"it",
"test",
"expect",
"afterAll",
"jest"
]
},
"dependencies": {
"minimist": "1.2.8",
"semver": "7.5.4"
}
"sideEffects": [
"**/*.css"
],
"repository": {
"type": "git",
"url": "https://github.com/ChrisUser/react-usage-bar.git"
},
"scripts": {
"dev": "vite",
"build": "tsc --p ./tsconfig-build.json && vite build",
"test": "react-scripts test",
"prepublishOnly": "yarn build",
"storybook": "storybook dev",
"build-storybook": "storybook build -c .storybook -o docs-build .out"
},
"release": {
"branches": [
"main"
]
},
"keywords": [
"react",
"usage bar",
"design",
"component"
],
"author": {
"name": "ChrisUser",
"url": "https://github.com/ChrisUser"
},
"homepage": "http://ChrisUser.github.io/react-usage-bar",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.23.5",
"@babel/preset-env": "^7.23.5",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@storybook/addon-essentials": "^7.5.2",
"@storybook/addon-interactions": "^7.5.2",
"@storybook/addon-links": "^7.5.2",
"@storybook/addon-onboarding": "^1.0.8",
"@storybook/blocks": "^7.5.2",
"@storybook/react": "^7.5.2",
"@storybook/react-vite": "^7.5.2",
"@storybook/testing-library": "^0.2.2",
"@types/react": "^18.2.39",
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react": "^4.1.0",
"babel-loader": "^9.1.3",
"postcss": "^8.4.24",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "7.6.2",
"ts-loader": "^9.5.1",
"typescript": "^5.3.2",
"vite": "^5.0.4",
"vite-plugin-dts": "^3.6.0"
},
"peerDependencies": {
"react": "^16",
"react-dom": "^16"
},
"resolutions": {
"jackspeak": "2.1.1",
"minimist": "1.2.6",
"semver": "7.5.4"
}
}
Loading

0 comments on commit c5fc3d1

Please sign in to comment.