Skip to content

Commit

Permalink
feat: support nodejs compile target
Browse files Browse the repository at this point in the history
  • Loading branch information
brizzbuzz committed Jan 21, 2022
1 parent 16a7f69 commit d987012
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.6.0] - January 20th, 2022
### Added
- Support for NodeJS target

## [0.5.6] - January 16th, 2022
### Changed
- Bumped Kover to RC2, adjusted accordingly
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Project
project.version=0.5.6
project.version=0.6.0

# Kotlin
kotlin.code.style=official
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.bkbn.sourdough.gradle.library.mpp

enum class JsTarget {
BROWSER,
NODE_JS
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ abstract class LibraryMppExtension {
abstract val developerId: Property<String>
abstract val developerName: Property<String>
abstract val developerEmail: Property<String>
abstract val jsTarget: Property<JsTarget>

init {
jsTarget.convention(JsTarget.NODE_JS)
jvmTarget.convention("11")
nodeJsVersion.convention("16.0.0")
compilerArgs.convention(emptyList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,19 @@ class LibraryMppPlugin : Plugin<Project> {
}
}
it.js(KotlinJsCompilerType.IR) {
browser {
commonWebpackConfig {
cssSupport.enabled = true
}
testTask {
useKarma {
useChromeCanaryHeadless()
when (ext.jsTarget.get()) {
JsTarget.BROWSER -> browser {
commonWebpackConfig {
cssSupport.enabled = true
}
testTask {
useKarma {
useChromeCanaryHeadless()
}
}
}
JsTarget.NODE_JS -> nodejs {}
else -> error("This shouldn't be possible, just making compiler happy")
}
}
val hostOs = System.getProperty("os.name")
Expand Down

0 comments on commit d987012

Please sign in to comment.