Comments (6)
Thank you, $npm_lifecycle_event it is interesting feature, but in case of redrun
all scripts will be transformed in one line:
printenv npm_lifecycle_event
Should print three
I think. But what if in scripts
would be a couple such variables:
{
"one": "redrun two three",
"two": "printenv npm_lifecycle_event",
"three": "printenv npm_lifecycle_event"
}
In case of npm
it will show:
two
three
But in case of redrun
it will be such string:
printenv npm_lifecycle_event && printenv npm_lifecycle_event
So the only way it could be solved is setting $npm_lifecycle_event
variables before using it, so scripts should be transformed to something like this:
npm_lifecycle_event=two printenv npm_lifecycle_event && npm_lifecycle_event=three printenv npm_lifecycle_event
Should it be at the beginning of every script or just when $npm_lifecycle_event
is present in the body of the script?
It is an interesting idea, but I think it would create a lot noise in the output of redrun
: on every step this variable should be set up. Maybe it should be hidden behind the command line option.
Can you tell me please what is your use case?
from redrun.
pnpm
is a fast implementation of npm install
. It runs the package's lifecycle events during installation (like preinstall, postinstall, prebublish). It uses npm run
to run these events. First it was running them directly via child_process
, but we discovered that some packages were failing because they were relying on the environment variables defined by npm run
(there are more of those, not just npm_lifecycle_event
).
So my use case is to have the same set of variables as when npm run
is executed.
I think redrun
to npm run
is what pnpm
is to pnpm install
and it would be logical for pnpm to use a better implementation of npm run
from redrun.
It would be great if pnpm
use redrun
but I dont't know if redrun
will feet you needs completely. The thing is when you execute redrun install
it searches install
script, when can't find it shows error. When can find, it searches preinstall
and postinstall
and combines it to one command. So it is one step, not 3 separeted.
About npm_lifecycle_event
I do not know how make this variable works for whole script in the same way on Windows
and Linux
. This way wouldn't work:
npm_lifecycle_event=install ls && echo $npm_lifecycle_event
So it looks like we should add env variable to every command, or add functions
which is not portable between shells of different Operation Systems.
Do you have any ideas how to deal with it?
from redrun.
For the env variables we can use cross-env.
The first issue about merging scripts to one command, I think shouldn't be a problem, but we'll see.
from redrun.
Unfortunately cross-env
does not resolve issue related to running a couple commands with one environment variable.
from redrun.
I see... I'll close this for now, because seems like it is too hard to implement and the benefits are not so big. But I'll look into it later
from redrun.
Related Issues (12)
- Awesome project and feature how many time spent on task HOT 4
- Can't throw error code on any command, that not last, on parallel exec HOT 5
- yarn? HOT 2
- Streamline the redrun package HOT 2
- Cannot run redrun in parallel - unclear how to use the command HOT 5
- Doesn't work with dotted script names HOT 2
- Support per-script arguments HOT 2
- Should redrun work on Windows machines? HOT 11
- wraps & in quotes HOT 1
- parallel option not recognized HOT 18
- Getting "Directory not empty" error when running clean script HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redrun.