refactor(package.json): purge dependencies

This commit is contained in:
haitao(lj) 2022-11-14 09:55:56 +08:00
parent ac71eef3e9
commit 9ddca60ad5
8 changed files with 95 additions and 924 deletions

2
ui/.gitignore vendored
View File

@ -27,5 +27,3 @@ yarn.lock
package-lock.json
.eslintcache
/.vscode/
.env.development.local

2
ui/.npmrc Normal file
View File

@ -0,0 +1,2 @@
strict-peer-dependencies = true
auto-install-peers = true

View File

@ -41,11 +41,9 @@ you can also manually visit it.
when cloning repo, and run `pnpm install` to init dependencies. you can use project commands below:
- `pnpm run start` run Answer web locally.
- `pnpm run build:dev` build code for environment `dev`
- `pnpm run build:test` build code for environment `test`
- `pnpm run build:prod` build code for environment `prod`
- `pnpm run build` build Answer for production
- `pnpm run lint` lint and fix the code style
- `pnpm run cz` run `git commit` by `commitizen`
## 🖥 Environment Support

View File

@ -8,18 +8,9 @@
"build": "react-app-rewired build",
"lint": "eslint . --cache --fix --ext .ts,.tsx",
"prepare": "cd .. && husky install",
"cz": "cz",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"prettier": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}\""
},
"config": {
"commitizen": {
"path": "ui/node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"ahooks": "^3.7.0",
"axios": "^0.27.2",
"bootstrap": "^5.2.0",
"bootstrap-icons": "^1.9.1",
@ -27,11 +18,7 @@
"codemirror": "5.65.0",
"copy-to-clipboard": "^3.3.2",
"dayjs": "^1.11.5",
"highlight.js": "^11.6.0",
"i18next": "^21.9.0",
"i18next-chained-backend": "^3.0.2",
"i18next-http-backend": "^1.4.1",
"i18next-localstorage-backend": "^3.1.3",
"katex": "^0.16.2",
"lodash": "^4.17.21",
"marked": "^4.0.19",
@ -49,13 +36,10 @@
"zustand": "^4.1.1"
},
"devDependencies": {
"@babel/core": "^7.18.10",
"@babel/plugin-syntax-flow": "^7.18.6",
"@babel/plugin-transform-react-jsx": "^7.14.9",
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@fullhuman/postcss-purgecss": "^4.1.3",
"@popperjs/core": "^2.11.5",
"purgecss-webpack-plugin": "^4.1.3",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/dom": "^8.17.1",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
@ -70,11 +54,7 @@
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.33.0",
"chokidar": "^3.5.3",
"commitizen": "^4.2.5",
"conventional-changelog-cli": "^2.2.2",
"customize-cra": "^1.0.0",
"cz-conventional-changelog": "^3.3.0",
"env-cmd": "^10.1.0",
"eslint": "^8.0.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
@ -91,13 +71,10 @@
"lint-staged": "^13.0.3",
"postcss": "^8.0.0",
"prettier": "^2.7.1",
"purgecss-webpack-plugin": "^4.1.3",
"react-app-rewired": "^2.2.1",
"react-scripts": "5.0.1",
"sass": "^1.54.4",
"tsconfig-paths-webpack-plugin": "^4.0.0",
"typescript": "*",
"web-vitals": "^2.1.4",
"typescript": "^4.8.3",
"yaml-loader": "^0.8.0"
},
"packageManager": "pnpm@7.9.5",

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,5 @@
import type { Editor, Position } from 'codemirror';
import type CodeMirror from 'codemirror';
// import 'highlight.js/styles/github.css';
import 'katex/dist/katex.min.css';
export function createEditorUtils(
@ -114,9 +113,4 @@ export function htmlRender(el: HTMLElement | null) {
});
},
);
// import('highlight.js').then(({ default: highlight }) => {
// el.querySelectorAll('pre code').forEach((code) => {
// highlight.highlightElement(code as HTMLElement);
// });
// });
}

View File

@ -1,15 +1,12 @@
import { initReactI18next } from 'react-i18next';
import i18next from 'i18next';
import Backend from 'i18next-http-backend';
import { DEFAULT_LANG } from '@/common/constants';
import en_US from '@/i18n/locales/en_US.yaml';
import zh_CN from '@/i18n/locales/zh_CN.yaml';
i18next
// load translation using http
.use(Backend)
// pass the i18n instance to react-i18next.
.use(initReactI18next)
.init({
@ -31,12 +28,6 @@ i18next
// allow <br/> and simple html elements in translations
transKeepBasicHtmlNodesFor: ['br', 'strong', 'i'],
},
// backend: {
// loadPath: (lngs, namespace) => {
// console.log(lngs, namespace);
// return 'https://cdn.jsdelivr.net/npm/echarts@4.8.0/map/js/china.js';
// },
// },
});
export default i18next;

View File

@ -48,6 +48,9 @@ class Request {
return data;
},
(error) => {
if (error.isAxiosError) {
return Promise.reject(false);
}
const { status, data: respData, msg: respMsg } = error.response;
const { data, msg = '' } = respData;
if (status === 400) {