-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.sbt
49 lines (44 loc) · 1.52 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
import scala.sys.process._
lazy val installDependencies = Def.task[Unit] {
val base = (ThisProject / baseDirectory).value
val log = (ThisProject / 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 = (ThisProject / baseDirectory).value
val log = (ThisProject / streams).value.log
val path = base.getCanonicalPath
s"code --extensionDevelopmentPath=$path" ! log
()
}
.dependsOn(installDependencies)
lazy val root = project
.in(file("."))
.settings(
scalaVersion := "2.13.11",
moduleName := "vscode-scaladex-search",
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) },
Compile / fastOptJS / artifactPath := baseDirectory.value / "out" / "extension.js",
Compile / fullOptJS / artifactPath := baseDirectory.value / "out" / "extension.js",
open := openVSCodeTask.dependsOn(Compile / fastOptJS).value,
// scalaJSUseMainModuleInitializer := true,
Compile / npmDependencies ++= Seq(
"@types/vscode" -> "1.73.0"
),
testFrameworks += new TestFramework("utest.runner.Framework")
// publishMarketplace := publishMarketplaceTask.dependsOn(fullOptJS in Compile).value
)
.enablePlugins(
ScalaJSPlugin,
ScalaJSBundlerPlugin,
ScalablyTypedConverterPlugin
)