-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue-build.gradle
48 lines (37 loc) · 1.1 KB
/
vue-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
ext.spaBuildDir = "$buildDir/spa"
task runNpmBuild(type: NpmTask, group: 'build') {
inputs.file 'package.json'
inputs.file 'package-lock.json'
inputs.dir 'src'
outputs.dir(file("$spaBuildDir"))
outputs.cacheIf { true }
def npmCommand = System.env.CI ?
'ci:build' :
'dev:build'
args = ['run', npmCommand]
}
assemble.dependsOn runNpmBuild
task runNpmTest(type: NpmTask, group: 'test') {
inputs.file 'package.json'
inputs.file 'package-lock.json'
if(file("config").isDirectory()) {
inputs.dir "config"
}
inputs.dir 'src'
def npmCommand = System.env.CI ?
'ci:test' :
'dev:test'
args = ['run', 'ci:test:unit']
}
check.dependsOn runNpmTest
//can package spa contents into a zip
task packageSpa(type: Zip, group: 'build') {
dependsOn runNpmBuild
inputs.dir file(spaBuildDir)
version = project.version
from file(spaBuildDir)
include '**/*.js', '**/*.css', '**/*.map', '**/*.png', '**/*.jpg'
}
artifacts {
archives file: file(spaBuildDir), name: "${project.name}", type: 'directory', builtBy: runNpmBuild
}