Reputation: 575
I have a checked in github fork, and trying to be consumed via npm in another project.
Use rc-collapse, as example
URL: https://www.npmjs.com/package/rc-collapse
github: https://github.com/react-component/collapse
npm install rc-collapse
cd node_modules
cd rc-collapse
dir
02/17/2017 11:21 PM <DIR> .
02/17/2017 11:21 PM <DIR> ..
02/17/2017 11:21 PM <DIR> assets
02/17/2017 11:21 PM 703 HISTORY.md
02/17/2017 11:21 PM <DIR> lib
02/17/2017 11:21 PM 1,083 LICENSE.md
02/17/2017 11:21 PM 3,140 package.json
02/17/2017 11:21 PM 4,073 README.md
However, after clear the folder, and use the following npm
npm install https://github.com/react-component/collapse
cd node_modules
cd rc-collapse
dir
02/17/2017 11:29 PM <DIR> .
02/17/2017 11:29 PM <DIR> ..
02/17/2017 11:29 PM 747 HISTORY.md
02/17/2017 11:29 PM 1,092 LICENSE.md
02/17/2017 11:29 PM 8,313 package.json
02/17/2017 11:29 PM 4,244 README.md
and again, after clear the folder, and use the following git command,
cd node_modules
git clone https://github.com/react-component/collapse rc-collapse
cd rc-collapse
dir
02/17/2017 11:38 PM <DIR> .
02/17/2017 11:38 PM <DIR> ..
02/17/2017 11:38 PM 216 .gitignore
02/17/2017 11:38 PM 625 .travis.yml
02/17/2017 11:38 PM <DIR> assets
02/17/2017 11:38 PM <DIR> examples
02/17/2017 11:38 PM 747 HISTORY.md
02/17/2017 11:38 PM 37 index.js
02/17/2017 11:38 PM 1,092 LICENSE.md
02/17/2017 11:38 PM 1,482 package.json
02/17/2017 11:38 PM 4,244 README.md
02/17/2017 11:38 PM <DIR> src
02/17/2017 11:38 PM <DIR> tests
Question/problem, I cannot get/use the fork from github, neither the lib folder nor src folder is fetched using the npm command.
git clone is not the solution, because npm is used in the package.json fetching mechanism.
"dependencies": {
"rc-collapse": "git+https://github.com/react-component/collapse.git",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}
The folders structure produced by the 'npm update' command is exactly same as the 'npm install https://github.com/react-component/collapse' command which is not usable, no source code included.
How npm fetch all subfolders by github url?
Upvotes: 0
Views: 355
Reputation: 2497
The author of the original package has set certain files in package.json
. This means that it's not pulled when you run npm install
. See this: https://github.com/npm/npm/wiki/Files-and-Ignores.
Solution: Remove the following from package.json
. Alternatively, you can add the folders you need.
"files": [
"lib",
"assets/*.css"
],
Upvotes: 1