-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbin.js
executable file
·147 lines (128 loc) · 4.18 KB
/
bin.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/usr/bin/env node
const fs = require('fs')
const program = require('commander')
const find = require('find-up')
const cheerio = require('cheerio')
const wrap =
(path) =>
(args = {}) => {
const cmd = require(path)
const getPackage = () => require(find.sync('package.json'))
const getPom = () =>
cheerio.load(
fs.readFileSync(find.sync(['.flattened-pom.xml', 'pom.xml']), {
encoding: 'utf8',
}),
{
xml: true,
decodeEntities: false,
}
)
cmd({ args, getPackage, getPom })
}
const pkg = require('./package.json')
program.version(pkg.version)
program.description(pkg.description)
program
.command('package')
.description('build a jar')
.action(wrap('./lib/package'))
program
.command('set-env [args...]')
.description('run args with `ACE_BUILD` environment variable set')
.action(wrap('./lib/set-env'))
program
.command('clean')
.description('remove target directory')
.option('-w, --workspaces', 'only clean workspaces')
.action(wrap('./lib/clean'))
program
.command('test')
.description('run mocha tests in a headless browser')
.option(
'--url <location>',
'location to find tests (default: ./target/test/index.html)'
)
.option('-w, --width <number>', 'browser window width (default: 1280)')
.option('-h, --height <number>', 'browser window height (default: 800)')
.option('-v, --visible', 'browser visibility (default: false)')
.option(
'-t, --timeout <number>',
'test timeout in seconds (default: 900 seconds)'
)
.action(wrap('./lib/test'))
program
.command('format')
.description('run formatter')
.option('-m, --modified', 'only run against modified code')
.option('-w, --write', 'fix errors that are found')
.option('-l, --license <path-to-license-file>', 'path to license file')
.action(wrap('./lib/format'))
program
.command('pom')
.description('verify/fix the root pom')
.option('-f, --fix', 'sync pom with packages')
.action(wrap('./lib/pom'))
program
.command('gen-feature')
.description('generate a feature file')
.option(
'-e, --extend [<feature-file>]',
'extend an existing feature file',
(val) => val.split(',')
)
.option('-x, --exclude [projects]', 'exclude existing wabs', (val) =>
val.split(',')
)
.action(wrap('./lib/gen-feature'))
program
.command('bundle')
.description('bundle webapp')
.option(
'--tsTranspileOnly <tsTranspileOnly>',
'only transpile typescript (default is false)'
)
.option('-e, --env <env>', 'build environment <development|test|production>')
.action(wrap('./lib/bundle'))
program
.command('start')
.description('start the dev server')
.option('-N, --no-open', 'do not open default browser')
.option(
'--tsTranspileOnly <tsTranspileOnly>',
'only transpile typescript (default is false)'
)
.option(
'-a, --auth <auth>',
'auth <username:password> (default: admin:admin)'
)
.option('-e, --env <env>', 'build environment <development|test|production>')
.option(
'--proxy <target>',
'set proxy target (default: https://localhost:8993)'
)
.option('--main <script>', 'the javascript entry file')
.option('--contextPath <path>', 'context path to start server on')
.option('--port <port>', 'dev server port (default: 8080)')
.option('--host <host>', 'dev server host (default: localhost)')
.action(wrap('./lib/start'))
program
.command('storybook')
.description('start the storybook server')
.option('--port <port>', 'dev server port (default: 8080)')
.option('--host <host>', 'dev server host (default: localhost)')
.option('--static', 'Build static version of storybook.')
.option('--root <path>', 'Root directory to search for stories.')
.action(wrap('./lib/storybook'))
program
.command('disable-idp')
.description('disable idp authentication in running ddf instance')
.option(
'-a, --auth <auth>',
'auth <username:password> (default: admin:admin)'
)
.option('--port <port>', 'ddf server port (default: 8993)')
.option('--host <host>', 'ddf server host (default: localhost)')
.option('--whitelist <context-path>', 'adds a context path to the whitelist')
.action(wrap('./lib/disable-idp'))
program.parse(process.argv)