0

I have developed and published a node module which is a React component.

Here are its links.
https://www.npmjs.com/package/mui-datagrid-full-edit
https://github.com/prettyblueberry/mui-datagrid-full-edit

Of course, the module works well, but it has some unnecessary files and dependencies. The files and dependencies are for its development, so I cannot remove them in dev project.

Here is its 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",
  
   ...
}

Here is its file structure.
Screenshot of Structure

To solve it, I updated dependencies and devDependencies in package.json several times, but it seems it didn't help me.
I also want to publish only files and folders like dist folder and packages.json for usage, except files like index.js and App.js for its development and testing.

To do it, I think package.json should works like two versions - a version for dev and a version for publishing, but not sure.

How can I do?

Olivier Tassinari
  • 8,238
  • 4
  • 23
  • 23
Blueberry
  • 1
  • 1

0 Answers0