@@ -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
183202artifacts {
@@ -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-
219216dependencies {
220217 // add("kspJvm", project(":ksp-processor"))
221218}
0 commit comments