MCPcopy Index your code
hub / github.com/changesets/changesets / tag

Function tag

packages/cli/src/commands/tag/index.ts:8–35  ·  view source on GitHub ↗
(cwd: string, config: Config)

Source from the content-addressed store, hash-verified

6import { getUntaggedPackages } from "../../utils/getUntaggedPackages";
7
8export default async function tag(cwd: string, config: Config) {
9 const { packages, tool } = await getPackages(cwd);
10
11 const allExistingTags = await git.getAllTags(cwd);
12
13 const taggablePackages = packages.filter(
14 (pkg) =>
15 !shouldSkipPackage(pkg, {
16 ignore: config.ignore,
17 allowPrivatePackages: config.privatePackages.tag,
18 })
19 );
20
21 for (const { name, newVersion } of await getUntaggedPackages(
22 taggablePackages,
23 cwd,
24 tool
25 )) {
26 const tag = tool !== "root" ? `${name}@${newVersion}` : `v${newVersion}`;
27
28 if (allExistingTags.has(tag)) {
29 log("Skipping tag (already exists): ", tag);
30 } else {
31 log("New tag: ", tag);
32 await git.tag(tag, cwd);
33 }
34 }
35}

Callers 1

index.test.tsFile · 0.50

Calls 3

shouldSkipPackageFunction · 0.90
getUntaggedPackagesFunction · 0.90
logFunction · 0.90

Tested by

no test coverage detected