MCPcopy Index your code
hub / github.com/bombshell-dev/clack / main

Function main

examples/changesets/index.ts:10–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8}
9
10async function main() {
11 console.clear();
12
13 await setTimeout(1000);
14
15 p.intro(`${color.bgCyan(color.black(' changesets '))}`);
16
17 const _changeset = await p.group(
18 {
19 packages: () =>
20 p.groupMultiselect({
21 message: 'Which packages would you like to include?',
22 options: {
23 'changed packages': [
24 { value: '@scope/a' },
25 { value: '@scope/b' },
26 { value: '@scope/c' },
27 ],
28 'unchanged packages': [
29 { value: '@scope/x' },
30 { value: '@scope/y' },
31 { value: '@scope/z' },
32 ],
33 },
34 }),
35 major: ({ results }) => {
36 const packages = results.packages ?? [];
37 return p.multiselect({
38 message: `Which packages should have a ${color.red('major')} bump?`,
39 options: packages.map((value) => ({ value })),
40 required: false,
41 });
42 },
43 minor: ({ results }) => {
44 const packages = results.packages ?? [];
45 const major = Array.isArray(results.major) ? results.major : [];
46 const possiblePackages = packages.filter((pkg) => !major.includes(pkg));
47 if (possiblePackages.length === 0) return;
48 return p.multiselect({
49 message: `Which packages should have a ${color.yellow('minor')} bump?`,
50 options: possiblePackages.map((value) => ({ value })),
51 required: false,
52 });
53 },
54 patch: async ({ results }) => {
55 const packages = results.packages ?? [];
56 const major = Array.isArray(results.major) ? results.major : [];
57 const minor = Array.isArray(results.minor) ? results.minor : [];
58 const possiblePackages = packages.filter(
59 (pkg) => !major.includes(pkg) && !minor.includes(pkg)
60 );
61 if (possiblePackages.length === 0) return;
62 const note = possiblePackages.join(color.dim(', '));
63
64 p.log.step(`These packages will have a ${color.green('patch')} bump.\n${color.dim(note)}`);
65 return possiblePackages;
66 },
67 },

Callers 1

index.tsFile · 0.70

Calls 2

onCancelFunction · 0.85
clearMethod · 0.65

Tested by

no test coverage detected