Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ScalaJS to simply redirect complication output to specified directory

By Scala.js' sbt fastOptJS, I would simply want to redirect myproject/target/scala-2.11/web-fastopt.js to myproject/js is that possible?

Same for web-jsdeps.js - to redirect it to /myproject/libs

I've read this Scala.js compilation destination

that seems too complicated. I have only one project, not two or three, there is no play framework, just plain file-to-folder copy.

UPDATE: My settings, project/BuildProject.scala:

 lazy val chromePluginProject = Project(id = "chromePlugin", base = file(".")).enablePlugins(ScalaJSPlugin).

settings(

 version      := "0.1",
 scalaVersion := Versions.scala,

 artifactPath in(Compile, fastOptJS) := baseDirectory.value / "plugin" / "src" / "content" / "fastOpt.js",


  ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }, // TODO:

 //mainClass := Some("branch.ScalaJsSample"),

 libraryDependencies ++= scalaJsDependencies,

 libraryDependencies += "be.doeraene" %%% "scalajs-jquery" % "0.9.0",
 libraryDependencies += "com.lihaoyi" %%% "upickle" % Versions.upickle,

 libraryDependencies += "com.lihaoyi" %%% "scalatags" % Versions.scalaTags,

 // we will not use use DOM directly so commenting it
 libraryDependencies += "org.scala-js" %%% "scalajs-dom" % Versions.dom,


 jsDependencies += "org.webjars" % "jquery" % Versions.jquery / "jquery.js",
 jsDependencies += "org.webjars.bower" % "webcomponents.js" % Versions.webcomponents / "webcomponents-lite.js",

  // After reloading and rerunning fastOptJS,
  // this will create scala-js-jsdeps.js
 skip in packageJSDependencies := false,

 // allows DOM be available from from console' run (so no "ReferenceError:  "window" is not defined." error would appear)
 jsDependencies += RuntimeDOM, // it will use PhantomJS, basically

 scalaJSUseRhino in Global := false //will use node.js to run the thing

)

My file structure is: <root>/plugin/src/content where I want to copy the fastOpt.js

As i said it creates in *-site-jsdeps.js in /target/scala-2.11/

like image 603
ses Avatar asked Sep 03 '25 02:09

ses


1 Answers

Yes, You can do it like this:

 artifactPath in(Compile, packageScalaJSLauncher) := baseDirectory.value / ".." / "jvm" / "webapp" / "js" / "launcher.js", 
 artifactPath in(Compile, fastOptJS) := baseDirectory.value / ".." / "jvm" / "webapp" / "js" / "fastOpt.js", 
artifactPath in(Compile, fullOptJS) := baseDirectory.value / ".." / "jvm" / "webapp" / "js" / "fullOpt.js", 
 artifactPath in(Compile, packageJSDependencies) := baseDirectory.value / ".." / "jvm" / "webapp" / "js" / "dependency.js" 

for more, you can refer to https://github.com/yuanqingfei/gdbscan-akka-d3js/blob/master/build.sbt

like image 156
yuanqingfei Avatar answered Sep 05 '25 13:09

yuanqingfei