Fix some bugs #3
3
.commitlintrc
Normal file
3
.commitlintrc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": ["@commitlint/config-conventional"]
|
||||||
|
}
|
||||||
1
.husky/commit-msg
Normal file
1
.husky/commit-msg
Normal file
@ -0,0 +1 @@
|
|||||||
|
npx --no -- commitlint --edit $1
|
||||||
1
.husky/pre-commit
Normal file
1
.husky/pre-commit
Normal file
@ -0,0 +1 @@
|
|||||||
|
npx lint-staged
|
||||||
3
.lintstagedrc
Normal file
3
.lintstagedrc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"*.[j|t]s": "eslint"
|
||||||
|
}
|
||||||
8
.versionrc
Normal file
8
.versionrc
Normal 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
17
CHANGELOG.md
Normal 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))
|
||||||
33
package.json
33
package.json
@ -1,18 +1,25 @@
|
|||||||
{
|
{
|
||||||
"name": "ksv741-react-scripts",
|
"name": "ksv741-react-scripts",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"description": "Webpack configuration for easy creating React applications",
|
"description": "Webpack configuration for easy creating React applications",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"source": "./src/webpack/index.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": {
|
"scripts": {
|
||||||
"prepare": "rm -rf dist && tsc && tsc-alias",
|
"prepare": "rm -rf dist && tsc && tsc-alias",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"lint": "eslint --ignore-pattern node_modules --color src"
|
"lint": "eslint --ignore-pattern node_modules --color src",
|
||||||
},
|
"release": "standard-version"
|
||||||
"bin": {
|
|
||||||
"ksv741-react-scripts": "./bin/scripts.js"
|
|
||||||
},
|
},
|
||||||
|
"bin": "./bin/scripts.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">16"
|
"node": ">16"
|
||||||
},
|
},
|
||||||
@ -78,19 +85,25 @@
|
|||||||
"webpack-dev-server": "5.0.0"
|
"webpack-dev-server": "5.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@commitlint/cli": "^19.2.1",
|
||||||
|
"@commitlint/config-conventional": "^19.1.0",
|
||||||
"eslint": "8.57.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": {
|
"peerDependencies": {
|
||||||
"eslint": ">8.0.0",
|
"eslint": ">8.0.0",
|
||||||
"typescript": "^3.6.0"
|
"typescript": "^3.6.0"
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependenciesMeta": {
|
||||||
"typescript": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"eslint": {
|
"eslint": {
|
||||||
"optional": true
|
"optional": true
|
||||||
|
},
|
||||||
|
"typescript": {
|
||||||
|
"optional": true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"packageManager": "yarn@1.22.19"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const getBabelLoader = (options: WebpackOptions): webpack.RuleSetRule | null =>
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
test: /\.[j|t]sx?$/,
|
test: /\.[j|t]sx?$/,
|
||||||
loader: 'babel-loader',
|
loader: require.resolve('babel-loader'),
|
||||||
options: {
|
options: {
|
||||||
...babelLoader,
|
...babelLoader,
|
||||||
presets: [
|
presets: [
|
||||||
|
|||||||
@ -16,7 +16,7 @@ const getEsbuildLoader = (options: WebpackOptions): webpack.RuleSetRule | null =
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
test: /\.[j|t]sx?$/,
|
test: /\.[j|t]sx?$/,
|
||||||
loader: 'esbuild-loader',
|
loader: require.resolve('esbuild-loader'),
|
||||||
options: {
|
options: {
|
||||||
loader: 'tsx',
|
loader: 'tsx',
|
||||||
jsx: 'automatic',
|
jsx: 'automatic',
|
||||||
|
|||||||
@ -20,7 +20,7 @@ const getSwcLoader = (options: WebpackOptions): webpack.RuleSetRule | null => {
|
|||||||
return {
|
return {
|
||||||
test: /\.[j|t]sx?$/,
|
test: /\.[j|t]sx?$/,
|
||||||
exclude: /(node_modules|bower_components)/,
|
exclude: /(node_modules|bower_components)/,
|
||||||
loader: 'swc-loader',
|
loader: require.resolve('swc-loader'),
|
||||||
options: {
|
options: {
|
||||||
...swcLoader,
|
...swcLoader,
|
||||||
sync: true,
|
sync: true,
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const getTsLoader = (options: WebpackOptions): webpack.RuleSetRule | null => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
test: /\.[j|t]sx?$/,
|
test: /\.[j|t]sx?$/,
|
||||||
loader: 'ts-loader',
|
loader: require.resolve('ts-loader'),
|
||||||
options: {
|
options: {
|
||||||
...tsLoader,
|
...tsLoader,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -23,7 +23,7 @@ const getCssLoader = (options: WebpackOptions): webpack.RuleSetRule => {
|
|||||||
? styleLoader === 'off'
|
? styleLoader === 'off'
|
||||||
? null
|
? null
|
||||||
: {
|
: {
|
||||||
loader: 'style-loader',
|
loader: require.resolve('style-loader'),
|
||||||
options: styleLoader,
|
options: styleLoader,
|
||||||
}
|
}
|
||||||
: miniCssLoader === 'off'
|
: miniCssLoader === 'off'
|
||||||
@ -35,7 +35,7 @@ const getCssLoader = (options: WebpackOptions): webpack.RuleSetRule => {
|
|||||||
cssLoader === 'off'
|
cssLoader === 'off'
|
||||||
? null
|
? null
|
||||||
: {
|
: {
|
||||||
loader: 'css-loader',
|
loader: require.resolve('css-loader'),
|
||||||
options: {
|
options: {
|
||||||
sourceMap: isDev,
|
sourceMap: isDev,
|
||||||
...cssLoader,
|
...cssLoader,
|
||||||
@ -49,7 +49,7 @@ const getCssLoader = (options: WebpackOptions): webpack.RuleSetRule => {
|
|||||||
postCssLoader === 'off'
|
postCssLoader === 'off'
|
||||||
? null
|
? null
|
||||||
: {
|
: {
|
||||||
loader: 'postcss-loader',
|
loader: require.resolve('postcss-loader'),
|
||||||
options: {
|
options: {
|
||||||
...postCssLoader,
|
...postCssLoader,
|
||||||
postcssOptions: {
|
postcssOptions: {
|
||||||
|
|||||||
@ -21,7 +21,7 @@ const getSassLoader = (options: WebpackOptions): webpack.RuleSetRule | null => {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
...getCssLoader(options).use,
|
...getCssLoader(options).use,
|
||||||
{
|
{
|
||||||
loader: 'sass-loader',
|
loader: require.resolve('sass-loader'),
|
||||||
options: {
|
options: {
|
||||||
sourceMap: isDev,
|
sourceMap: isDev,
|
||||||
...sassLoader,
|
...sassLoader,
|
||||||
|
|||||||
@ -16,7 +16,7 @@ const getSvgrLoader = (options: WebpackOptions): webpack.RuleSetRule | null => {
|
|||||||
test: /\.svg$/i,
|
test: /\.svg$/i,
|
||||||
issuer: /\.[jt]sx?$/,
|
issuer: /\.[jt]sx?$/,
|
||||||
use: [{
|
use: [{
|
||||||
loader: '@svgr/webpack',
|
loader: require.resolve('@svgr/webpack'),
|
||||||
options: {
|
options: {
|
||||||
icon: true,
|
icon: true,
|
||||||
...svgrLoader,
|
...svgrLoader,
|
||||||
|
|||||||
@ -2,12 +2,12 @@ import fs from 'fs';
|
|||||||
import type { PackageJson } from 'types';
|
import type { PackageJson } from 'types';
|
||||||
|
|
||||||
export const hasPackage = (packageName: string) => {
|
export const hasPackage = (packageName: string) => {
|
||||||
if (!packageName) {
|
if (!packageName || !process.env.npm_package_json) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-non-null-assertion
|
// 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]);
|
return Boolean(packageJson.dependencies[packageName] || packageJson.devDependencies[packageName]);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user