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
{{ message }}
This repository was archived by the owner on Jan 6, 2021. It is now read-only.
> WARNING! Make sure that when you're installing packages that you spell things
61
67
> correctly to avoid [mistakenly installing malware][malware]
62
68
63
-
> NOTE : Version 6 of cross-env only supports Node.js 8 and higher, to use it on Node.js 7 or lower install version 5
64
-
> ```npm install --save-dev cross-env@5```
69
+
> NOTE : Version 6 of cross-env only supports Node.js 8 and higher, to use it on
70
+
> Node.js 7 or lower install version 5 `npm install --save-dev cross-env@5`
65
71
66
72
## Usage
67
73
@@ -100,12 +106,16 @@ Where `childScript` holds the actual command to execute and `parentScript` sets
100
106
the environment variables to use. Then instead of run the childScript you run
101
107
the parent. This is quite useful for launching the same command with different
102
108
env variables or when the environment variables are too long to have everything
103
-
in one line. It also means that you can use `$GREET` env var syntax even on
109
+
in one line. It also means that you can use `$GREET` env var syntax even on
104
110
Windows which would usually require it to be `%GREET%`.
105
111
106
-
If you precede a dollar sign with an odd number of backslashes the expression statement will not be replaced. Note that this means backslashes after the JSON string escaping took place. `"FOO=\\$BAR"` will not be replaced. `"FOO=\\\\$BAR"` will be replaced though.
112
+
If you precede a dollar sign with an odd number of backslashes the expression
113
+
statement will not be replaced. Note that this means backslashes after the JSON
114
+
string escaping took place. `"FOO=\\$BAR"` will not be replaced.
115
+
`"FOO=\\\\$BAR"` will be replaced though.
107
116
108
-
Lastly, if you want to pass a JSON string (e.g., when using [ts-loader]), you can do as follows:
117
+
Lastly, if you want to pass a JSON string (e.g., when using [ts-loader]), you
118
+
can do as follows:
109
119
110
120
```json
111
121
{
@@ -115,21 +125,21 @@ Lastly, if you want to pass a JSON string (e.g., when using [ts-loader]), you ca
115
125
}
116
126
```
117
127
118
-
Pay special attention to the **triple backslash**`(\\\)`**before** the **double quotes**`(")` and the **absence** of **single quotes**`(')`.
119
-
Both of these conditions have to be met in order to work both on Windows and UNIX.
128
+
Pay special attention to the **triple backslash**`(\\\)`**before** the
129
+
**double quotes**`(")` and the **absence** of **single quotes**`(')`. Both of
130
+
these conditions have to be met in order to work both on Windows and UNIX.
120
131
121
132
## `cross-env` vs `cross-env-shell`
122
133
123
134
The `cross-env` module exposes two bins: `cross-env` and `cross-env-shell`. The
124
-
first one executes commands using [`cross-spawn`][cross-spawn], while the
125
-
second one uses the `shell` option from Node's `spawn`.
135
+
first one executes commands using [`cross-spawn`][cross-spawn], while the second
136
+
one uses the `shell` option from Node's `spawn`.
126
137
127
-
The main use case for `cross-env-shell` is when you need an environment
128
-
variable to be set across an entire inline shell script, rather than just one
129
-
command.
138
+
The main use case for `cross-env-shell` is when you need an environment variable
139
+
to be set across an entire inline shell script, rather than just one command.
130
140
131
141
For example, if you want to have the environment variable apply to several
132
-
commands in series then you will need to wrap those in quotes and use
142
+
commands in series then you will need to wrap those in quotes and use
133
143
`cross-env-shell` instead of `cross-env`.
134
144
135
145
```json
@@ -140,29 +150,34 @@ commands in series then you will need to wrap those in quotes and use
140
150
}
141
151
```
142
152
143
-
The rule of thumb is: if you want to pass to `cross-env` a command that
144
-
contains special shell characters *that you want interpreted*, then use
153
+
The rule of thumb is: if you want to pass to `cross-env` a command that contains
154
+
special shell characters _that you want interpreted_, then use
145
155
`cross-env-shell`. Otherwise stick to `cross-env`.
146
156
147
-
On Windows you need to use `cross-env-shell`, if you want to handle [signal events](https://nodejs.org/api/process.html#process_signal_events) inside of your program. A common case for that is when you want to capture a `SIGINT` event invoked by pressing `Ctrl + C` on the command-line interface.
157
+
On Windows you need to use `cross-env-shell`, if you want to handle
0 commit comments