tricknotes / ember-cli-rails

Unify your EmberCLI and Rails Workflows
http://thoughtbot.github.io/ember-cli-rails/
MIT License
713 stars 205 forks source link

Avoid unnecessary `npm install` #461

Closed afn closed 8 years ago

afn commented 8 years ago

When deploying to heroku, npm install is run twice: once by the NodeJS buildpack, and again during asset precompilation. The issue occurs in our build environment (on CircleCI) as well, since we run both npm install and rake assets:precompile as part of our build setup.

A couple of possible approaches to take:

  1. Allow the dependency of ember:compile on ember:install to be disabled by an environment variable. This would be the simplest approach, but it would require users to remember to set this variable in their Heroku environment and (if it's set up like ours) their CI environment.
  2. Make the ember:install task smarter, and have it be a no-op if package.json / bower.json hasn't changed since the task was last run.

I'm happy to do a PR but I'd like to hear your thoughts on the best approach to take here.

411 is closely related, but not entirely the same issue.

Thanks!

seanpdoyle commented 8 years ago

Make the ember:install task smarter, and have it be a no-op if package.json / bower.json hasn't changed since the task was last run.

How could we achieve this?

I would prefer to depend on npm install being smart about when to no-op.

Would it be possible to investigate this on the npm side?

seanpdoyle commented 8 years ago

The responsibility of handling npm's dirty-checking and cache expiration feel outside the scope of ember-cli-rails.

It would be nice if npm were smart enough to no-op on subsequent npm install calls.

I'm closing this for now, but if you have an idea of how to implement this, we'd love to review a pull request!