我开发并发布了一个节点模块,它是一个 React 组件。
这是它的链接。
https://www.npmjs.com/package/mui-datagrid-full-edit
https://github.com/prettyblueberry/mui-datagrid-full-edit
当然,该模块运行良好,但它有一些不必要的文件和依赖项。文件和依赖是为了它的开发,所以我不能在开发项目中删除它们。
这是它的package.json
{
"name": "mui-datagrid-full-edit",
"version": "1.1.0",
"description": "A full functioned react MUI grid component with CRUD and an easy way of @mui/x-data-grid",
...
"dependencies": {
"@babel/polyfill": "^7.12.1",
"@emotion/react": "^11.7.1",
"@emotion/styled": "^11.6.0",
"@mui/icons-material": "^5.4.1",
"@mui/material": "^5.4.1",
"@mui/x-data-grid": "^5.17.25",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"core-js": "^3.29.1",
"xlsx": "^0.18.5"
},
"scripts": {
"start": "react-scripts start",
"build": "rm -rf dist && NODE_ENV=production babel src/lib --out-dir dist --copy-files",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
...
"devDependencies": {
"@babel/cli": "^7.21.0",
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1"
},
"main": "dist/index.js",
"module": "dist/index.js",
...
}
为了解决这个问题,我多次更新了 package.json 中的 dependencies 和 devDependencies,但似乎对我没有帮助。
我还想只发布 dist 文件夹和 packages.json 等文件和文件夹供使用,除了 index.js 和 App.js 等文件用于开发和测试。
要做到这一点,我认为 package.json 应该像两个版本一样工作——一个用于开发的版本和一个用于发布的版本,但不确定。
我该怎么办?