-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
53 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 8 additions & 3 deletions
11
...ild/src/sbt-test/sbt-scalajs-esbuild/basic-node-project/src/main/scala/example/Main.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
package example | ||
|
||
import example.facade.Fs | ||
import example.facade.Lodash | ||
import example.facade.Os | ||
import example.facade.Path | ||
|
||
object Main { | ||
def main(args: Array[String]): Unit = { | ||
println(testString()) | ||
println(test()) | ||
} | ||
|
||
def testString(): String = { | ||
Lodash.toUpper("basic-node-project works!") | ||
def test(): String = { | ||
val file = Path.join(Fs.mkdtempSync(s"${Os.tmpdir()}${Path.sep}"), "test") | ||
Fs.writeFileSync(file, Lodash.toUpper("basic-node-project works!"), "utf8") | ||
Fs.readFileSync(file, "utf8") | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...rc/sbt-test/sbt-scalajs-esbuild/basic-node-project/src/main/scala/example/facade/Fs.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package example.facade | ||
|
||
import scala.scalajs.js | ||
import scala.scalajs.js.annotation.JSImport | ||
|
||
object Fs { | ||
@js.native | ||
@JSImport("node:fs", "mkdtempSync") | ||
def mkdtempSync(paths: String): String = js.native | ||
|
||
@js.native | ||
@JSImport("node:fs", "writeFileSync") | ||
def writeFileSync(file: String, data: String, encoding: String): Unit = js.native | ||
|
||
@js.native | ||
@JSImport("node:fs", "readFileSync") | ||
def readFileSync(path: String, encoding: String): String = js.native | ||
} |
10 changes: 10 additions & 0 deletions
10
...rc/sbt-test/sbt-scalajs-esbuild/basic-node-project/src/main/scala/example/facade/Os.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package example.facade | ||
|
||
import scala.scalajs.js | ||
import scala.scalajs.js.annotation.JSImport | ||
|
||
object Os { | ||
@js.native | ||
@JSImport("node:os", "tmpdir") | ||
def tmpdir(): String = js.native | ||
} |
14 changes: 14 additions & 0 deletions
14
.../sbt-test/sbt-scalajs-esbuild/basic-node-project/src/main/scala/example/facade/Path.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package example.facade | ||
|
||
import scala.scalajs.js | ||
import scala.scalajs.js.annotation.JSImport | ||
|
||
object Path { | ||
@js.native | ||
@JSImport("node:path", "join") | ||
def join(paths: String*): String = js.native | ||
|
||
@js.native | ||
@JSImport("node:path", "sep") | ||
val sep: String = js.native | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters