Skip to content

Conversation

@43081j
Copy link
Collaborator

@43081j 43081j commented Jun 19, 2025

This allows you to have tasklog groups.

Basically this:

const log = p.taskLog({
	title: 'yes?',
	limit: 5,
});

const group0 = log.group('group 0');
const group1 = log.group('group 1');

await Promise.all([
	(async () => {
		for (let i = 0; i < 10; i++) {
			group0.message(`foo ${i} bar`);
			await new Promise((r) => {
				setTimeout(r, 1000);
			});
		}
		group0.success('group 0 done!');
	})(),
	(async () => {
		for (let i = 0; i < 10; i++) {
			group1.message(`foo ${i} bar`);
			await new Promise((r) => {
				setTimeout(r, 500);
			});
		}
		group1.success('group 1 done!');
	})(),
]);

await new Promise((r) => {
	setTimeout(r, 1000);
});
log.success('yes!');

this will result in a scrolling task log whose sub-logs have a limit: 5 (i.e. the overall log has no such limit)

once inner logs complete, they collapse as normal

once the overall log completes, we collapse the entire thing and output the log if specified

cc @yannbf

@changeset-bot
Copy link

changeset-bot bot commented Jun 19, 2025

🦋 Changeset detected

Latest commit: 569faa6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clack/prompts Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 19, 2025

@example/basic@example/changesets

npm i https://pkg.pr.new/bombshell-dev/clack/@clack/core@347
npm i https://pkg.pr.new/bombshell-dev/clack/@clack/prompts@347

commit: 569faa6

@43081j
Copy link
Collaborator Author

43081j commented Jul 3, 2025

@yannbf if you get chance, can you have a play around with this via the pkg-pr-new install?

im pretty happy with it so we just need to throw it around a bit and see if it falls over anywhere

Copy link
Member

@dreyfus92 dreyfus92 left a comment

Choose a reason for hiding this comment

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

this looks good, just wondering if you're gonna add some tests in the future? 😁

also can you add a changeset please? 🙏🏻

@43081j
Copy link
Collaborator Author

43081j commented Jul 3, 2025

100% - i got side tracked and ended up working on some other stuff

ill try find some time to get back to this and add the tests etc

@43081j
Copy link
Collaborator Author

43081j commented Jul 6, 2025

tests + changeset added 👍

Copy link
Member

@dreyfus92 dreyfus92 left a comment

Choose a reason for hiding this comment

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

LGTM, Thank you James 🫡

@43081j 43081j merged commit f10071e into main Jul 11, 2025
7 checks passed
@43081j 43081j deleted the tasklogs-within-tasklogs branch July 11, 2025 11:11
@yannbf
Copy link

yannbf commented Oct 16, 2025

Hey @43081j so sorry I missed this! We're currently working on using Clack across the board in Storybook, we'll definitely try this out!

@43081j
Copy link
Collaborator Author

43081j commented Oct 16, 2025

Awesome, let me know if you wanna catch up on it one day! Would be good to stay in the loop and help with any guidance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants