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
|
||||
|
||||
dependsOn(typescriptEventsSchema)
|
||||
dependsOn(fixLink)
|
||||
|
||||
val outputDir = layout.projectDirectory.dir("src/main/typescript/generated/kafkatorio-schema")
|
||||
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 {
|
||||
// group = project.name
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
],
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"explainFiles": true,
|
||||
"explainFiles": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"listEmittedFiles": true,
|
||||
"listFiles": true,
|
||||
|
|
@ -39,6 +39,7 @@
|
|||
"tstlVerbose": true,
|
||||
"noHeader": true,
|
||||
"noImplicitSelf": true,
|
||||
"sourceMapTraceback": false,
|
||||
"luaLibImport": "require"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue