-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from davidG999/refactor
Refactor
- Loading branch information
Showing
153 changed files
with
7,553 additions
and
5,551 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# dependencies | ||
node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.idea/ | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": ["airbnb", "prettier", "plugin:import/typescript"], | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module", | ||
"parser": "@typescript-eslint/parser" | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint", "prettier"], | ||
"rules": { | ||
"semi": ["error", "always"], | ||
"prettier/prettier": ["error", { "endOfLine": "auto" }], | ||
"react/react-in-jsx-scope": "off", | ||
"react/jsx-filename-extension": [ | ||
"warn", | ||
{ "extensions": [".js", ".jsx", ".ts", ".tsx"] } | ||
], | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
"js": "never", | ||
"jsx": "never", | ||
"ts": "never", | ||
"tsx": "never" | ||
} | ||
], | ||
"react/function-component-definition": [ | ||
"error", | ||
{ | ||
"namedComponents": "arrow-function", | ||
"unnamedComponents": "arrow-function" | ||
} | ||
], | ||
"no-undef": "off", | ||
"no-param-reassign": "off", | ||
"no-unused-vars": "off", | ||
"no-nested-ternary": "off", | ||
"radix": "off", | ||
"consistent-return": "off", | ||
"react/prop-types": "off", | ||
"react/jsx-props-no-spreading": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# dependencies | ||
node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.idea/ | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"semi": true, | ||
"singleQuote": false, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"jsxBracketSameLine": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = { extends: ['@commitlint/config-conventional'] } | ||
module.exports = { extends: ["@commitlint/config-conventional"] }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
import webpack from "webpack"; | ||
import HtmlWebpackPlugin from 'html-webpack-plugin'; | ||
import MiniCssExtractPlugin from 'mini-css-extract-plugin'; | ||
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin'; | ||
import HtmlWebpackPlugin from "html-webpack-plugin"; | ||
import MiniCssExtractPlugin from "mini-css-extract-plugin"; | ||
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin"; | ||
|
||
import { BuildOptions } from "../../types/config"; | ||
import { BuildOptions } from "../types/types"; | ||
|
||
export function buildPlugins(options: BuildOptions): webpack.WebpackPluginInstance[] { | ||
const { paths } = options | ||
const buildPlugins = ( | ||
options: BuildOptions | ||
): webpack.WebpackPluginInstance[] => { | ||
const { paths } = options; | ||
|
||
const plugins = [ | ||
new MiniCssExtractPlugin({ | ||
filename: 'css/[name].[contenthash:8].css', | ||
chunkFilename: 'css/[name].[contenthash:8].css', | ||
filename: "css/[name].[contenthash:8].css", | ||
chunkFilename: "css/[name].[contenthash:8].css", | ||
}), | ||
new webpack.ProgressPlugin(), | ||
new HtmlWebpackPlugin({ | ||
template: paths.html, | ||
favicon: "./src/shared/assets/icons/logo.svg" | ||
favicon: "./src/shared/assets/icons/logo.svg", | ||
}), | ||
] | ||
]; | ||
|
||
if (options.isDev) { | ||
plugins.push(new webpack.HotModuleReplacementPlugin()) | ||
plugins.push(new ReactRefreshWebpackPlugin()) | ||
plugins.push(new webpack.HotModuleReplacementPlugin()); | ||
plugins.push(new ReactRefreshWebpackPlugin()); | ||
} | ||
|
||
return plugins; | ||
} | ||
}; | ||
|
||
export default buildPlugins; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import webpack from 'webpack'; | ||
import webpack from "webpack"; | ||
|
||
export function buildResolve(): webpack.ResolveOptions { | ||
return { | ||
extensions: ['.tsx', '.ts', '.js'], | ||
} | ||
} | ||
const buildResolve = (): webpack.ResolveOptions => ({ | ||
extensions: [".tsx", ".ts", ".js"], | ||
}); | ||
|
||
export default buildResolve; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
import webpack from 'webpack'; | ||
import webpack from "webpack"; | ||
|
||
import { BuildOptions } from '../../types/config'; | ||
import buildLoaders from "./buildLoaders"; | ||
import buildResolve from "./buildResolve"; | ||
import buildPlugins from "./buildPlugins"; | ||
import buildDevServer from "./buildDevServer"; | ||
|
||
import { buildLoaders } from './buildLoaders'; | ||
import { buildResolve } from './buildResolve'; | ||
import { buildPlugins } from './buildPlugins'; | ||
import { buildDevServer } from './buildDevServer'; | ||
import { BuildOptions } from "../types/types"; | ||
|
||
export function buildWebpacConfig(options: BuildOptions): webpack.Configuration { | ||
const { paths, mode, isDev } = options | ||
const buildWebpacConfig = (options: BuildOptions): webpack.Configuration => { | ||
const { paths, mode, isDev } = options; | ||
|
||
return { | ||
mode, | ||
entry: paths.entry, | ||
devServer: isDev ? buildDevServer(options) : undefined, | ||
output: { | ||
filename: '[name].[contenthash].js', | ||
filename: "[name].[contenthash].js", | ||
path: paths.output, | ||
publicPath: '/', | ||
publicPath: "/", | ||
clean: true, | ||
}, | ||
module: { | ||
rules: buildLoaders(options) | ||
rules: buildLoaders(options), | ||
}, | ||
resolve: buildResolve(), | ||
plugins: buildPlugins(options), | ||
} | ||
} | ||
}; | ||
}; | ||
|
||
export default buildWebpacConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.