Treora commented on pull request #100:
URL: 
https://github.com/apache/incubator-annotator/pull/100#issuecomment-755425903


   :100: :tada: 
   
   I just played a bit with publishing from the command line. I think we may 
want to publish each package in our monorepo, instead of only the 
`apache-annotator` meta-package. It seems `lerna publish` is made for 
publishing all at once. Instead of `--tag dev` it would need `--dist-tag dev`. 
In case we do want to use yarn to only publish that one package, we should 
check the build script is executed before publishing (because I think that’s 
normally done by the `prepublishOnly` script in the top-level package).
   
   > I _think_ publishing with a dist tag will be sufficient to get the new 
package out there. However I might be mistaken and we will have to publish a 
new version as well. In the latter case, we could publish a [prerelease 
version](https://docs.npmjs.com/cli/v7/using-npm/semver#prerelease-identifiers).
   
   From my attempt, it seems both yarn and lerna would ask for the version 
number when only a tag is provided. So giving it a prelease identifier seems 
the solution indeed; we could call it `dev` instead of `alpha` using the option 
`--preid dev`. It may be nice to include the commit hash as well; lerna’s 
`--canary` option does this, making an id like `0.1.1-dev.0+1fb8be2`; if we use 
yarn I guess we’d have to supply it manually (at least I don’t see an 
equivalent option).
   
   Publishing as a prerelease requires us to choose whether to increase the 
patch, minor or major part of the version number. I guess we could just 
hardcode that we always work on a ‘prerelease of a patch’, even if we might 
publish it as a minor or major release. Example: while the last release is 
0.1.0, a dev release would be numbered `0.1.1-dev.0+1a2b3c4`, even if our next 
release will be `0.2.0` and we’ll never publish a `0.1.1`.
   
   So for publishing all packages, the command could become more or less: 
`lerna publish --dist-tag dev --preid dev --canary`. On my command line this 
gives:
   
   ```
   user@code:incubator-annotator» npx lerna publish --preid dev --dist-tag dev 
--canary
   lerna notice cli v3.20.2
   lerna info canary enabled
   lerna info Looking for changed packages since c4b5598^..c4b5598
   
   Found 3 packages to publish:
    - apache-annotator => 0.1.1-dev.102+c4b5598
    - @annotator/dom => 0.1.1-dev.102+c4b5598
    - @annotator/selector => 0.1.1-dev.102+c4b5598
   
   ? Are you sure you want to publish these packages? (ynH) 
   ```
   
   Perhaps a `--yes` is needed too. (also, no idea why it starts at number 102 
here.. but should not matter, I hope)
   
   >  It doesn't check the result of the Travis CI tests.
   
   Hmm.. so if our development branch is broken, our development release is 
broken — makes sense to me actually. Might sometimes even be desirable, so that 
one can test the broken version. And anyone relying on a development release in 
production would anyhow be wise to lock their dependency to a specific version.
   
   @tilgovi thoughts from your side?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to