diff options
Diffstat (limited to 'plugins/base/frontend')
-rw-r--r-- | plugins/base/frontend/build.gradle.kts | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/plugins/base/frontend/build.gradle.kts b/plugins/base/frontend/build.gradle.kts index cadf3fae..2d8bbb7f 100644 --- a/plugins/base/frontend/build.gradle.kts +++ b/plugins/base/frontend/build.gradle.kts @@ -1,6 +1,10 @@ +import com.github.gradle.node.npm.task.NpmTask +import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs + +@Suppress("DSL_SCOPE_VIOLATION") // fixed in Gradle 8.1 https://github.com/gradle/gradle/pull/23639 plugins { - base - id("com.github.node-gradle.node") version "3.2.1" + id("org.jetbrains.conventions.dokka-html-frontend-files") + alias(libs.plugins.gradleNode) } node { @@ -11,19 +15,34 @@ node { distBaseUrl.set(null as String?) // Strange cast to avoid overload ambiguity } -val npmRunBuild = tasks.getByName("npm_run_build") { - inputs.dir(file("src/main")) - inputs.files(file("package.json"), file("webpack.config.js")) - outputs.dir(file("dist/")) +val distributionDirectory = layout.projectDirectory.dir("dist") + +val npmRunBuild by tasks.registering(NpmTask::class) { + dependsOn(tasks.npmInstall) + + npmCommand.set(parseSpaceSeparatedArgs("run build")) + + inputs.dir("src/main") + inputs.files( + "package.json", + "webpack.config.js", + ) + + outputs.dir(distributionDirectory) outputs.cacheIf { true } } -task("generateFrontendFiles") { - dependsOn(npmRunBuild) +configurations.dokkaHtmlFrontendFilesElements.configure { + outgoing { + artifact(distributionDirectory) { + builtBy(npmRunBuild) + } + } } -tasks { - clean { - delete(file("node_modules"), file("dist")) - } +tasks.clean { + delete( + file("node_modules"), + file("dist"), + ) } |