-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
87 lines (64 loc) · 1.89 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
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
plugins {
id 'base'
id 'com.github.node-gradle.node' version '3.0.1'
}
node {
// Whether to download and install a specific Node.js version or not
// If false, it will use the globally installed Node.js
// If true, it will download node using above parameters
// Note that npm is bundled with Node.js
download = true
// Version of node to download and install (only used if download is true)
// It will be unpacked in the workDir
version = '16.15.0'
// Version of Yarn to use
// Any Yarn task first installs Yarn in the yarnWorkDir
// It uses the specified version if defined and the latest version otherwise (by default)
yarnVersion = '1.22.10'
}
yarn_install {
// Specify the inputs and outputs for incremental build.
// Save build time when the inputs and outputs are up-to-date.
inputs.files('package.json', 'yarn.lock')
outputs.dir('node_modules')
}
// -------- Build related tasks ----------
task rollup(type: YarnTask) {
description 'Bundle all .js files'
group 'Build'
dependsOn 'yarn_install'
args = ['rollup']
}
clean {
delete 'node_modules', '.nyc_output'
}
build.dependsOn 'rollup'
// -------- Test related tasks ----------
task lint(type: YarnTask) {
description 'Eslint all .js files'
group 'Test'
inputs.files('src/**/*.js', 'test/**/*.js')
outputs.dir("$buildDir/lint-report")
dependsOn 'yarn_install'
args = ['lint']
}
task unit_test(type: YarnTask) {
description 'Run all unit tests'
group 'Test'
inputs.dir('src')
inputs.dir('test')
outputs.dirs("$buildDir/lint-report", "$buildDir/lint-report")
dependsOn 'yarn_install'
args = ['test']
}
task test {
description 'Run eslint linter and mocha unit tests'
group 'Test'
dependsOn 'lint', 'unit_test'
}
// -------- Release related tasks ----------
task release(type: NpxTask) {
description 'Release to NPM and GitHub'
group 'Release'
command = 'semantic-release'
}