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

Consider using npm deps instead of submodules #109

Closed
cben opened this issue Aug 12, 2015 · 3 comments
Closed

Consider using npm deps instead of submodules #109

cben opened this issue Aug 12, 2015 · 3 comments

Comments

@cben
Copy link
Owner

cben commented Aug 12, 2015

package.js can point to arbitrary git urls.
Platforms like Heroku, OpenShift, Travis already run npm install on deploy.

  • Mentally, 1 way to manage dependencies is easier than 2.
  • For Heroku specifically, getting rid of submodules will unlock all kinds of features like auto-deploy, review apps (created for every PR), Heroku button, etc.
  • Github Pages would no longer work. GH Pages do materialize submodules but not any build steps (OK, Jekyll but it can't fetch stuff).
  • rawgit.com doesn't yet support submodules. But it doesn't support npm install either.
  • Running locally would be about the same. npm install; npm start would be "one less tool", but "one more tool" for devs who have git but not Node and directly open file:/.../index.html. It's not obvious I'll be able to keep index.html on par with npm start anyway (cf. [semi] protect system pages (about, help) #101).
  • Modifying a dependency during development is harder (npm link?).
  • Byte-for-byte reproducible deps is harder, but I need to solve that anyway (freeze node & npm dep versions #82).

Crazier ideas:

  • Run a fork of rawgit with whatever dep processing I want.
  • "Build on http request" with tools like http://didact.us/beefy/, https://www.npmjs.com/package/d-proxy, or docpad? (This kills the idea of file:/.../index.html.)
  • GH Pages can be "fixed" by any build tool auto-generating the gh-pages branch.
    • Perhaps even, node_modules or each node_modules/foo could be a submodule pointing to some auto-generated repo.
  • Deps don't have to load at fixed path such as /CodeMirror/, they just have to load.

handy reference: https://github.com/wilmoore/frontend-packagers

@cben
Copy link
Owner Author

cben commented Aug 12, 2015

Fix GH Pages by Jekyll templating dependant on package.json?

Just for fun, doing

<script>
package = {% include package.json %};
...
</script>

is totally doable.
Plus something like (browserify'd?) https://www.npmjs.com/package/npm-package-arg ...


Future of npm for frontend: http://blog.npmjs.org/post/101775448305/npm-and-front-end-packaging

This doesn't mention the idea I might want some magic way to use package.json without running "npm install".
For that, the sanest idea is probably: build an npm-installing, caching (that's the hard part), rawgit clone.

[P.S. the "Deferred" label is here for a reason. As much as all this is tempting to experiment & bikeshed, it's an entirely separate project from Mathdown.]

@cben
Copy link
Owner Author

cben commented Oct 5, 2015

For Heroku, it's probably possible to support submodules with all flows via a buildpack.
cf. https://github.com/mietek/heroku-buildpack-submodule-example
and https://github.com/peterkeen/heroku-buildpack-vendorbinaries

@cben cben closed this as completed Oct 5, 2015
@cben cben added 6 - Done and removed 1 - Deferred labels Oct 5, 2015
@cben
Copy link
Owner Author

cben commented Oct 5, 2015

I've tried installing mathjax via npm
[6eff9f6, f7e0618]
in hope it'll make rhcloud installs faster (#115). It made them slower :-(

I'm closing this as currently I don't plan to switch submodules to npm. Will re-open if I reconsider.

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

No branches or pull requests

1 participant