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

Function status

packages/cli/src/commands/status/index.ts:14–70  ·  view source on GitHub ↗
(
  cwd: string,
  {
    sinceMaster,
    since,
    verbose,
    output,
  }: {
    sinceMaster?: boolean;
    since?: string;
    verbose?: boolean;
    output?: string;
  },
  config: Config
)

Source from the content-addressed store, hash-verified

12import { getVersionableChangedPackages } from "../../utils/versionablePackages";
13
14export default async function status(
15 cwd: string,
16 {
17 sinceMaster,
18 since,
19 verbose,
20 output,
21 }: {
22 sinceMaster?: boolean;
23 since?: string;
24 verbose?: boolean;
25 output?: string;
26 },
27 config: Config
28) {
29 if (sinceMaster) {
30 warn(
31 "--sinceMaster is deprecated and will be removed in a future major version"
32 );
33 warn("Use --since=master instead");
34 }
35 const sinceBranch =
36 since === undefined ? (sinceMaster ? "master" : undefined) : since;
37 const releasePlan = await getReleasePlan(cwd, sinceBranch, config);
38 const { changesets, releases } = releasePlan;
39 const changedPackages = await getVersionableChangedPackages(config, {
40 cwd,
41 ref: sinceBranch,
42 });
43
44 if (changedPackages.length > 0 && changesets.length === 0) {
45 error(
46 "Some packages have been changed but no changesets were found. Run `changeset add` to resolve this error."
47 );
48 error(
49 "If this change doesn't need a release, run `changeset add --empty`."
50 );
51 process.exit(1);
52 }
53
54 if (output) {
55 await fs.writeFile(
56 path.resolve(cwd, output),
57 JSON.stringify(releasePlan, undefined, 2)
58 );
59 return;
60 }
61
62 const print = verbose ? verbosePrint : SimplePrint;
63 print("patch", releases);
64 log("---");
65 print("minor", releases);
66 log("---");
67 print("major", releases);
68
69 return releasePlan;
70}
71

Callers 2

runFunction · 0.85
status.tsFile · 0.85

Calls 5

warnFunction · 0.90
errorFunction · 0.90
logFunction · 0.90
getReleasePlanFunction · 0.85

Tested by

no test coverage detected