mirror of
https://github.com/phfroidmont/scalive.git
synced 2025-12-25 13:36:59 +01:00
Configure basic js module
This commit is contained in:
parent
385436f8fe
commit
73510857a6
3 changed files with 36 additions and 7 deletions
28
build.mill
28
build.mill
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
package build
|
package build
|
||||||
|
|
||||||
import mill.*, scalalib.*
|
import mill.*, scalalib.*, javascriptlib.*
|
||||||
import mill.api.Task.Simple
|
import mill.api.Task.Simple
|
||||||
|
|
||||||
trait Common extends ScalaModule:
|
trait ScalaCommon extends ScalaModule:
|
||||||
def scalaVersion = "3.7.2"
|
def scalaVersion = "3.7.2"
|
||||||
def scalacOptions = Seq(
|
def scalacOptions = Seq(
|
||||||
"-Wunused:all",
|
"-Wunused:all",
|
||||||
|
|
@ -15,7 +15,12 @@ trait Common extends ScalaModule:
|
||||||
"-Wvalue-discard"
|
"-Wvalue-discard"
|
||||||
)
|
)
|
||||||
|
|
||||||
object core extends Common:
|
object js extends TypeScriptModule:
|
||||||
|
def npmDeps = Seq("morphdom@2.7.7")
|
||||||
|
def mainFileName = "index.ts"
|
||||||
|
|
||||||
|
object core extends ScalaCommon:
|
||||||
|
// Replace with ujson, core shouldn't depend on ZIO
|
||||||
def mvnDeps = Seq(mvn"dev.zio::zio-json:0.7.44")
|
def mvnDeps = Seq(mvn"dev.zio::zio-json:0.7.44")
|
||||||
|
|
||||||
def generatedSources = Task {
|
def generatedSources = Task {
|
||||||
|
|
@ -23,9 +28,22 @@ object core extends Common:
|
||||||
super.generatedSources() ++ Seq(PathRef(Task.dest))
|
super.generatedSources() ++ Seq(PathRef(Task.dest))
|
||||||
}
|
}
|
||||||
|
|
||||||
object test extends ScalaTests with TestModule.Utest:
|
def jsBundle = Task {
|
||||||
|
val bundleDest = Task.dest / "static" / "scalive.js"
|
||||||
|
os.copy(
|
||||||
|
from = js.bundle().path,
|
||||||
|
to = bundleDest
|
||||||
|
)
|
||||||
|
PathRef(Task.dest)
|
||||||
|
}
|
||||||
|
|
||||||
|
def resources = Task {
|
||||||
|
super.resources() ++ Seq(jsBundle())
|
||||||
|
}
|
||||||
|
|
||||||
|
object test extends ScalaTests with scalalib.TestModule.Utest:
|
||||||
def utestVersion = "0.9.0"
|
def utestVersion = "0.9.0"
|
||||||
|
|
||||||
object zio extends Common:
|
object zio extends ScalaCommon:
|
||||||
def mvnDeps = Seq(mvn"dev.zio::zio-http:3.4.0")
|
def mvnDeps = Seq(mvn"dev.zio::zio-http:3.4.0")
|
||||||
override def moduleDeps = Seq(core)
|
override def moduleDeps = Seq(core)
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
mill = pkgs.mill.overrideAttrs (old: rec {
|
mill = pkgs.mill.overrideAttrs (old: rec {
|
||||||
version = "1.0.2";
|
version = "1.0.3";
|
||||||
src = pkgs.fetchurl {
|
src = pkgs.fetchurl {
|
||||||
url = "https://repo1.maven.org/maven2/com/lihaoyi/mill-dist-native-linux-amd64/${version}/mill-dist-native-linux-amd64-${version}.exe";
|
url = "https://repo1.maven.org/maven2/com/lihaoyi/mill-dist-native-linux-amd64/${version}/mill-dist-native-linux-amd64-${version}.exe";
|
||||||
hash = "sha256-+jRVJDxpH9DONuar+1CqB0Yl6thAuTn7dJYqOEsebGU=";
|
hash = "sha256-Q7Yc9MXnMmggyMeNq0nEoL1iNTGEbJpdwH2j8/JkJyI=";
|
||||||
};
|
};
|
||||||
buildInputs = [ pkgs.zlib ];
|
buildInputs = [ pkgs.zlib ];
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
|
|
|
||||||
11
js/src/index.ts
Normal file
11
js/src/index.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
import morphdom from 'morphdom';
|
||||||
|
|
||||||
|
var el1 = document.createElement('div');
|
||||||
|
el1.className = 'foo';
|
||||||
|
|
||||||
|
var el2 = document.createElement('div');
|
||||||
|
el2.className = 'bar';
|
||||||
|
|
||||||
|
morphdom(el1, el2);
|
||||||
|
|
||||||
|
console.log("ok");
|
||||||
Loading…
Add table
Add a link
Reference in a new issue