-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI: show progress/file paths while unpacking/unminifying #82
Comments
Unpacking cannot provide any progress because of the design. Unminify will have a better output on the spinner with For progress, how about things like (21/37)? Btw, users should be able to see the For error handling, most of error reporting has been slightly improved to print the file and rule name. I will look into the error you provided, do you have a sample? |
@pionxzh What aspect of the design prevents it? The main CLI file calls into the wakaru/packages/cli/src/cli.ts Lines 275 to 280 in 3758f48
Which loops through the provided wakaru/packages/cli/src/unpacker.ts Lines 15 to 25 in 3758f48
Could that not print out the paths with And then, if a progress bar was to be implemented, for the unpacker, at a basic level, I would think that it could show progress based on the number of paths processed vs the total number of paths to be processed; because at this point, we've already expanded all of the globs.
@pionxzh Something like I'll have to check again, but I don't think the
@pionxzh Haha true. I haven't tried that one yet. It looks like you're not currently using wakaru/packages/cli/src/cli.ts Lines 382 to 400 in 3758f48
@pionxzh Ah, good to know :)
@pionxzh Unfortunately not currently, aside from saying that it happened while unpacking this folder (Ref) (though that also had other 'uncommitted noise' in it at the time I got that error) I was going to open a separate issue for it as soon as I could narrow down the source that caused it. |
I was wrong. Yes, we can have a progress on unpacker. I have checked clack's task when I implement the cli, but I will check again. |
I removed the spinner in unpacker because of a bug from upstream bombshell-dev/clack#176 .
Clerk's |
@pionxzh That makes sense. Seems there is a PR (linked to that thread) that might fix that:
@pionxzh Based on a quick skim of the code, I don't think that will matter will it? wakaru/packages/cli/src/cli.ts Lines 382 to 400 in 3758f48
The My thought was that instead of import {
// ..snip..
+ tasks,
// ..snip..
} from '@clack/prompts'
// ..snip..
- const { result: measurements, time: elapsed } = await timing.measureTimeAsync(() => Promise.all(
+ const { result: measurements, time: elapsed } = await timing.measureTimeAsync(() => tasks(
unminifyInputPaths.map(p => unminify(p)),
))
// ..snip.. |
It will try to await and print the task one by one which might be still ok even though we have other task controller. But it won't show user the correct current progress if the first task is slow or something. And the output is also not ideal, there is always a gap between tasks. |
@pionxzh Oh true.. that's less than ideal. I didn't look deeply into it's implementation earlier, but it seems it's pretty simple: /**
* Define a group of tasks to be executed
*/
export const tasks = async (tasks: Task[]) => {
for (const task of tasks) {
if (task.enabled === false) continue;
const s = spinner();
s.start(task.title);
const result = await task.task(s.message);
s.stop(result || task.title);
}
}; I haven't looked deeply at how |
I just updated the log of unpacker as a workaround before For the progress bar, I will try in a few days.
|
Sounds good, thanks :) |
Just came across this lib, looks interesting:
|
The animation looks good. But I'm afraid we cannot estimate the time haha. Currently, the CLI will somehow failed to show the current processing file because of the communication between workers and the main thread. This will need some workarounds. |
By my read of that library; it learns to magically estimate the time. |
it estimate the time based on history execution results. |
Yup. Which, depending on how it maps those values, would likely give relatively useful estimates when (as an example) unminimising the same project's builds over time (eg. I suspect the _app.js bundle of the project I am usually unminimising will take a similar time for each new build) Whereas obviously for a completely different project the estimates may be way off.
|
Currently the CLI doesn't seem to show any indication of progress while unpacking (possibly also while unminifying?):
It would be nice if we were able to see some more output here; potentially a progress bar, and/or list of the file paths being processed. This would help with understanding what the CLI is currently doing, if it's frozen, etc.
It would also make it easier to identify what file was likely the cause of an error like this, as we could then manually correlate the path of the file being processed with the error message:
There may be other ways to improve error outputs like that as well (eg. potentially being able to inform the parser of the path/filename of the code being processed, and then it may expose that info directly in the error messages)
It appears that the CLI is currently built with
clack
:That seems to have the concept of a spinner, but seemingly not a progress bar/etc:
It can apparently even do multiple tasks in spinners:
From a quick google (in no particular order):
The text was updated successfully, but these errors were encountered: