Skip to content

Added support for a --no-git-tag CLI flag that can be used with changeset publish#701

Merged
Andarist merged 1 commit intomainfrom
no-git-tag
Dec 16, 2021
Merged

Added support for a --no-git-tag CLI flag that can be used with changeset publish#701
Andarist merged 1 commit intomainfrom
no-git-tag

Conversation

@Andarist
Copy link
Copy Markdown
Member

@Andarist Andarist commented Dec 8, 2021

This should be mostly used together with snapshot releases. They are usually created in the CI environment with custom scripts. So even though the tags were always created there it didn't matter that much because nobody has been pushing them on their own.

However, it feels like for snapshot releases the git tags are rarely what you actually want - and this matters especially if you want to prepare a snapshot machine locally, on your own machine. So to make this use case easier I'm proposing to introduce this flag.

It somewhat feels like a stopgap solution - but since --snapshot is not used with changeset publish I don't currently have a better idea to do this. Unless we'd infer the release type from the released package versions - this kinda seems magical though and I'm worried about introducing such a solution prematurely.

@Andarist Andarist requested a review from emmatown December 8, 2021 22:50
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Dec 8, 2021

🦋 Changeset detected

Latest commit: 95210e7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@changesets/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci bot commented Dec 8, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 95210e7:

Sandbox Source
Vanilla Configuration

Comment on lines +77 to +79
// We create the tags after the push above so that we know that HEAD wont change and that pushing
// wont suffer from a race condition if another merge happens in the mean time (pushing tags wont
// fail if we are behind the base branch).
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

quite frankly - i have no idea what that comment is about, it might refer to some older implementation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think what it's referring to is if you're publishing on every git push, you don't want to create the tags then publish to npm because whether it's published or not is what determines whether it needs to do a publish. (basically replace the the push above with the publish above in the comment)

Copy link
Copy Markdown
Member Author

@Andarist Andarist Dec 14, 2021

Choose a reason for hiding this comment

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

Hm, i still dont get it - we query npm info to check if something should be published or not, so creating git tags shouldnt affect this at all

`
Usage
$ changesets [command]
$ changeset [command]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this kinda showcase how confusing the name of the script is - should we create two executables: changeset and changesets?

Comment on lines +14 to +16
version [--ignore] [--snapshot <?name>]
publish [--tag <name>] [--otp <code>] [--no-git-tag]
status [--since <branch>] [--verbose] [--output JSON_FILE.json]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've just unified this a little bit and added stuff that was missing from here

Comment on lines +56 to +58
// mixed type like this is not supported by `meow`
// if it gets passed explicitly then it's still available on the flags with an inferred type though
// snapshot: { type: "boolean" | "string" },
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

i've left this out as a comment since I believe that every supported option should be listed here.

Comment on lines -4 to -6
commit?: boolean;
changelog?: string;
access?: AccessType;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

those were unused and unsupported - probably leftovers from the previous implementation

ignore?: string | string[];
snapshot?: string | boolean;
tag?: string;
gitTag?: boolean;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not sure about the name of this option. Maybe it should be something like --skip-git-tags?

One thing I've noticed just now is that changeset tag creates git tags, while --tag (accepted by the publish command) is used for npm/release tagging. Can we do better? Should we rename changeset tag to be something else (like changeset git-tag)?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--no-git-tag seems fine to me

Should we rename changeset tag to be something else (like changeset git-tag)?

I don't think it's that bad but maybe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants