-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish npm lib with typescript (.d.ts) files (#170)
- Loading branch information
Showing
9 changed files
with
90 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Versions.KOTLIN_COMPILER | ||
|
||
plugins { | ||
kotlin("multiplatform") | ||
kotlin("jvm") apply false | ||
id("com.github.johnrengelman.shadow") apply false | ||
} | ||
|
||
group = "${Settings.GROUP_ID}.plugin.npm" | ||
version = Settings.version | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
kotlin { | ||
js(IR) { | ||
nodejs() | ||
generateTypeScriptDefinitions() | ||
binaries.library() | ||
compilations["main"].packageJson { | ||
customField("name", "@flock/wirespec") | ||
customField("bin", mapOf("wirespec" to "wirespec-bin.js")) | ||
} | ||
} | ||
|
||
sourceSets.all { | ||
languageSettings.apply { | ||
languageVersion = KOTLIN_COMPILER | ||
} | ||
} | ||
|
||
sourceSets { | ||
val commonMain by getting { | ||
dependencies { | ||
implementation(project(":src:compiler:core")) | ||
implementation(project(":src:compiler:lib")) | ||
implementation(project(":src:plugin:cli")) | ||
} | ||
} | ||
val jsMain by getting { | ||
dependsOn(commonMain) | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/plugin/npm/src/jsMain/kotlin/community/flock/wirespec/plugin/npm/Main.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@file:OptIn(ExperimentalJsExport::class) | ||
|
||
package community.flock.wirespec.plugin.npm | ||
|
||
import community.flock.wirespec.compiler.core.Wirespec | ||
import community.flock.wirespec.compiler.core.parse.Parser | ||
import community.flock.wirespec.compiler.core.tokenize.tokenize | ||
import community.flock.wirespec.compiler.lib.produce | ||
import community.flock.wirespec.compiler.utils.noLogger | ||
import community.flock.wirespec.plugin.cli.main | ||
|
||
@JsExport | ||
fun cli(args: Array<String>) = main(args) | ||
|
||
@JsExport | ||
fun parse(source: String) = Wirespec | ||
.tokenize(source) | ||
.let { Parser(noLogger).parse(it).produce() } |
File renamed without changes.