Generate DTS
ScriptCraft/pipeline/head There was a failure building this commit Details

This commit is contained in:
TheBrokenRail 2020-04-28 21:13:08 -04:00
parent 5decd39cdc
commit 7ffcc55da5
7 changed files with 47 additions and 33 deletions

2
Jenkinsfile vendored
View File

@ -10,7 +10,7 @@ pipeline {
}
stage('Build') {
steps {
sh './gradlew build typedoc eslint'
sh './gradlew build typedoc eslint typescriptDist'
}
post {
success {

View File

@ -1,2 +1,3 @@
node_modules/
package-lock.json
package-lock.json
lib/

View File

@ -1,5 +1,6 @@
{
"name": "scriptcraft",
"name": "minecraft",
"types": "lib/minecraft/index.d.ts",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest",

View File

@ -12,7 +12,10 @@
"baseUrl": "src",
"paths": {
"minecraft": ["minecraft/index"]
}
},
"outDir": "lib/ts",
"declaration": true,
"declarationDir": "lib/dts"
},
"include": [
"src/**/*.ts"

View File

@ -5,5 +5,6 @@
"excludeExternals": true,
"excludeNotExported": true,
"excludePrivate": true,
"stripInternal": true
"stripInternal": true,
"out": "lib/typedoc"
}

View File

@ -1,30 +1,42 @@
def typescriptOut = new File(buildDir, 'generated/typescript')
def typescriptRoot = 'src/main/ts'
def typescriptRootFile = new File(rootDir.absolutePath, typescriptRoot)
task typescript(group: 'build') {
def typescriptOut = new File(typescriptRootFile, 'lib/ts')
def dtsOut = new File(typescriptRootFile, 'lib/dts')
task typescript(group: 'typescript', type: Exec) {
inputs.dir typescriptRootFile
outputs.dir typescriptOut
outputs.dirs typescriptOut, dtsOut
workingDir typescriptRootFile
executable 'npm'
args 'run', 'build'
doFirst {
project.delete {
delete typescriptOut
}
typescriptOut.mkdirs()
project.exec {
workingDir typescriptRootFile
executable 'npm'
args 'run', 'build', '--'
args '--outDir', typescriptOut.absolutePath
delete typescriptOut, dtsOut
}
}
}
task eslint(group: 'verification', type: Exec) {
task typescriptDist(group: 'typescript', type: Tar) {
into('/types') {
from new File(typescriptRootFile as File, 'src/types')
}
into('/lib') {
from dtsOut
}
archiveName 'typescript-dist.tar.gz'
destinationDir new File(buildDir, 'libs')
compression Compression.GZIP
}
typescriptDist.dependsOn typescript
task eslint(group: 'typescript', type: Exec) {
workingDir typescriptRootFile
executable 'npm'
@ -34,26 +46,22 @@ task eslint(group: 'verification', type: Exec) {
processResources.dependsOn typescript
def typedocOut = new File(buildDir, 'typedoc')
def typedocOut = new File(typescriptRootFile, 'lib/typedoc')
task typedoc(group: 'documentation') {
task typedoc(group: 'typescript', type: Exec) {
inputs.dir typescriptRootFile
outputs.dir typedocOut
workingDir typescriptRootFile
executable 'npm'
args 'run', 'typedoc'
doFirst {
project.delete {
delete typedocOut
}
typedocOut.mkdirs()
project.exec {
workingDir typescriptRootFile
executable 'npm'
args 'run', 'typedoc', '--'
args '--out', typedocOut.absolutePath
}
}
}