uProxy-p2p icon indicating copy to clipboard operation
uProxy-p2p copied to clipboard

Create tools/processes to prevent npm and github from getting out of sync

Open dborkan opened this issue 12 years ago • 8 comments

We are often running into 2 related problems:

  1. Sometimes code is merged into github dev or master branches without being published to NPM. This means that there new code won't actually be available to other repos.
  2. Sometimes code is published to NPM but not merged into github. This means this code is likely to get clobbered on the next NPM publish, and is confusing when it comes time to debug.

We should come up with some script/tool/process to fix this. Some ideas:

  • We could create post-commit scripts for each repo similar to https://github.com/freedomjs/freedom/blob/master/tools/releases.sh that run each time a commit occurs on github. After each commit, it can check if the commit was to dev or master, and if so check if the NPM version matches the version in github (for example by comparing package.json files). If they don't match we could try to automatically fix, or just send an alert email. This should fix problem 1 above.
  • We could also create a pre-publish script in package.json that verifies you are only publishing from the dev or master branches. This should fix problem 2.

dborkan avatar Jun 12 '14 01:06 dborkan

BTW all of these changes will likely be in repos used by uProxy but not uProxy itself (at least for now, until it is public). I'm just putting this issue in uProxy so that it doesn't get lost.

dborkan avatar Jun 12 '14 01:06 dborkan

What should we do differently while NPM publication is still a manual process?

I may be the only one, but personally, I don't know anything about how to publish NPMs and have only a rough idea of when doing so is necessary.

matthild avatar Jun 12 '14 05:06 matthild

Thanks & +1 to clarified (initially manual) process for this.

Which direction are we going to maintain enforce? There are pro/cons to each

  • latest published to npm registry should be at or behing a specified branch
  • a specified branch should be at or behind version at npm registry (specified would currently be master, though this may be too volatile for non-uproxy repos.)

One benefit of "github always ahead or at npm version" is that not all contributors have to understand npm publishing.

some npm breadcrumbs I found:

pointing to a git repo as a dependency (Lucas points out this isn't useful since it loses the nested npm goodness) https://www.npmjs.org/doc/json.html#Git-URLs-as-Dependencies

automating the commit that bumps the version https://www.npmjs.org/doc/cli/npm-version.html

ahmetaktay avatar Jun 12 '14 21:06 ahmetaktay

To publish to NPM you will need to create an account at npmjs.org, then I can permission you for some of the repos. Once you have an account and permission to publish, you should update the version number in package.json (this should be submitted), make sure you've run "grunt build" (or any other compilation commands) then run "npm login" and "npm publish". This will publish all files in your directory except for those excluded by .npmignore.

I think that we should always merge into github master or dev branch before publishing to NPM because we always do code reviews before merging in github, but for publishing to NPM there is no review process.

Also we don't publish the uProxy repo to NPM, only the repos that uProxy depends on (socks-rtc, freedom, etc). I believe all of those repos only have master branches and not dev, so a simpler rule would be that we only publish code to NPM that has been merged into master.

On Thu, Jun 12, 2014 at 2:38 PM, ahmetaktay [email protected] wrote:

Thanks & +1 to clarified (initially manual) process for this.

Which direction are we going to maintain enforce? There are pro/cons to each

  • latest published npm should be at or behing a specified branch
  • a specified branch should be at or behind npm (specified would currently be master, though this may be too volatile for non-uproxy repos.)

One benefit of "github always ahead or at npm version" is that not all contributors have to understand npm publishing.

some npm breadcrumbs I found:

pointing to a git repo as a dependency (Lucas points out this isn't useful since it loses the nested npm goodness) https://www.npmjs.org/doc/json.html#Git-URLs-as-Dependencies

automating the commit that bumps the version https://www.npmjs.org/doc/cli/npm-version.html

— Reply to this email directly or view it on GitHub https://github.com/uProxy/uProxy/issues/226#issuecomment-45951513.

dborkan avatar Jun 12 '14 23:06 dborkan

Tweaked instructions in the coding guide (https://docs.google.com/a/google.com/document/d/1rnaSOBbAHYvb9yXr8lyM-nkUe2FefzUWpeYZ27UKr7o/edit#heading=h.kd9qtmrrdpr8)

iislucas avatar Jun 17 '14 07:06 iislucas

I think reducing the number of repositories will greatly help here, too: https://github.com/uProxy/uproxy/issues/372

trevj avatar Oct 02 '14 16:10 trevj

FWIW, we've now got a pretty decent release process for uproxy-lib. I no longer worry about whether or when changes make it to NPM.

trevj avatar Oct 07 '15 15:10 trevj

Closing as this is not a priority right now.

jab avatar Nov 03 '16 20:11 jab