-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
move from --skip-temp-tag to --temp-tag #777
Conversation
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. |
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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": { |
There was a problem hiding this comment.
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.
src/commands/PublishCommand.js
Outdated
@@ -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"; |
There was a problem hiding this comment.
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();
test/PublishCommand.js
Outdated
expect(NpmUtilities.checkDistTag).not.toBeCalled(); | ||
expect(NpmUtilities.removeDistTag).not.toBeCalled(); | ||
expect(NpmUtilities.addDistTag).not.toBeCalled(); | ||
expect(NpmUtilities.checkDistTag).lastCalledWith( |
There was a problem hiding this comment.
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`] = ` |
There was a problem hiding this comment.
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");
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Thanks @noherczeg! |
Thank you for making this the default behavior! Just started using lerna and ran into this issue with our own internal npm via Nexus. |
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. |
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 offalse
.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
Checklist: