Skip to content

Publish as a dev/canary release - #65

Merged
jamiebuilds merged 8 commits into
lerna:masterfrom
hzoo:publish-dev
Mar 3, 2016
Merged

jamiebuilds merged 8 commits into
lerna:masterfrom
hzoo:publish-dev

Conversation

@hzoo

@hzoo hzoo commented Feb 22, 2016

Copy link
Copy Markdown
Contributor

Testing in https://github.com/hzoo/hzoo-npm-publish.

Right now I don't know how to make this automatically run in travis since you can't just do npm publish and have to use their deploy feature (I think)

I just ran it locally (or we can set this up on our instance so that it listens for a merge and then will run ./node_modules/.bin/lerna publish --canary.

We can change the name/implementation; just testing.

screen shot 2016-02-22 at 10 03 07 am

screen shot 2016-02-22 at 10 06 00 am

  • Fix: checkUpdatedPackages does a git diff on the last tag (but I'm not creating a tag here, so either we do need to create a git tag or we figure out how to make sure we don't publish all packages unless that is necessary for this feature to work) - we could check the commits related to the merge PR and git diff that only.

screen shot 2016-02-22 at 11 33 36 pm

@hzoo

hzoo commented Feb 23, 2016

Copy link
Copy Markdown
Contributor Author

Ok got it to successfully publish only the commits related to a merge.

Comment thread lib/utils/checkUpdatedPackages.js Outdated
if (hasTags) {
if (flags.canary) {
var lastSHA = getLastSHA();
commits = lastSHA.slice(0, 8) + "^.." + lastSHA.slice(0, 8);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pull this into it's own descriptive function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good idea

@hzoo
hzoo force-pushed the publish-dev branch 3 times, most recently from b0554ae to 17173e4 Compare February 23, 2016 22:27
hzoo added 4 commits February 23, 2016 22:21
…ncies

- When a package is updated, find all packages that dependent on it and update the package.json even if the package was not updated itself
@hzoo
hzoo force-pushed the publish-dev branch 7 times, most recently from 3708dd4 to 828d39f Compare February 24, 2016 05:04
@hzoo

hzoo commented Feb 24, 2016

Copy link
Copy Markdown
Contributor Author

Ok getting complicated.. can probably refactor a lot

screen shot 2016-02-24 at 12 17 48 am

Now it will publish dependencies that use the packages that have been updated (babel-core if babel-generator updates)

if (flags.canary) {
console.log("Reseting git state");
// reset since the package.json files are changed
execSync("git checkout -- */package.json");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be more specific can this be packages/*/package.json?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread lib/utils/getCurrentSHA.js Outdated
@@ -0,0 +1,5 @@
var execSync = require("./execSync");

module.exports = function getCurrentSHA() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to put this in gitUtils?

Comment thread lib/utils/checkUpdatedPackages.js Outdated

if (hasTags) {
if (flags.canary) {
var currentSHA = gitUtils.getCurrentSHA();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the getCurrentSHA, we could change this to be a default and either prompt the user or even better just use a passed in sha from the flag (flag.canary). Would be cool to support just passing in a PR number too

npmUtils.addDistTag(pkg.name, versions[pkg.name], process.env.NPM_DIST_TAG);
} else if (flags.canary) {
logger.log("info", "Adding canary npm dist-tag");
npmUtils.addDistTag(pkg.name, pkg.pkg.version, "canary");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed since versions[pkg.name] wasn't working

If pkg.pkg.version has already been set, we can just use that everywhere instead of versions[pkg.name] right? In this case, the cross dependent versions are undefined (unless we should modify that instead)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we actually updating the version in pkg.pkg.version or are we just updating the file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/hzoo/lerna/blob/publish-dev/lib/commands/publish/updateChangedPackages.js#L46-L58

in updateChangedPackages we used to only change the updated packages.

I changed it to run on all packages, and then set the version in pkg.pkg.version = version; at the end we rewrite the package.json

@hzoo

hzoo commented Feb 27, 2016

Copy link
Copy Markdown
Contributor Author

I did find you that you can do ^1.1.1-canary. Could change all the dependencies to that instead of the exact release (or canary dist tag). Then we wouldn't have to update cross dependencies as much (only the first time for ^1.1.1.

http://semver.npmjs.com/
screen shot 2016-02-27 at 11 44 00 am

@facundocabrera

Copy link
Copy Markdown

@hzoo @thejameskyle I'm pretty new versioning packages using npm and feels pretty conformable with the canary strategy over custom tags in npm.

The question is, does it make sense to keep NPM_DIST_TAG over --canary or --tag name?

Feel free to remove the comment if make noise.

Thanks!

@jamiebuilds

Copy link
Copy Markdown
Contributor

@Dendril want to create a separate issue for that?

jamiebuilds added a commit that referenced this pull request Mar 3, 2016
Publish as a dev/canary release
@jamiebuilds
jamiebuilds merged commit 631817d into lerna:master Mar 3, 2016
@facundocabrera

Copy link
Copy Markdown

Done #77.

Thanks!

@jamiebuilds jamiebuilds mentioned this pull request Mar 6, 2016
@babel-bot babel-bot mentioned this pull request Sep 7, 2016
10 of 19 tasks
@lock

lock Bot commented Dec 28, 2018

Copy link
Copy Markdown

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Dec 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants