question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Proposal] Using POSIX shell commands in tasks chain

See original GitHub issue

It 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.

cc @jbucaran @lukeed

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
devmondocommented, Sep 26, 2016

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.

2reactions
lukeedcommented, Sep 29, 2016

Update: My plugin was renamed to fly-shell. Thank you to @danny-andrews for relinquishing the name.

Pinging @hzlmn since you probably interested.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A guide to bash commands redirecting, chaining, and nesting
A guide to bash commands redirecting, chaining, and nesting. Once you have some basic practical knowledge of how to use shell commands, you...
Read more >
job control - How to plan a task to run after another already ...
Generally what I do is: Ctrl + Z fg && command2. Ctrl + Z to pause it and let you type more in...
Read more >
How do I run multiple background commands in bash in a ...
The & tells the shell to execute all of the "connected" commands preceding it, in the background. "connected" here means the command is...
Read more >
The Linux Shell and Commands - CS@Dartmouth
The basic shell operation is as follows. The shell parses the command line and finds the program to execute. It passes any options...
Read more >
Bash Reference Manual - GNU.org
Like any high-level language, the shell provides variables, flow control constructs, quoting, and functions. Shells offer features geared ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found