Skip to content

Commit c0cada5

Browse files
committed
chore: nodejs plugin fix
1 parent cb93b08 commit c0cada5

File tree

3 files changed

+32
-35
lines changed

3 files changed

+32
-35
lines changed

gradle/build-logic/src/main/kotlin/dev.suresh.plugin.kotlin.mpp.gradle.kts

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,25 @@ tasks {
178178
}
179179
}
180180

181+
var npmEnabled: String? by rootProject.extra
182+
183+
plugins.withType<NodeJsPlugin> {
184+
the<NodeJsEnvSpec>().apply {
185+
download = true
186+
// version = libs.versions.nodejs.version.get()
187+
// downloadBaseUrl = "https://nodejs.org/download/nightly"
188+
}
189+
190+
if (!npmEnabled.toBoolean()) {
191+
rootProject.the<NpmExtension>().apply {
192+
lockFileDirectory = project.rootDir.resolve("gradle/kotlin-js-store")
193+
packageLockMismatchReport = LockFileMismatchReport.WARNING
194+
packageLockAutoReplace = false
195+
}
196+
npmEnabled = "true"
197+
}
198+
}
199+
181200
// Expose shared js/wasm resource as configuration to be consumed by other projects.
182201
// https://docs.gradle.org/current/userguide/cross_project_publications.html#sec:simple-sharing-artifacts-between-projects
183202
artifacts {
@@ -194,28 +213,6 @@ artifacts {
194213
}
195214
}
196215

197-
// Ideally, NodeJsPlugin should be applied to the root project,
198-
// but this is a hack to apply from the kotlin.mpp convention plugin.
199-
var nodeJsEnabled: String? by rootProject.extra
200-
201-
if (nodeJsEnabled.toBoolean().not()) {
202-
rootProject.plugins.withType<NodeJsPlugin> {
203-
rootProject.the<NodeJsEnvSpec>().apply {
204-
download = true
205-
nodeJsEnabled = "true"
206-
// version = libs.versions.nodejs.version.get()
207-
// downloadBaseUrl = "https://nodejs.org/download/nightly"
208-
}
209-
210-
rootProject.the<NpmExtension>().apply {
211-
lockFileDirectory = project.rootDir.resolve("gradle/kotlin-js-store")
212-
packageLockMismatchReport = LockFileMismatchReport.WARNING
213-
packageLockAutoReplace = false
214-
nodeJsEnabled = "true"
215-
}
216-
}
217-
}
218-
219216
dependencies {
220217
// add("kspJvm", project(":ksp-processor"))
221218
}

gradle/kotlin-js-store/package-lock.json

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ kotlinx-metadata = "0.9.0"
3636
kotlinx-reflect-lite = "1.1.0"
3737
kotlinx-bcv = "0.16.3"
3838
kotlin-dokka = "2.0.0-Beta"
39-
kotlin-wrappers = "1.0.0-pre.840"
39+
kotlin-wrappers = "1.0.0-pre.841"
4040
kotlin-redacted = "1.11.0"
4141
kotlinx-multik = "0.2.3"
4242
kotlinx-dataframe = "0.13.1"

0 commit comments

Comments
 (0)