gjaldon / heroku-buildpack-phoenix-static

A Heroku buildpack for building Phoenix's static assets
MIT License
229 stars 224 forks source link

Support NPM_TOKEN to .npmrc and fix issue with prune #94

Closed jsmestad closed 4 years ago

jsmestad commented 5 years ago

Background

When clear_cache is enabled and the deploy is adding private packages (requiring an .npmrc file) the deploy will fail. This is due to the npm prune command missing the same --userconfig flag.

While I was in there, I integrated NPM_TOKEN support to generate an .npmrc like other buildpacks on Heroku support out-of-the-box.

Feedback

I think I can refactor the generation code to use the ENV exports method from common.sh, but was not sure so I went with the safest option.

gjaldon commented 4 years ago

Thanks for the PR @jsmestad! :purple_heart:

jesseshieh commented 4 years ago

@gjaldon We are getting reports from customers with the following error

remote: cat: /tmp/env/NPM_TOKEN: No such file or directory        

It seems like it may be related to this pull request. Do you mind if I revert this for now while I investigate further?

jesseshieh commented 4 years ago

Looking a bit closer, I think this is definitely causing the issue. I'm going to go ahead and revert. @jsmestad do you mind modifying this pull request to make sure the /tmp/env/NPM_TOKEN exists before reading it and fall back to original behavior if it and the env var does not exist?