Generate DTS
Some checks failed
ScriptCraft/pipeline/head There was a failure building this commit

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') { stage('Build') {
steps { steps {
sh './gradlew build typedoc eslint' sh './gradlew build typedoc eslint typescriptDist'
} }
post { post {
success { success {

View File

@ -1,2 +1,3 @@
node_modules/ 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": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "latest", "@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest", "@typescript-eslint/parser": "latest",

View File

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

View File

@ -5,5 +5,6 @@
"excludeExternals": true, "excludeExternals": true,
"excludeNotExported": true, "excludeNotExported": true,
"excludePrivate": 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 typescriptRoot = 'src/main/ts'
def typescriptRootFile = new File(rootDir.absolutePath, typescriptRoot) 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 inputs.dir typescriptRootFile
outputs.dir typescriptOut outputs.dirs typescriptOut, dtsOut
doFirst {
project.delete {
delete typescriptOut
}
typescriptOut.mkdirs()
project.exec {
workingDir typescriptRootFile workingDir typescriptRootFile
executable 'npm' executable 'npm'
args 'run', 'build', '--' args 'run', 'build'
args '--outDir', typescriptOut.absolutePath
doFirst {
project.delete {
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 workingDir typescriptRootFile
executable 'npm' executable 'npm'
@ -34,25 +46,21 @@ task eslint(group: 'verification', type: Exec) {
processResources.dependsOn typescript 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 inputs.dir typescriptRootFile
outputs.dir typedocOut outputs.dir typedocOut
doFirst {
project.delete {
delete typedocOut
}
typedocOut.mkdirs()
project.exec {
workingDir typescriptRootFile workingDir typescriptRootFile
executable 'npm' executable 'npm'
args 'run', 'typedoc', '--' args 'run', 'typedoc'
args '--out', typedocOut.absolutePath
doFirst {
project.delete {
delete typedocOut
} }
} }
} }