-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
60 lines (50 loc) · 1.43 KB
/
build.gradle
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
plugins {
id "com.github.node-gradle.node" version "2.2.4"
}
apply plugin: 'base'
version '0.0.1'
node {
version = '14.3.0'
download = true
}
def sourceSet = fileTree(dir: '.', includes: [
'src/**',
'package.json',
'babel.config.js',
'tsconfig.json',
'vue.config.js',
'yarn.lock',
'node_modules/**'
])
task buildFrontend(type: YarnTask) {
setDescription "Build minified distribution files for the frontend code."
inputs.files sourceSet
outputs.dir 'dist'
args = ['build']
}
task lint(type: YarnTask) {
setDescription "Run eslint on the frontend code."
inputs.files sourceSet
args = ['run', 'lint']
}
task test(type: YarnTask) {
setDescription "Run frontend tests."
args = ['run', 'test:unit']
}
task serve(type: YarnTask) {
setDescription "Run a local frontend development server."
args = ['serve']
}
task generateClient(type: NpxTask) {
def swaggerConfigPath = "../server/build/resources/swagger.json"
setDescription "Generate Swagger API client from Swagger config at ${swaggerConfigPath}."
inputs.file(swaggerConfigPath)
outputs.file('src/api/SwaggerApi.ts')
command = 'swagger-typescript-api'
args = ['-p', swaggerConfigPath, "-o", "./src/api", "-n", "SwaggerApi.ts"]
}
tasks.assemble.dependsOn('lint', 'buildFrontend')
tasks.test.dependsOn('assemble')
tasks.lint.dependsOn('yarn_install', 'generateClient')
tasks.buildFrontend.dependsOn('yarn_install')
tasks.buildFrontend.mustRunAfter('lint')