File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -71,19 +71,26 @@ platform-independent scripts, we recommend you go with that.
7171
7272However, ` shx ` is ideal for one-liners inside ` package.json ` :
7373
74- ``` javascript
74+ ``` json
7575{
7676 "scripts" : {
77- " clean" : " shx rm -rf build dist && shx echo Done"
77+ "clean" : " shx rm -rf \" build/**/*.js \" \" build/output \" && shx echo \" Done cleaning \" "
7878 }
7979}
8080```
8181
82- ** Tip:** because Windows treats single quotes (ex. ` 'some string' ` ) differently
83- than double quotes, [ we
84- recommend] ( https://github.com/shelljs/shx/issues/165#issuecomment-563127983 )
85- wrapping your arguments in double quotes for cross platform compatibility (ex.
86- ` "some string" ` ).
82+ It's safe to use ` && ` and ` || ` operators in npm package scripts. These will be
83+ interpreted by the operating system's shell (` sh ` on Unix, ` cmd.exe ` on
84+ Windows). If you're using glob operators like ` * ` or ` ** ` , then we recommend to
85+ ** put these in double quotes** , which ensures that ` shx ` will expand the glob
86+ rather than the operating system shell.
87+
88+ > [ !IMPORTANT]
89+ > Windows treats single quotes (ex. ` 'some string' ` ) differently than double
90+ > quotes.
91+ > [ We recommend] ( https://github.com/shelljs/shx/issues/165#issuecomment-563127983 )
92+ > wrapping your arguments in ** escaped double quotes** so that your code is
93+ > compatible cross platform (ex. ` "clean": "shx echo \"some string\"" ` ).
8794
8895## Command reference
8996
You can’t perform that action at this time.
0 commit comments