[Proposal] Using POSIX shell commands in tasks chain
See original GitHub issueIt is just a weird idea and I want to know what do you guys think.
Basically I like Make
due to it’s “UNIXy”, like you have a lot of tools for text wrangling and you can do almost everything you can imagine without any hustle, just by using well known shell power tools.
But when we speak about node
build systems, we have some limitations.
We run builds usually in *nix
env, but what if I want to make this steps.
- read file
- get subset of it
- replace
character
with other one - save to file
This is a trivial task using tools like tails
, sed
or grep
, but it involves writting custom plugins with Fly
Basically what I propose is to add method shell
or something similar to Fly
instance
that will look like
x['get-subset'] = function () {
yield this.source(someFile)
.shell('head -10 | sed -i s/test/changed $file')
.target('/dist')
}
How this can be acomplished
.shell
accepts raw string of shell
command
parse it and generate proper calls using shelljs
and returns execution result.
It can be useful for additional text transformation or some file system manipulations before or after task.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:15 (10 by maintainers)
Top GitHub Comments
i may not be qualified to elaborate on this, but shell commands is something as @lukeed said is not used that often, and i believe it is not the responsibility of Fly to provide that, it should be a plugin or direct use of the required Lib. same like fly does not provide browser-sync, or babel compiling as built in, otherwise it would defeat the purpose of Fly being small easy and flexible.
in my experience, i wanted to use nodemon, babel, and browser-sync, and even though there are Fly plugins for this, i did not even need it, i just used them directly as if i would in any node.js application and man this was a breath of fresh air to escape from Gulp plugins, which you have to wait for developers to fix bug or upgrade to latest babel for example.
Fly workflow for me is awesome, it gives you the simple nature of NPM scripts with the power of Gulp as task runner, but with really minimal rules and open freedom to compose your code or use any Node.js package.
Update: My plugin was renamed to
fly-shell
. Thank you to @danny-andrews for relinquishing the name.Pinging @hzlmn since you probably interested.