Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move from --skip-temp-tag to --temp-tag #777

Merged

Conversation

noherczeg
Copy link
Contributor

@noherczeg noherczeg commented Apr 22, 2017

Explicit skipping of a temp tag is no longer necessary since packages are published in topological order. Fixes #742

Description

I removed the --skip-temp-tag flag from the codebase and replaced it with --temp-tag with a default value of false.

This means that if nothing is provided Lerna will not create a temp-tag.

If someone would like to create a temp-tag in the process he/she could do it by providing the --temp-tag flag.

How Has This Been Tested?

Inverted the test case where temp tag creation was disabled and tested if it indeed is created when requested.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@noherczeg
Copy link
Contributor Author

I need help with the wording of the new flag in the docs. I think @hzoo or @evocateur could help out with this. Not sure about keeping the old flag with a deprecation warning is needed either. I put it in just to not confuse devs already using said feature, but it could be removed.

Also need someone to check the updated test snapshots because I'm not 100% certain that everything is okay.

Copy link
Member

@evocateur evocateur left a comment

Choose a reason for hiding this comment

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

Looking good so far!

README.md Outdated
@@ -731,11 +731,15 @@ This is useful if you do not want to explicitly set up your registry
configuration in all of your package.json files individually when e.g. using
private registries.

#### --skip-temp-tag
#### --skip-temp-tag (DEPRECATED)
Copy link
Member

@evocateur evocateur Apr 22, 2017

Choose a reason for hiding this comment

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

I think we can just replace --skip-temp-tag with --use-temp-tag, since we're breaking the default behaviour anyway. Even if --skip-temp-tag is passed, it won't matter because that's what we'll be doing anyway.

The description of the flag would be similar to the existing docs, but slightly tweaked:


--use-temp-tag

When passed, this flag will alter the default publish process by first publishing all changed packages to a temporary dist-tag (lerna-temp) and then moving the new version(s) to the default dist-tag (latest).

This is not generally necessary, as Lerna will publish packages in topological order (all dependencies before dependents) by default.

Copy link
Contributor Author

@noherczeg noherczeg Apr 22, 2017

Choose a reason for hiding this comment

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

I wanted to use --temp-tag because yargs has a negate-fields feature where one could say --no-temp-tag and that would work better than --no-use-temp-tag.

If this isn't important I can switch to the one you requested.

@@ -86,9 +86,11 @@ export const builder = {
group: "Command Options:",
describe: "Stop before actually publishing change to npm."
},
"skip-temp-tag": {
"temp-tag": {
Copy link
Member

Choose a reason for hiding this comment

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

--use-temp-tag scans a little better, here. Since it's a boolean option, you don't need to provide an explicit default: false since that's what happens anyway when the option is omitted.

@@ -521,7 +523,7 @@ export default class PublishCommand extends Command {
npmPublishAsPrerelease(callback) {
// if we skip temp tags we should tag with the proper value immediately
// therefore no updates will be needed
const tag = this.options.skipTempTag ? this.getDistTag() : "lerna-temp";
const tag = !this.options.tempTag ? this.getDistTag() : "lerna-temp";
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to reverse this ternary, for clarity.

const tag = this.options.useTempTag ? "lerna-temp" : this.getDistTag();

expect(NpmUtilities.checkDistTag).not.toBeCalled();
expect(NpmUtilities.removeDistTag).not.toBeCalled();
expect(NpmUtilities.addDistTag).not.toBeCalled();
expect(NpmUtilities.checkDistTag).lastCalledWith(
Copy link
Member

Choose a reason for hiding this comment

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

These lastCalledWith()s should be replaced by a expect(addedDistTagInDirectories(testDir)).toMatchSnapshot("[normal --use-temp-tag] npm dist-tag add"); assertion.

@@ -1,13 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`[independent --canary --npm-tag=next --yes --exact] npm dist-tag add 1`] = `
Copy link
Member

Choose a reason for hiding this comment

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

This snapshot should be replaced by

expect(publishedTagInDirectories(testDir)).toMatchSnapshot("[independent --canary --npm-tag=next --yes --exact] npm publish --tag");

Copy link
Member

Choose a reason for hiding this comment

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

Likewise with the other snapshots that have turned into empty objects, those aren't very useful and should be replaced by publishedTagInDirectories() where it makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Think I updated everything in #4ed5845, dunno why github isn't detecting it.

@evocateur evocateur added this to the v2.0.0 milestone Apr 22, 2017
@evocateur evocateur merged commit 2bcd182 into lerna:master Apr 22, 2017
@evocateur
Copy link
Member

Thanks @noherczeg!

@cary-smith
Copy link

Thank you for making this the default behavior! Just started using lerna and ran into this issue with our own internal npm via Nexus.

@lock
Copy link

lock bot commented Dec 27, 2018

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 27, 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.

Remove --skip-temp-tag (or make it the default)
3 participants