8000 chore: add both option to sample-runner · NathanN1987/nativescript-vue@a95363d · GitHub
[go: up one dir, main page]

Skip to content

Commit a95363d

Browse files
committed
chore: add both option to sample-runner
1 parent db0f680 commit a95363d

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

build/sample-runner.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,30 @@ inquirer
2424
type: 'list',
2525
message: 'Choose a platform to run on',
2626
name: 'platform',
27-
choices: ['Android', 'iOS']
27+
choices: ['Android', 'iOS', 'Both']
2828
}
2929
])
3030
.then(res => {
3131
setMain(res.sample)
32-
tns = spawn('tns', ['run', res.platform], {
33-
cwd: path.resolve(__dirname, '../samples')
34-
})
32+
if(res.platform.toLowerCase() === 'both') {
33+
runPlatform('ios')
34+
runPlatform('android')
3535

36-
tns.on('error', err => console.log(err))
37-
tns.stdout.on('data', data => process.stdout.write(data))
36+
return;
37+
}
38+
39+
runPlatform(res.platform)
40+
})
41+
42+
function runPlatform(platform) {
43+
tns = spawn('tns', ['run', platform], {
44+
cwd: path.resolve(__dirname, '../samples')
3845
})
3946

47+
tns.on('error', err => console.log(err))
48+
tns.stdout.on('data', data => process.stdout.write(platform + ': ' +data))
49+
}
50+
4051
function shutDown() {
4152
if (tns) {
4253
tns.stdin.pause()

0 commit comments

Comments
 (0)
0