This repository was archived by the owner on Jan 6, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ Run scripts that set and use environment variables across platforms
22
22
[ ![ Star on GitHub] [ github-star-badge ]] [ github-star ]
23
23
[ ![ Tweet] [ twitter-badge ]] [ twitter ]
24
24
25
+ [ ![ Sponsor] ( https://app.codesponsor.io/embed/PKGFLnhDiFvsUA5P4kAXfiPs/kentcdodds/cross-env.svg )] ( https://app.codesponsor.io/link/PKGFLnhDiFvsUA5P4kAXfiPs/kentcdodds/cross-env )
26
+
25
27
## The problem
26
28
27
29
Most Windows command prompts will choke when you set environment variables with
@@ -46,6 +48,9 @@ should be installed as one of your project's `devDependencies`:
46
48
npm install --save-dev cross-env
47
49
```
48
50
51
+ > WARNING! Make sure that when you're installing packages that you spell things
52
+ > correctly to avoid [ mistakenly installing malware] [ malware ]
53
+
49
54
## Usage
50
55
51
56
I use this in my npm scripts:
@@ -86,13 +91,15 @@ env variables or when the environment variables are too long to have everything
86
91
in one line.
87
92
88
93
Lastly, if you want to pass a JSON string (e.g., when using [ ts-loader] ), you can do as follows:
94
+
89
95
``` json
90
96
{
91
97
"scripts" : {
92
98
"test" : " cross-env TS_NODE_COMPILER_OPTIONS={\\\" module\\\" :\\\" commonjs\\\" } node some_file.test.ts"
93
99
}
94
100
}
95
101
```
102
+
96
103
Pay special attention to the ** triple backslash** ` (\\\) ` ** before** the ** double quotes** ` (") ` and the ** absence** of ** single quotes** ` (') ` .
97
104
Both of these conditions have to be met in order to work both on Windows and UNIX.
98
105
191
198
[ angular-formly ] : https://github.com/formly-js/angular-formly
192
199
[ cross-spawn ] : https://www.npmjs.com/package/cross-spawn
193
200
[ ts-loader ] : https://www.npmjs.com/package/ts-loader
201
+ [ malware ] : http://blog.npmjs.org/post/163723642530/crossenv-malware-on-the-npm-registry
You can’t perform that action at this time.
0 commit comments