Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot fork and install this repo #48

Closed
netpoetica opened this issue Sep 13, 2016 · 3 comments
Closed

cannot fork and install this repo #48

netpoetica opened this issue Sep 13, 2016 · 3 comments

Comments

@netpoetica
Copy link

Hey Clauderic,

Just an FYI - it is not possible to fork this repo and then install your fork via npm without trouble. I have seen similar problems before.

Essentially, if it doesn't come from the npm registry, you get this:

➜  ✗ ls node_modules/react-infinite-calendar 
CHANGELOG.md LICENSE      README.md    node_modules package.json styles.css

Missing all of the important stuff.

I tried adding bin/postinstall like so:

#!/bin/bash

node -e "require('fs').stat('dist', function (e, s) { process.exit(e || !s.isDirectory() ? 1 : 0) })" || npm run build

chmod 755 bin/postinstall

and adding to package.json

...
    "codecov": "cat coverage/*/lcov.info | codecov",
    "postinstall": "./bin/postinstall"
  },
...

But I think crossenv devDependency is giving some trouble there.

Any thoughts on this?

@clauderic
Copy link
Owner

Have you tried removing the .npmignore file? Now that I think of it that might be an issue

@netpoetica
Copy link
Author

netpoetica commented Sep 14, 2016

Removing the .npmignore does bring all of the necessary files in, but not the dist/ dir. postinstall still will not be able to create the dist/ directory needed to utilize the fork. After removing .npmignore, npm install-ing from a fork looks like this:

➜  ✗ ls node_modules/react-infinite-calendar 
CHANGELOG.md             bin                      karma.conf.js            src                      webpack.config.umd.js
LICENSE                  codecov.yml              node_modules             styles.css
README.md                index.html               package.json             test
babel.preprocess.sass.js index.js                 server.js                webpack.config.dev.js

There is no dist/ dir, so a build must occur via postinstall. However, the build will fail because of babel, crossenv, etc - I think this is because when npm installs a package, it doesn't install devDependencies:

➜  ✗ ls node_modules/react-infinite-calendar/node_modules 
lodash

I thought I could solve this by installing crossenv in the root of my project or globally, but actually there are a ton of other devDependencies that will need to be installed, too.

I was thinking maybe a valid solution is to use a bin/ script instead of crossenv which checks to make sure crossenv command exists, and then if it does, uses it, otherwise, ignores it, but then you would need that script to be executable in a windows environment as well if you really wanted to be able to build crossplatform (which is the point of crossenv).

I try to avoid any of these sneaky "dependencies" that then get utilized in the package.json file itself (crossenv, betterscripts, etc). Having the package.json looking into ./node_modules/*/bin/ is one of the weird and confusing magics of npm that probably should be reconsidered.

I think a lot of other people have been solving this type of problem - since the prolification of babel and webpack - by committing the non-best-practice of commiting dist/ to their repository. Aka no dist/ in the gitignore.

I have a pretty solid solution to this that would fix it, but the relative paths in your .babelrc to stuff like preprocessCss makes it impossible. PR was made at #50

@clauderic
Copy link
Owner

Hey guys,

This should no longer be an issue with version 2.0.0, .npmignore has been replaced in favor of the files property in package.json

Check out #73 for more details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants