-
Notifications
You must be signed in to change notification settings - Fork 0
/
runner.js
executable file
·66 lines (63 loc) · 1.93 KB
/
runner.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env node
import { exec } from 'child_process';
import yargs from 'yargs/yargs';
import deployAccount from './src/commands/deployAccount.js';
import encryptAccount from './src/commands/encryptAccount.js';
import openConsole from './src/commands/console.js';
import clean from './src/commands/clean.js';
yargs(process.argv.slice(2))
.command({
command: 'build',
desc: 'Build the contracts',
help: true,
builder: (y) => {
y.version(false);
},
handler: () => exec('scarb build').stdout.on('data', (data) => console.log(data))
})
.command({
command: 'console',
desc: 'Open the console',
help: true,
builder: (y) => {
y.version(false);
y.option('network', { describe: 'Network config ', alias: 'n', demand: true });
y.option('account', { describe: 'Account to use', alias: 'a' })
},
handler: openConsole
})
.command({
command: 'deployAccount',
desc: 'Deploy a new account',
help: true,
builder: (y) => {
y.version(false);
y.option('network', { describe: 'Network config ', alias: 'n', demand: true });
y.option('account', { describe: 'Name of the account', alias: 'a', demand: true });
y.option('encrypted', { describe: 'Encrypt private key', boolean: true, alias: 'e' })
},
handler: deployAccount
})
.command({
command: 'encryptAccount',
desc: 'Encrypt an existing account',
help: true,
builder: (y) => {
y.version(false);
y.option('network', { describe: 'Network config ', alias: 'n', demand: true });
y.option('account', { describe: 'Name of the account', alias: 'a', demand: true });
},
handler: encryptAccount
})
.command({
command: 'clean',
desc: 'Clean the cache directory',
help: true,
builder: (y) => {
y.version(false);
y.option('network', { describe: 'Network config ', alias: 'n', demand: true });
},
handler: clean
})
.help()
.parse();