Publish package to npm
Closed this issue · 0 comments
blcham commented
Moscow method:
- M - must-have
- S - should-have
- C - could-have
- W - won't-have.
We want to have 2 types of deployments:
-
releases (major, minor, patch)
- [M] RQ1.1 manual action is required to do the deployment
- [M] RQ1.2 Automatic commits and should contain new version message
- The new version should be usable as library (within package.json)
- [M] RQ1.3.1 concrete release (by specifying version)
- [M] RQ1.3.2 latest release tag
- [C] there could be a way to do a release from github directly (attaching a github action to on:release action?)
- [M] Run tests
-
pre-releases
- [S] RQ2.1 no manual action is required to do that
- [M] RQ2.2 no commits should reflect that (or they should not be merged in master any time)
- should be able to set up in package.json
- [C] RQ2.3.1.1 RQ concrete pre-release (e.g. indexed by commit id "3.2.1-fecef8d5" or something like "3.2.1-beta.X", but you should be able to find out easily which commit it reflects)
- [M] RQ2.3.1.2 There should be two different pre-release: alpha for each commit with alpha tag and beta on merge to master with beta tag
- [M] RQ2.3.2 latest pre-release (e.g. specific tag in npm)
- [M] Run tests
Solution of RQ1.*:
- check we are on master
- check that there is nothing in git stage fail otherwise
- package.json has "3 scripts":
- release:major
- release:minor
- release:patch
- on run of release:*
- update version in package.json
- update package-lock.json
- create commit saing bumped version x.y.z
- push into git
- release version in npm
Solution for RQ2.*:
- user pushes commit to master
- github action picks up commit from master
- update version in package.json
- update package-lock.json
- make release in npm with tag next/beta/alpha
Related links:
Here is example of the workflow: https://www.eliostruyf.com/conditional-publish-packages-npm-github-actions/
Here is example of naming convention: https://node.dev/post/an-open-source-maintainers-guide-to-publishing-npm-packages
Guide to set up npm tokens: https://hackernoon.com/publish-npm-packages-using-github-actions-a-how-to-guide-q31c34fg
Semantic versioning -- https://docs.npmjs.com/about-semantic-versioning