@yarnpkg/shell 4.0.2 • Public • Published 19 days 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.2
108,376
3.3.0
10,562
Version History Version
Downloads (Last 7 Days) 4.0.2
108,376
4.0.1
5
3.3.0
10,562
4.0.0
36,506
4.0.0-rc.53
720
4.0.0-rc.52
1,868
4.0.0-rc.51
49
4.0.0-rc.50
1,855
4.0.0-rc.49
2
4.0.0-rc.48
1,808
4.0.0-rc.47
6
4.0.0-rc.46
64
4.0.0-rc.45
182
4.0.0-rc.44
216
4.0.0-rc.43
109
4.0.0-rc.42
956
4.0.0-rc.41
46
4.0.0-rc.40
146
4.0.0-rc.39
245
4.0.0-rc.38
14
4.0.0-rc.37
12
4.0.0-rc.36
11
4.0.0-rc.35
158
4.0.0-rc.34
87
4.0.0-rc.33
928
4.0.0-rc.32
44
4.0.0-rc.31
90
4.0.0-rc.30
53
4.0.0-rc.29
1
3.2.5
29,240
4.0.0-rc.28
1
4.0.0-rc.27
78
4.0.0-rc.26
17
4.0.0-rc.25
75
4.0.0-rc.24
1
4.0.0-rc.23
1
4.0.0-rc.22
1
4.0.0-rc.21
1
4.0.0-rc.20
96
4.0.0-rc.18
12
4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