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

Rewrite synchronize-npm-tags in Node #66

Merged
merged 12 commits into from
Apr 29, 2022
Merged

Rewrite synchronize-npm-tags in Node #66

merged 12 commits into from
Apr 29, 2022

Conversation

minkimcello
Copy link
Contributor

@minkimcello minkimcello commented Nov 22, 2021

Motivation

The current synchronize-npm-tags action does not support monorepos yet, and we have a lot of stale NPM tags on bigtest and effection:

Screen Shot 2021-11-24 at 9 01 19 AM

Approach

What's New?

  • The old action ran npm dist-tag ls from the root so it worked fine for a normal repository but wouldn't work for a monorepo. The new action looks something like this:
    get every non-private package in repo
      get every git branch
        get npm tags for each package
        
    for each package
      for each tag of package
        if tag does not correspond to git branches or any of the protected tags
          npm dist-tag rm {pkg} {tag}
          
    output results
      ones that were forbidden (not enough permission on NPM)
      tags that were removed
      tags that were preserved
  • We still have the PRESERVE argument for users to specify tags they want to keep even if there are no corresponding branches
    • Default protected tags include: beta, alpha, dev, and latest. These are included regardless of if users specify their own tags.
  • The old preview action generated tags by replacing _ with __ and then replacing / with _. The new preview action replaces both _ and / with a -. This new synchronize-npm-tags action will take the list of branches and convert them into both formats in order to determine if it should be removed or not to ensure that active NPM tags will be preserved regardless of if they were generated by the old or new preview action.

Other Stuff

  • In this PR I also extracted some of the common functions from the new preview action to a separate package called @frontside/actions-utils.

TODOs

  • Update readme
  • Should I include any other default protected tags to the list?
  • Add tests

@frontsidejack
Copy link
Member

frontsidejack commented Nov 22, 2021

📣 NOTIFICATION
You are receiving this message because we did not publish any packages.

Generated by @thefrontside/actions Frontside

@minkimcello minkimcello changed the base branch from main to v2 November 29, 2021 17:19
@minkimcello minkimcello changed the title [WIP] Rewrite synchronize-npm-tags in Node Rewrite synchronize-npm-tags in Node Apr 28, 2022
@minkimcello minkimcello mentioned this pull request Apr 29, 2022
@minkimcello minkimcello requested a review from taras April 29, 2022 14:35
Copy link
Member

@taras taras left a comment

Choose a reason for hiding this comment

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

👍

@minkimcello minkimcello merged commit 25574bf into v2 Apr 29, 2022
@minkimcello minkimcello deleted the mk/tags branch April 29, 2022 14:54
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.

None yet

3 participants