diff --git a/.gitignore b/.gitignore
index aeea8ed..80d6a65 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ target/
.settings/
.idea
.idea_modules
+.vscode
\ No newline at end of file
diff --git a/build.sbt b/build.sbt
index 18afff1..0403177 100644
--- a/build.sbt
+++ b/build.sbt
@@ -2,18 +2,21 @@ import sbt.Keys._
val defaultSettings = Seq(
scalacOptions ++= Seq("-feature", "-deprecation"),
- unmanagedSourceDirectories in Compile += baseDirectory.value / "shared" / "main" / "scala",
+ unmanagedSourceDirectories in Compile += baseDirectory.value / "shared" / "main" / "scala",
unmanagedSourceDirectories in Test += baseDirectory.value / "shared" / "test" / "scala"
)
-lazy val root = project.in(file(".")).settings(defaultSettings:_*).settings(
+lazy val root = project.in(file(".")).settings(defaultSettings: _*).settings(
name := "workbench",
- version := "0.4.1",
- organization := "com.lihaoyi",
- scalaVersion := "2.12.4",
+ version := "0.4.4",
+ organization := "com.sa",
+ scalaVersion := "2.12.12",
sbtPlugin := true,
publishArtifact in Test := false,
- publishTo := Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"),
+ publishTo := Some("releases" at "https://nexus.s-art.co.nz/repository/maven-releases"),
+ // publishTo := Some("Nexus" at "http://nexus.financialplatforms.co.nz:8081/nexus/content/repositories/releases"),
+ credentials += Credentials(Path.userHome / ".ivy2" / ".credentials.sa"),
+ credentials += Credentials(Path.userHome / ".ivy2" / ".credentials.fp"),
pomExtra :=
https://github.com/lihaoyi/workbench
@@ -35,13 +38,14 @@ lazy val root = project.in(file(".")).settings(defaultSettings:_*).settings(
,
(resources in Compile) += {
- (fullOptJS in (client, Compile)).value
- (artifactPath in (client, Compile, fullOptJS)).value
+ (fullOptJS in(client, Compile)).value
+ (artifactPath in(client, Compile, fullOptJS)).value
},
- addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.21"),
+ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.1.1"),
libraryDependencies ++= Seq(
Dependencies.akkaHttp,
Dependencies.akka,
+ Dependencies.akkaStream,
Dependencies.autowire.value,
Dependencies.upickle.value
)
@@ -57,5 +61,5 @@ lazy val client = project.in(file("client"))
Dependencies.dom.value,
Dependencies.upickle.value
),
- emitSourceMaps := false
+ scalaJSLinkerConfig ~= { _.withSourceMap(false) }
)
diff --git a/client/src/main/scala/workbench/WorkbenchClient.scala b/client/src/main/scala/com/lihaoyi/workbench/WorkbenchClient.scala
similarity index 75%
rename from client/src/main/scala/workbench/WorkbenchClient.scala
rename to client/src/main/scala/com/lihaoyi/workbench/WorkbenchClient.scala
index 4336854..35da69a 100644
--- a/client/src/main/scala/workbench/WorkbenchClient.scala
+++ b/client/src/main/scala/com/lihaoyi/workbench/WorkbenchClient.scala
@@ -1,37 +1,38 @@
package com.lihaoyi.workbench
-import upickle.Js
-import upickle.default
-import upickle.default.{Reader, Writer}
-import upickle.json
import org.scalajs.dom
import org.scalajs.dom.ext._
+import org.scalajs.dom.raw._
+import ujson.Value.Value
+import upickle.default
+import upickle.default.{Reader, Writer}
+import scala.collection.mutable.ArrayBuffer
+import scala.scalajs.concurrent.JSExecutionContext.Implicits.queue
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel}
-import scalajs.concurrent.JSExecutionContext.Implicits.queue
-import org.scalajs.dom.raw._
/**
* The connection from workbench server to the client
*/
-object Wire extends autowire.Server[Js.Value, Reader, Writer] with ReadWrite {
- def wire(parsed: Js.Arr): Unit = {
- val Js.Arr(path, args: Js.Obj) = parsed
- val req = new Request(default.readJs[Seq[String]](path), args.value.toMap)
- Wire.route[Api](WorkbenchClient).apply(req)
+object Wire extends autowire.Server[ujson.Value, Reader, Writer] with ReadWrite {
+ def wire(parsed: ArrayBuffer[Value]): Unit = {
+ val jsObj = parsed.drop(1).head.obj.toMap
+ val req = new Request(default.read[Seq[String]](parsed.head), jsObj)
+ Wire.route[WorkbenchApi](WorkbenchClient).apply(req)
}
}
@JSExportTopLevel("WorkbenchClient")
-object WorkbenchClient extends Api {
+object WorkbenchClient extends WorkbenchApi {
@JSExport
- lazy val shadowBody = dom.document.body.cloneNode(deep = true)
+ lazy val shadowBody: Node = dom.document.body.cloneNode(deep = true)
@JSExport
var interval = 1000
@JSExport
var success = false
+
@JSExport
def main(host: String, port: Int): Unit = {
def rec(): Unit = {
@@ -40,10 +41,10 @@ object WorkbenchClient extends Api {
if (!success) println("Workbench connected")
success = true
interval = 1000
- json.read(data.responseText)
- .asInstanceOf[Js.Arr]
- .value
- .foreach(v => Wire.wire(v.asInstanceOf[Js.Arr]))
+ ujson
+ .read(data.responseText)
+ .arr
+ .foreach(v => Wire.wire(v.arr))
rec()
case util.Failure(e) =>
if (success) println("Workbench disconnected " + e)
diff --git a/example/build.sbt b/example/build.sbt
index 04678aa..e51cda4 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -8,7 +8,7 @@ enablePlugins(WorkbenchPlugin)
name := "Example"
-scalaVersion := "2.12.3"
+scalaVersion := "2.12.6"
version := "0.1-SNAPSHOT"
diff --git a/example/project/build.sbt b/example/project/build.sbt
index f354c57..2b52827 100644
--- a/example/project/build.sbt
+++ b/example/project/build.sbt
@@ -1,4 +1,4 @@
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.19")
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.24")
lazy val workbench = RootProject(file("../.."))
lazy val root = project.in(file(".")).dependsOn(workbench)
diff --git a/example/src/main/resources/index-dev.html b/example/src/main/resources/index-dev.html
index 6f27812..27cc779 100644
--- a/example/src/main/resources/index-dev.html
+++ b/example/src/main/resources/index-dev.html
@@ -14,7 +14,7 @@