temp fix Type Factorio doc {@link https} bug
This commit is contained in:
parent
89b7c772ff
commit
867e22240b
2 changed files with 57 additions and 1 deletions
|
|
@ -69,6 +69,7 @@ val installEventsTsSchema by tasks.registering(Sync::class) {
|
||||||
group = project.name
|
group = project.name
|
||||||
|
|
||||||
dependsOn(typescriptEventsSchema)
|
dependsOn(typescriptEventsSchema)
|
||||||
|
dependsOn(fixLink)
|
||||||
|
|
||||||
val outputDir = layout.projectDirectory.dir("src/main/typescript/generated/kafkatorio-schema")
|
val outputDir = layout.projectDirectory.dir("src/main/typescript/generated/kafkatorio-schema")
|
||||||
outputs.dir(outputDir)
|
outputs.dir(outputDir)
|
||||||
|
|
@ -135,6 +136,60 @@ tasks.withType<Zip>().configureEach {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.npmInstall {
|
||||||
|
nodeModulesOutputFilter {
|
||||||
|
exclude("**/typed-factorio/generated/classes.d.ts")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ServiceProvider {
|
||||||
|
@get:Inject
|
||||||
|
val fs: FileSystemOperations
|
||||||
|
}
|
||||||
|
|
||||||
|
val fixLink by tasks.registering {
|
||||||
|
dependsOn(tasks.npmInstall)
|
||||||
|
|
||||||
|
|
||||||
|
val badLink = """{@link https://lua-api.factorio.com/latest/Data-Lifecycle.html Data Lifecycle}"""
|
||||||
|
val goodLink = """https://lua-api.factorio.com/latest/Data-Lifecycle.html"""
|
||||||
|
|
||||||
|
val typedFactorioDir =
|
||||||
|
layout.projectDirectory.dir("src/main/typescript/node_modules/typed-factorio")
|
||||||
|
val classesDTS = typedFactorioDir.file("generated/classes.d.ts")
|
||||||
|
|
||||||
|
val services = project.objects.newInstance<ServiceProvider>()
|
||||||
|
|
||||||
|
inputs.file(classesDTS)
|
||||||
|
outputs.file(classesDTS)
|
||||||
|
|
||||||
|
inputs.property("badLink", badLink)
|
||||||
|
inputs.property("goodLink", goodLink)
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
logger.lifecycle("fixing link ${classesDTS.asFile.canonicalPath}")
|
||||||
|
|
||||||
|
services.fs.sync {
|
||||||
|
from(classesDTS)
|
||||||
|
into(temporaryDir)
|
||||||
|
filter { line ->
|
||||||
|
when {
|
||||||
|
line.contains(badLink) -> line.replace(badLink, goodLink)
|
||||||
|
else -> line
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
services.fs.copy {
|
||||||
|
from(temporaryDir.resolve("classes.d.ts").canonicalPath)
|
||||||
|
into(classesDTS.asFile.parent)
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.WARN
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.assemble { dependsOn(fixLink) }
|
||||||
|
|
||||||
|
|
||||||
//val downloadFactorioApiDocs by tasks.registering {
|
//val downloadFactorioApiDocs by tasks.registering {
|
||||||
// group = project.name
|
// group = project.name
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
],
|
],
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"explainFiles": true,
|
"explainFiles": false,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"listEmittedFiles": true,
|
"listEmittedFiles": true,
|
||||||
"listFiles": true,
|
"listFiles": true,
|
||||||
|
|
@ -39,6 +39,7 @@
|
||||||
"tstlVerbose": true,
|
"tstlVerbose": true,
|
||||||
"noHeader": true,
|
"noHeader": true,
|
||||||
"noImplicitSelf": true,
|
"noImplicitSelf": true,
|
||||||
|
"sourceMapTraceback": false,
|
||||||
"luaLibImport": "require"
|
"luaLibImport": "require"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue