Skip to content

Commit

Permalink
feat(npm): add fn to Update a package's tag in the npm registry to a …
Browse files Browse the repository at this point in the history
…specific version
  • Loading branch information
louis-bompart committed Oct 22, 2024
1 parent 0bdc221 commit 77038cc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/npm/doSetNpmTag.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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
* @returns
*/
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();
}

0 comments on commit 77038cc

Please sign in to comment.