被antdesign的恐怖的scripts吓到了
近日无意中打开antdesign
的package.json,然后就看到一砣恐怖的scripts
"scripts": {
"api-collection": "antd-tools run api-collection",
"authors": "tsx scripts/generate-authors.ts",
"build": "npm run compile && cross-env NODE_OPTIONS='--max-old-space-size=4096' npm run dist",
"changelog": "npm run lint:changelog && tsx scripts/print-changelog.ts",
"check-commit": "tsx scripts/check-commit.ts",
"clean": "antd-tools run clean && rimraf es lib coverage locale dist report.html artifacts.zip oss-artifacts.zip",
"clean:lockfiles": "rimraf package-lock.json yarn.lock",
"precompile": "npm run prestart",
"compile": "npm run clean && antd-tools run compile",
"predeploy": "antd-tools run clean && npm run site && cp CNAME _site && npm run test:site",
"deploy": "gh-pages -d _site -b gh-pages -f",
"deploy:china-mirror": "git checkout gh-pages && git pull origin gh-pages && git push git@gitee.com:ant-design/ant-design.git gh-pages -f",
"predist": "npm run version && npm run token:statistic && npm run token:meta",
"dist": "antd-tools run dist",
"format": "biome format --write .",
"install-react-16": "npm i --no-save --legacy-peer-deps react@16 react-dom@16 @testing-library/react@12",
"install-react-17": "npm i --no-save --legacy-peer-deps react@17 react-dom@17 @testing-library/react@12",
"bun-install-react-16": "bun remove react react-dom @testing-library/react && bun add --no-save react@16 react-dom@16 @testing-library/react@12",
"bun-install-react-17": "bun remove react react-dom @testing-library/react && bun add --no-save react@17 react-dom@17 @testing-library/react@12",
"prelint": "dumi setup",
"lint": "npm run version && npm run tsc && npm run lint:script && npm run lint:biome && npm run lint:md && npm run lint:style && npm run lint:changelog",
"lint:changelog": "tsx scripts/generate-component-changelog.ts",
"lint:deps": "antd-tools run deps-lint",
"lint:md": "remark . -f -q",
"lint:script": "eslint . --cache",
"lint:biome": "biome lint",
"lint:style": "tsx scripts/check-cssinjs.tsx",
"prepare": "is-ci || husky && dumi setup",
"prepublishOnly": "tsx ./scripts/pre-publish.ts",
"prettier": "prettier -c --write . --cache",
"prettier-import-sort": "npm run prettier -- --plugin=@ianvs/prettier-plugin-sort-imports",
"biome": "biome check --write",
"pub": "echo 'Please use `npm publish` instead.'",
"postpublish": "tsx scripts/post-publish.ts",
"presite": "npm run prestart",
"site": "npm i --no-save --legacy-peer-deps react@18.3.0-canary-c3048aab4-20240326 react-dom@18.3.0-canary-c3048aab4-20240326 && dumi build && cp .surgeignore _site",
"size-limit": "size-limit",
"sort:api-table": "antd-tools run sort-api-table",
"sort:package-json": "npx sort-package-json",
"prestart": "npm run version && npm run token:statistic && npm run token:meta && npm run lint:changelog",
"start": "tsx ./scripts/set-node-options.ts cross-env PORT=8001 dumi dev",
"pretest": "npm run version",
"test": "jest --config .jest.js --no-cache",
"test:all": "sh -e ./scripts/test-all.sh",
"test:dekko": "node ./tests/dekko/index.test.js",
"test:image": "jest --config .jest.image.js --no-cache -i -u --forceExit",
"test:node": "npm run version && jest --config .jest.node.js --no-cache",
"test:package-diff": "antd-tools run package-diff",
"test:site": "jest --config .jest.site.js",
"test:site-update": "npm run site && npm run test:site -- -u",
"test:update": "jest --config .jest.js --no-cache -u",
"test:visual-regression": "tsx scripts/visual-regression/build.ts",
"token:meta": "tsx scripts/generate-token-meta.ts",
"token:statistic": "tsx scripts/collect-token-statistic.ts",
"tsc": "tsc --noEmit",
"tsc:old": "tsc --noEmit -p tsconfig-old-react.json",
"version": "tsx scripts/generate-version.ts"
},
面对如此复杂的scripts
,有没有被吓到。
相信我,在团队开发中,不要说团队成员,就算是开发者本身一段时间后也不一定能一眼就看到每一条脚本的作用了。
怎么呢?最好是加点注释
但是众所周知,package.json
是不支持注释了。
这里给大家推荐一个VSCODE
插件json_comments_extension,可以用来给任意JSON
文件添加注释.
效果如下:
开源推荐
以下是我的一大波开源项目推荐:
- 全流程一健化React/Vue/Nodejs国际化方案 - VoerkaI18n
- 极致优雅的状态管理库 - AutoStore
- 无以伦比的React表单开发库 - speedform
- 终端界面开发增强库 - Logsets
- 简单的日志输出库 - VoerkaLogger
- 装饰器开发 - FlexDecorators
- 有限状态机库 - FlexState
- 通用函数工具库 - FlexTools
- 小巧优雅的CSS-IN-JS库 - flexstyled
- 为JSON文件添加注释的VSCODE插件 - json_comments_extension
- 开发交互式命令行程序库 - mixcli
- 强大的字符串插值变量处理工具库 - flexvars
- 前端link调试辅助工具 - yald
- 异步信号 - asyncsignal
- React/Vue/WebComponent树组件 - LiteTree
作者:渔夫正在掘金
来源:juejin.cn/post/7442573821444227109
来源:juejin.cn/post/7442573821444227109