TheBrokenRail
37f11a92f0
All checks were successful
ScriptCraft/pipeline/head This commit looks good
93 lines
1.7 KiB
Groovy
93 lines
1.7 KiB
Groovy
def typescriptRoot = 'src/main/ts'
|
|
def typescriptRootFile = new File(rootDir.absolutePath, typescriptRoot)
|
|
|
|
def nodeModules = new File(typescriptRootFile, 'node_modules')
|
|
|
|
task npmInstall(group: 'typescript', type: Exec) {
|
|
inputs.file new File(typescriptRootFile, 'package.json')
|
|
outputs.dir nodeModules
|
|
|
|
workingDir typescriptRootFile
|
|
|
|
executable 'npm'
|
|
|
|
args 'install'
|
|
}
|
|
|
|
def typescriptOut = new File(typescriptRootFile, 'build/ts')
|
|
def dtsOut = new File(typescriptRootFile, 'build/dts')
|
|
|
|
task typescript(group: 'typescript', type: Exec) {
|
|
inputs.dir typescriptRootFile
|
|
outputs.dirs typescriptOut, dtsOut
|
|
|
|
workingDir typescriptRootFile
|
|
|
|
executable 'npm'
|
|
|
|
args 'run', 'build'
|
|
|
|
doFirst {
|
|
project.delete {
|
|
delete typescriptOut, dtsOut
|
|
}
|
|
}
|
|
}
|
|
|
|
typescript.dependsOn npmInstall
|
|
|
|
task apiJar(group: 'typescript', type: Jar) {
|
|
into('/types') {
|
|
from new File(typescriptRootFile as File, 'types')
|
|
}
|
|
into('/src') {
|
|
from dtsOut
|
|
}
|
|
|
|
classifier 'api'
|
|
}
|
|
|
|
apiJar.dependsOn typescript
|
|
|
|
artifacts {
|
|
archives apiJar
|
|
}
|
|
|
|
task eslint(group: 'typescript', type: Exec) {
|
|
workingDir typescriptRootFile
|
|
|
|
executable 'npm'
|
|
|
|
args 'run', 'eslint'
|
|
}
|
|
|
|
eslint.dependsOn npmInstall
|
|
|
|
processResources.dependsOn typescript
|
|
|
|
def typedocOut = new File(typescriptRootFile, 'build/typedoc')
|
|
|
|
task typedoc(group: 'typescript', type: Exec) {
|
|
inputs.dir typescriptRootFile
|
|
outputs.dir typedocOut
|
|
|
|
workingDir typescriptRootFile
|
|
|
|
executable 'npm'
|
|
|
|
args 'run', 'typedoc'
|
|
|
|
doFirst {
|
|
project.delete {
|
|
delete typedocOut
|
|
}
|
|
}
|
|
}
|
|
|
|
typedoc.dependsOn npmInstall
|
|
|
|
processResources {
|
|
from(typescriptOut.absolutePath) {
|
|
into 'scriptcraft'
|
|
}
|
|
} |