-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
57 lines (51 loc) · 1.6 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import scala.sys.process.*
import org.scalajs.linker.interface.{ModuleKind, ModuleInitializer, ModuleSplitStyle}
val scala3Version = "3.3.3"
lazy val installDependencies = Def.task[Unit] {
val base = baseDirectory.value
val log = streams.value.log
if (!(base / "node_module").exists) {
val pb =
new java.lang.ProcessBuilder("npm", "install")
.directory(base)
.redirectErrorStream(true)
pb ! log
}
}
lazy val open = taskKey[Unit]("open vscode")
def openVSCodeTask: Def.Initialize[Task[Unit]] =
Def
.task[Unit] {
val base = baseDirectory.value
val log = streams.value.log
val path = base.getCanonicalPath
s"code --extensionDevelopmentPath=$path" ! log
()
}
.dependsOn(installDependencies)
lazy val root = project
.in(file("."))
.enablePlugins(
ScalaJSPlugin,
ScalablyTypedConverterPlugin,
ScalaJSBundlerPlugin
)
.settings(
scalaVersion := scala3Version,
moduleName := "vscode-scalajs-hello",
libraryDependencies ++= Seq(
"org.scala-js" %%% "scala-js-macrotask-executor" % "1.1.1"
),
scalaJSLinkerConfig ~= {
_.withModuleKind(ModuleKind.CommonJSModule)
},
Compile / fastOptJS / artifactPath := baseDirectory.value / "out" / "extension.js",
Compile / fullOptJS / artifactPath := baseDirectory.value / "out" / "extension.js",
Compile / npmDependencies ++= Seq(
"@types/vscode" -> "1.84.1",
"vscode-languageclient" -> "7.0.0",
"idris-ide-client" -> "0.1.6",
"@types/node" -> "14.17.2"
),
open := openVSCodeTask.dependsOn(Compile / fastOptJS).value
)