@yarnpkg/shell 4.0.0 • Public • Published 6 months ago
A JavaScript implementation of a bash-like shell (we use it in Yarn 2 to provide cross-platform scripting). This package exposes an API that abstracts both the parser and the interpreter; should you only need the parser you can check out @yarnpkg/parsers
, but you probably won't need it.
import { execute } from '@yarnpkg/shell' ;
process . exitCode = await execute ( `ls "$0" | wc -l` , [ process . cwd ( ) ] ) ;
Typechecked
Portable across systems
Supports custom JS builtins
Supports pipes
Supports glob patterns (only for files that exist on the filesystem: ls *.txt
)
Supports logical operators
Supports subshells
Supports variables
Supports string manipulators
Supports argc/argv
Supports background jobs with color-coded output
Supports the most classic builtins
Doesn't necessarily need to access the fs
Full glob support (mv build/{index.js,index.build.js}
, echo {foo,bar}
, FOO=a,b echo {$FOO,x}
)
More string manipulators
Perfect POSIX compliance (basic scripting is enough for now)
Multiline scripts (we mostly target one-liners)
Control structures (same reason)
Versions Current Tags Version
Downloads (Last 7 Days) 4.0.0
144,914
3.3.0
11,214
Version History Version
Downloads (Last 7 Days) 3.3.0
11,214
4.0.0
144,914
4.0.0-rc.53
754
4.0.0-rc.52
21,931
4.0.0-rc.51
84
4.0.0-rc.50
1,727
4.0.0-rc.49
7
4.0.0-rc.48
2,295
4.0.0-rc.47
6
4.0.0-rc.46
96
4.0.0-rc.45
67
4.0.0-rc.44
87
4.0.0-rc.43
98
4.0.0-rc.42
653
4.0.0-rc.41
34
4.0.0-rc.40
2,011
4.0.0-rc.39
65
4.0.0-rc.38
56
4.0.0-rc.37
0
4.0.0-rc.36
14
4.0.0-rc.35
141
4.0.0-rc.34
226
4.0.0-rc.33
520
4.0.0-rc.32
169
4.0.0-rc.31
1,293
4.0.0-rc.30
4
4.0.0-rc.29
0
3.2.5
32,578
4.0.0-rc.28
7
4.0.0-rc.27
221
4.0.0-rc.26
85
4.0.0-rc.25
69
4.0.0-rc.24
1
4.0.0-rc.23
0
4.0.0-rc.22
12
4.0.0-rc.21
16
4.0.0-rc.20
92
4.0.0-rc.18
9
4.0.0-rc.17
0
4.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