-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Using parse-server as git dependency #1120
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
Comments
the best practice would be to add a git submodule and use npm link. at the root of your git repo:
|
The bin folder is usually reserved for command line tools and executables |
Thanks, I'll try what you suggested. Assuming npm link will still work when deployed e.g. to Heroku? Just out of interest, any idea why parse-server is using a bin folder? Looking at other depencies, those do not, e.g. body-parser, express |
this is just to put some global scripts there like parse-server. Let's say you have this architecture: my_project in your package.json, you can set
then just run |
if npm link don't survive the heroku deploy, you an use file |
So using npm link actually set up the dependency as file, which worked locally. To deploy to Heroku I initialise the app folder as a new repo (it actually is a sub-folder 'server' of our git project), add files and git push -f to the Heroku remote. This doesn't work with the submodule because submodule files cannot be re-added. Instead I tried adding as a subtree. This at least gets parse-server pushed to Heroku but there is an error when the build pack attempts to build parse-server, because babel cannot be found. I guess I could add the dev-dependencies of parse-server as dependencies of my app.
|
you may need to run npm install in your sub folder parse-server |
That unfortunately doesn't work, I guess because node_modules is in .gitignore. Also I'm not sure I want to push node_modules with every deploy. Also I shouldn't need to build parse-server with every deploy. I'm actually thinking to go back to my first approach, make a branch on my fork whenever I want to update parse-server, then build and push lib to that branch. I could skip a step if lib was un-ignored in parse-server but I guess there's a reason it is ignored? |
BTW, thanks for working through this with me :) |
yes it's ignored as the project is build and we don't have pre-commit hooks. That would force everyone to make sure lib is properly build, and it doesn't make sense from a version control point of view. I'm not sure why the submodules don't work with heroku. what do you mean by As long as you have the proper commit stored in your parent |
It's perhaps how my project is structured: project (git://xxx) To deploy, instead of pushing the entire project I run a script such as:
git add won't add files in parse-server as this is a submodule. What doesn't work is that parse-server is still not built at this point so the Heroku build script runs build, which fails because babel is missing on the Heroku build instance. I could include it by adding to my project dependencies (Heroku doesn't use dev-dependencies for production builds) but then would need to maintain. |
yes you can't add file, so use your fork, add multiple remotes :) That is cleaner to keep parse-server as a submodule this way you can/could seamlessly jump across commits, forks etc... |
In order to use parse-server in production we need to have the option to apply our own hotfixes outside the release cycle (these fixes will also be submitted as PRs). I hope we won't need to use this option but imagine there is a critical production issue that we can't wait for a PR to be checked and a release made.
I was initially unsuccessful specifying the dependency as:
"parse-server": "git://github.com/ParsePlatform/parse-server.git#someCommitHash"
because node_modules/parse-server/bin/parse-server.js includes code from the lib folder.
I fixed this in my repo by adding the contents of the lib folder (and removing lib from .gitignore). This works but I wonder if we should instead be building with babel to the bin folder? I'm unfamiliar with building and publishing npm modules so not sure of best practice.
The text was updated successfully, but these errors were encountered: