Fix some bugs #3

Merged
ksv741 merged 5 commits from description into main 2024-03-29 07:21:47 +03:00
16 changed files with 1556 additions and 189 deletions

3
.commitlintrc Normal file
View File

@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}

1
.husky/commit-msg Normal file
View File

@ -0,0 +1 @@
npx --no -- commitlint --edit $1

1
.husky/pre-commit Normal file
View File

@ -0,0 +1 @@
npx lint-staged

3
.lintstagedrc Normal file
View File

@ -0,0 +1,3 @@
{
"*.[j|t]s": "eslint"
}

8
.versionrc Normal file
View File

@ -0,0 +1,8 @@
{
"header": "# ksv741 React Scripts",
"releaseCommitMessageFormat": "build: v{{currentTag}}",
"types": [
{"type": "feat", "section": "🚀 New Features"},
{"type": "fix", "section": "\uD83D\uDEE0\uFE0F Bug Fixes"}
]
}

17
CHANGELOG.md Normal file
View File

@ -0,0 +1,17 @@
# ksv741 React Scripts
### 0.1.1 (2024-03-29)
### 🛠️ Bug Fixes
* add inks ([d8b46eb](https://github.com/ksv741/react-scripts/commit/d8b46eb93a89cba6b696be6521627bfe3eabaa92))
* fix checking package function ([0375232](https://github.com/ksv741/react-scripts/commit/037523205751b3f0bacbed9f14e5564e45439bc0))
* fix loading loaders ([6b3a191](https://github.com/ksv741/react-scripts/commit/6b3a191e38c651974fa3f26935beb40a6692ec3e))
### 🚀 New Features
* add create webpack configuration function ([cda2c48](https://github.com/ksv741/react-scripts/commit/cda2c486131bba94e65e82664ef5713d9ca93137))
* add description ([14b9b02](https://github.com/ksv741/react-scripts/commit/14b9b026aeb3914c40b065fd4303ac00418056bc))
* add husky, commit linting ([795e10e](https://github.com/ksv741/react-scripts/commit/795e10e1e582ddc57ba1439d37577ce525ae665a))
* add ts and babel loaders ([f704c77](https://github.com/ksv741/react-scripts/commit/f704c77546e6f154ca59d589fb7cf2df36540a0a))

View File

@ -1,18 +1,25 @@
{
"name": "ksv741-react-scripts",
"version": "0.1.0",
"version": "0.1.1",
"description": "Webpack configuration for easy creating React applications",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"source": "./src/webpack/index.ts",
"bugs": {
"url": "https://github.com/ksv741/react-scripts/issues"
},
"homepage": "https://github.com/ksv741/react-scripts",
"repository": {
"type": "git",
"url": "https://github.com/ksv741/react-scripts"
},
"scripts": {
"prepare": "rm -rf dist && tsc && tsc-alias",
"typecheck": "tsc --noEmit",
"lint": "eslint --ignore-pattern node_modules --color src"
},
"bin": {
"ksv741-react-scripts": "./bin/scripts.js"
"lint": "eslint --ignore-pattern node_modules --color src",
"release": "standard-version"
},
"bin": "./bin/scripts.js",
"engines": {
"node": ">16"
},
@ -78,19 +85,25 @@
"webpack-dev-server": "5.0.0"
},
"devDependencies": {
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
"eslint": "8.57.0",
"eslint-config-ksv741": "0.0.1"
"eslint-config-ksv741": "0.0.1",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"standard-version": "^9.5.0"
},
"peerDependencies": {
"eslint": ">8.0.0",
"typescript": "^3.6.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
},
"eslint": {
"optional": true
},
"typescript": {
"optional": true
}
}
},
"packageManager": "yarn@1.22.19"
}

View File

@ -15,7 +15,7 @@ const getBabelLoader = (options: WebpackOptions): webpack.RuleSetRule | null =>
return {
test: /\.[j|t]sx?$/,
loader: 'babel-loader',
loader: require.resolve('babel-loader'),
options: {
...babelLoader,
presets: [

View File

@ -16,7 +16,7 @@ const getEsbuildLoader = (options: WebpackOptions): webpack.RuleSetRule | null =
return {
test: /\.[j|t]sx?$/,
loader: 'esbuild-loader',
loader: require.resolve('esbuild-loader'),
options: {
loader: 'tsx',
jsx: 'automatic',

View File

@ -20,7 +20,7 @@ const getSwcLoader = (options: WebpackOptions): webpack.RuleSetRule | null => {
return {
test: /\.[j|t]sx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'swc-loader',
loader: require.resolve('swc-loader'),
options: {
...swcLoader,
sync: true,

View File

@ -15,7 +15,7 @@ const getTsLoader = (options: WebpackOptions): webpack.RuleSetRule | null => {
return {
test: /\.[j|t]sx?$/,
loader: 'ts-loader',
loader: require.resolve('ts-loader'),
options: {
...tsLoader,
},

View File

@ -23,7 +23,7 @@ const getCssLoader = (options: WebpackOptions): webpack.RuleSetRule => {
? styleLoader === 'off'
? null
: {
loader: 'style-loader',
loader: require.resolve('style-loader'),
options: styleLoader,
}
: miniCssLoader === 'off'
@ -35,7 +35,7 @@ const getCssLoader = (options: WebpackOptions): webpack.RuleSetRule => {
cssLoader === 'off'
? null
: {
loader: 'css-loader',
loader: require.resolve('css-loader'),
options: {
sourceMap: isDev,
...cssLoader,
@ -49,7 +49,7 @@ const getCssLoader = (options: WebpackOptions): webpack.RuleSetRule => {
postCssLoader === 'off'
? null
: {
loader: 'postcss-loader',
loader: require.resolve('postcss-loader'),
options: {
...postCssLoader,
postcssOptions: {

View File

@ -21,7 +21,7 @@ const getSassLoader = (options: WebpackOptions): webpack.RuleSetRule | null => {
// @ts-ignore
...getCssLoader(options).use,
{
loader: 'sass-loader',
loader: require.resolve('sass-loader'),
options: {
sourceMap: isDev,
...sassLoader,

View File

@ -16,7 +16,7 @@ const getSvgrLoader = (options: WebpackOptions): webpack.RuleSetRule | null => {
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: [{
loader: '@svgr/webpack',
loader: require.resolve('@svgr/webpack'),
options: {
icon: true,
...svgrLoader,

View File

@ -2,12 +2,12 @@ import fs from 'fs';
import type { PackageJson } from 'types';
export const hasPackage = (packageName: string) => {
if (!packageName) {
if (!packageName || !process.env.npm_package_json) {
return false;
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-non-null-assertion
const packageJson: PackageJson = JSON.parse(fs.readFileSync(process.env.npm_package_json!, 'utf8'));
const packageJson: PackageJson = JSON.parse(fs.readFileSync(process.env.npm_package_json, 'utf8'));
return Boolean(packageJson.dependencies[packageName] || packageJson.devDependencies[packageName]);
};

1657
yarn.lock

File diff suppressed because it is too large Load Diff