0

The package react-canvas-draw has the following in its package.json on GitHub:

  "dependencies": {
    "catenary-curve": "^1.0.1",
    "lazy-brush": "^1.0.1",
    "prop-types": "^15.6.2",
    "resize-observer-polyfill": "^1.5.0"
  },
  "peerDependencies": {
    "react": "16.x"
  },
  "devDependencies": {
    "all-contributors-cli": "^5.4.1",
    "babel-eslint": "^7.2.3",
    "css-loader": "^0.28.9",
    "enzyme": "^3.3.0",
    "enzyme-adapter-react-16": "^1.1.1",
    "eslint": "^4.1.1",
    "eslint-config-react-app": "^2.1.0",
    "eslint-plugin-flowtype": "^2.34.1",
    "eslint-plugin-import": "^2.6.0",
    "eslint-plugin-jsx-a11y": "^5.1.1",
    "eslint-plugin-react": "^7.1.0",
    "gh-pages": "^1.1.0",
    "nwb": "0.21.x",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "style-loader": "^0.19.1"
  },

However, when I view the package on NPM, I see:

            "dependencies": {
                "catenary-curve": "^1.0.1",
                "codecov": "^3.5.0",   // <-- note
                "coveralls": "^3.0.4", // <-- note
                "lazy-brush": "^1.0.1",
                "prop-types": "^15.6.2",
                "resize-observer-polyfill": "^1.5.0"
            },
            "peerDependencies": {
                "react": "16.x"
            },
            "devDependencies": {
                "all-contributors-cli": "^5.4.1",
                "babel-eslint": "^7.2.3",
                "css-loader": "^0.28.9",
                "enzyme": "^3.3.0",
                "enzyme-adapter-react-16": "^1.1.1",
                "eslint": "^4.1.1",
                "eslint-config-react-app": "^2.1.0",
                "eslint-plugin-flowtype": "^2.34.1",
                "eslint-plugin-import": "^2.6.0",
                "eslint-plugin-jsx-a11y": "^5.1.1",
                "eslint-plugin-react": "^7.1.0",
                "gh-pages": "^1.1.0",
                "nwb": "^0.21.5",
                "react": "^16.2.0",
                "react-dom": "^16.2.0",
                "style-loader": "^0.19.1"
            },

I noted above the two additional packages that I see: codecov and coveralls. They're also displayed in the user-friendly site.

Why are these in the NPM package entry, but not in the GitHub source?


My only thought: the words codecov and coveralls only really exist in the .travis.yml file:

before_install:
- npm install codecov coveralls
- npm install nwb

...So, npm publish is detecting the npm install commands and adding dependencies to package.json? I can't find anything to support this, but I don't have any better ideas.

Matt Mc
  • 8,882
  • 6
  • 53
  • 89

1 Answers1

0

You're correct in your assumption, executing npm install as of NPM v5 will add them to the package.json as dependencies. The subsequent npm publish that travis runs is then including this "updated" dependency list in the package.


It's interesting that they're shipping with those packages, as they're primarily "dev dependencies" so don't need to be included in the distributed bundle. You may want to open an issue or pull request that either declares these as dev dependencies in the package.json or includes a --save-dev in the .travis.yml.

(Though the latter would not be that great either as it would "add" those as dev deps of the published module that are not reflected on the github source).

Peter Reid
  • 5,139
  • 2
  • 37
  • 33