You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: Before submitting PR, discuss implementation and API.
Note: * - complex task.
Reacted by Jamie Rolfs, Daniele Orlando, Patrick, mono, Richard Simpson, Julian Meinking, evorios, youngje (heka), Janusz Marcinkiewicz, Abdellah and 17 more
If so: personally I am glad that fs-extra is included by default. It includes fs.readJsonSync() which is exactly the kind of convenience that is nice in zx.
It also isn't clear whether the above addresses #636. What I (and I think others) would like is a decoupling of:
Personally, I think of ZX as a replacement for Bash, so it's more important that it works, by default, similarly. Most of my scripts have the expectation of being a little bit noisy - running commands, and having the output go to the console, so the user can see what is happening while it is running.
Making it so that doesn't happen is the Bash equivalent of writing > /dev/null at the end of every line, which would, for me, be unusual.
I don't dispute that there are situations where it's preferable not to pass stdout to the command line, but I think the default should be around the other way. And of course, changing the default will change the behaviour of every existing script.
Perhaps you'd consider additional per-command flags in any case, which would also protect scripts against future changes to this default:
I don't know, because I haven't tried the pipe method, and it wouldn't necessarily occur to me either. Thus far in my usage of zx, have not had to use .pipe() or process.stdout.
I take hours to find out why the default value changed for $.verbose.
npm install v8 for me by default, and I didn't aware of that. I kept checking the v7 document and feeling confused.
Reacted by Anton Medvedev, Kamil Dzieniszewski, mustafa0x and Nate
It's a backend tool. Bundle size seems pretty irrelevant. It would be
pretty annoying to lose functionality or even to make breaking changes in
support of that goal.
In any case, the bundle size issue doesn't have anything to do with this
issue.
bundle install size and performance are always relevant (we're not bundling here)
picocolors is faster than chalk and is much smaller. this one would change the public API slightly in that we wouldn't support RGB colours anymore (only the standard term/ansi colours)
globbing can be achieved with fdir and picomatch, which will be much faster and achieve the same public interface (ability to pass globs).
i agree it would be pretty annoying to lose functionality, or make breaking changes. luckily, we don't have to. the only lost functionality would really be the RGB function in chalk
this stuff does matter even if not for you specifically. its part of a much wider effort to improve perf across the ecosystem, im only here trying to help.
Activity
stevage commentedon Dec 19, 2023
Is this the place to discuss these plans?
If so: personally I am glad that
fs-extrais included by default. It includesfs.readJsonSync()which is exactly the kind of convenience that is nice in zx.It also isn't clear whether the above addresses #636. What I (and I think others) would like is a decoupling of:
antonmedv commentedon Dec 19, 2023
My idea about new verbose mode for $:
I also was planning to drop fs-extra by default.
stevage commentedon Dec 19, 2023
IMHO the default behaviour should be similar to a Bash script:
If you make stdout not printed by default it will be confusing in a case like:
which well then of course behave differently from
What's the rationale?
antonmedv commentedon Dec 19, 2023
JS equivalent of echo is console.log. The problem with outputting $ by default is what we cannot distinguishes how it used:
versus
So the idea is to not output anything(defaul behavior), allow to override with
$.verbose =true.Or you can simple redirect stdout:
stevage commentedon Dec 20, 2023
Personally, I think of ZX as a replacement for Bash, so it's more important that it works, by default, similarly. Most of my scripts have the expectation of being a little bit noisy - running commands, and having the output go to the console, so the user can see what is happening while it is running.
Making it so that doesn't happen is the Bash equivalent of writing
> /dev/nullat the end of every line, which would, for me, be unusual.I don't dispute that there are situations where it's preferable not to pass stdout to the command line, but I think the default should be around the other way. And of course, changing the default will change the behaviour of every existing script.
Perhaps you'd consider additional per-command flags in any case, which would also protect scripts against future changes to this default:
antonmedv commentedon Dec 20, 2023
What is different between $.noisy and
.pipe(process.stdout)?stevage commentedon Dec 20, 2023
I don't know, because I haven't tried the
pipemethod, and it wouldn't necessarily occur to me either. Thus far in my usage of zx, have not had to use.pipe()orprocess.stdout.lawrenceching commentedon Apr 25, 2024
Suggest to release the v8 document ASAP.
I take hours to find out why the default value changed for $.verbose.
npm install v8 for me by default, and I didn't aware of that. I kept checking the v7 document and feeling confused.
43081j commentedon Aug 21, 2024
i see v8 is out already so this can't really happen until 9.x i suppose - but it would still be good to reduce the size of zx a bit
we could do that a few ways:
but since we expose these in the public interface, it'd be a breaking change for any of them
antonmedv commentedon Aug 21, 2024
We do a bundling for zx. So now zx kina small.
43081j commentedon Aug 21, 2024
You do indeed do bundling. it is 3MB+, it can be smaller
800KB+ of that is the bundle, which we could certainly reduce (the rest is mostly
@types/node)2 of the suggestions above will also improve performance, so this is not only about footprint
stevage commentedon Aug 22, 2024
43081j commentedon Aug 22, 2024
bundleinstall size and performance are always relevant (we're not bundling here)picocolors is faster than chalk and is much smaller. this one would change the public API slightly in that we wouldn't support RGB colours anymore (only the standard term/ansi colours)
globbing can be achieved with fdir and picomatch, which will be much faster and achieve the same public interface (ability to pass globs).
i agree it would be pretty annoying to lose functionality, or make breaking changes. luckily, we don't have to. the only lost functionality would really be the RGB function in chalk
this stuff does matter even if not for you specifically. its part of a much wider effort to improve perf across the ecosystem, im only here trying to help.
styfle commentedon Nov 21, 2024
Why is
@types/fs-extraand@types/nodelisted inoptionalDependencies? Can those be moved todevDependenciesinstead?I'm not seeing them used besides
build.test.tshttps://github.com/search?q=repo%3Agoogle%2Fzx+%40types%2Ffs-extra&type=code