Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 44f8c96

Browse files
committedJul 1, 2019
add yarn support
1 parent 80c3dec commit 44f8c96

File tree

2 files changed

+27
-24
lines changed

2 files changed

+27
-24
lines changed
 

‎lib/parser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ function getScriptName(command) {
44
return command
55
.replace(/^npm run\s/, '')
66
.replace(/^npm\s/, '')
7+
.replace(/^yarn run\s/, '')
8+
.replace(/^yarn\s/, '')
79
}
810

911
function getSteps(pkg, scriptName) {

‎usage.js

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,35 @@ const parse = require('./lib')
66
const packagePath = path.join(__dirname, 'tests/fixtures/one.json')
77

88
async function runParser() {
9-
const parsed = await parse(packagePath, 'npm run build')
9+
const parsed = await parse(packagePath, 'yarn run build')
1010
console.log(util.inspect(parsed, {
1111
showHidden: false,
1212
depth: null
1313
}))
14-
/* Parsed contents
15-
{
16-
command: 'npm run build',
17-
steps: [{
18-
name: 'prebuild',
19-
raw: 'echo a && npm run foo',
20-
parsed: ['echo a', 'echo foo']
21-
},
22-
{
23-
name: 'build',
24-
raw: 'echo b && npm run cleanup',
25-
parsed: ['echo b', 'echo cleanup']
26-
},
27-
{
28-
name: 'postbuild',
29-
raw: 'echo c',
30-
parsed: 'echo c'
31-
}
32-
],
33-
raw: ['echo a', 'echo foo', 'echo b', 'echo cleanup', 'echo c'],
34-
combined: 'echo a && echo foo && echo b && echo cleanup && echo c'
35-
}
36-
*/
3714
}
3815

3916
runParser()
17+
18+
/* Parsed contents
19+
{
20+
command: 'npm run build',
21+
steps: [{
22+
name: 'prebuild',
23+
raw: 'echo a && npm run foo',
24+
parsed: ['echo a', 'echo foo']
25+
},
26+
{
27+
name: 'build',
28+
raw: 'echo b && npm run cleanup',
29+
parsed: ['echo b', 'echo cleanup']
30+
},
31+
{
32+
name: 'postbuild',
33+
raw: 'echo c',
34+
parsed: 'echo c'
35+
}
36+
],
37+
raw: ['echo a', 'echo foo', 'echo b', 'echo cleanup', 'echo c'],
38+
combined: 'echo a && echo foo && echo b && echo cleanup && echo c'
39+
}
40+
*/

0 commit comments

Comments
 (0)
Please sign in to comment.