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

feat(npm): add fn to Update a package's tag in the npm registry to a specific version #267

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export { default as gitPublishBranch } from "./git/doGitPublishBranch.js";
export { default as gitReset } from "./git/doGitReset.js";
export { default as gitDiff } from "./git/doGitDiff.js";

export { default as npmSetTag } from "./npm/doSetNpmTag.js";
export { default as npmBumpVersion } from "./npm/doNpmBumpVersion.js";
export { default as npmPublish } from "./npm/doNpmPublish.js";
export { default as refreshPackageLock } from "./npm/doRefreshPackageLock.js";
Expand Down
19 changes: 19 additions & 0 deletions src/npm/doSetNpmTag.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import spawn from "../utils/spawn.js";
import appendCmdIfWindows from "./utils/appendCmdIfWindows.js";
import npmLogger from "./utils/npmLogger.js";

/**
* Update a package's tag in the npm registry to a specific version
* @param packageName The name of the package to update
* @param version The version to use for the update
* @param tag Th tag to update
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @param tag Th tag to update
* @param tag The tag to update

*/
export default async function (
packageName: string,
version: string,
tag: string,
) {
const params = ["dist-tag", "add", [packageName, version].join("@"), tag];
const npmPs = await spawn(appendCmdIfWindows`npm`, params, npmLogger);
return npmPs.stdout.toString().trim();
}
Loading