Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit cdd87ca

Browse files
authored
Merge pull request #244 from exoego/separate-projects
Separate projects (Node.js v14, v12 and v10)
2 parents 93dadf0 + 9284bc7 commit cdd87ca

File tree

232 files changed

+64
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+64
-13
lines changed

.github/workflows/format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- uses: actions/checkout@v1
1010
- uses: olafurpg/setup-scala@v5
1111
- name: Check Scalafmt/Scaladoc
12-
run: sbt ++2.13.2 scalafmtSbtCheck scalafmtCheck test:scalafmtCheck current/doc core/doc
12+
run: sbt ++2.13.2 scalafmtSbtCheck scalafmtCheck test:scalafmtCheck nodejs_v14/doc core/doc
1313
- name: Install NPM deps
1414
run: npm install
1515
- name: Check README

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v12.16.1
1+
v14.3.0

.travis.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,20 @@ jdk:
1010

1111
env:
1212
matrix:
13-
- TRAVIS_NODE_VERSION="12.16.3" SCALAJS_VERSION="0.6.33"
14-
- TRAVIS_NODE_VERSION="12.16.3" SCALAJS_VERSION=""
13+
- TRAVIS_NODE_VERSION="14.3.0" SCALAJS_VERSION="0.6.33"
14+
- TRAVIS_NODE_VERSION="14.3.0" SCALAJS_VERSION=""
1515

1616
script:
1717
- sbt ++$TRAVIS_SCALA_VERSION test
1818

1919
jobs:
2020
include:
21+
- name: "Node.12 Scala.js 0.6"
22+
env: TRAVIS_NODE_VERSION="12.16.3" SCALAJS_VERSION="0.6.33"
23+
script: sbt ++$TRAVIS_SCALA_VERSION nodejs_v12/test nodejs_v10/test
24+
- name: "Node.12 Scala.js 1.x"
25+
env: TRAVIS_NODE_VERSION="12.16.3" SCALAJS_VERSION=""
26+
script: sbt ++$TRAVIS_SCALA_VERSION nodejs_v12/test nodejs_v10/test
2127
- name: "Node.10 Scala.js 0.6"
2228
env: TRAVIS_NODE_VERSION="10.20.1" SCALAJS_VERSION="0.6.33"
2329
script: sbt ++$TRAVIS_SCALA_VERSION nodejs_v10/test

app/nodejs-v10/src/test/scala/io/scalajs/nodejs/TestEnvironment.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ object TestEnvironment {
99

1010
def isWindows: Boolean = os.OS.platform().startsWith("win")
1111

12+
def isExecutedInExactNode14: Boolean = nodeMajorVersion == 14
1213
def isExecutedInExactNode12: Boolean = nodeMajorVersion == 12
1314
def isExecutedInExactNode10: Boolean = nodeMajorVersion == 10
1415
def isExecutedInExactNode8: Boolean = nodeMajorVersion == 8
1516

17+
def isExecutedInNode14OrNewer: Boolean = nodeMajorVersion >= 14
1618
def isExecutedInNode12OrNewer: Boolean = nodeMajorVersion >= 12
1719
def isExecutedInNode10OrNewer: Boolean = nodeMajorVersion >= 10
1820
}

app/nodejs-v10/src/test/scala/io/scalajs/nodejs/console_module/ConsoleV8Test.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class ConsoleV8Test extends AnyFunSpec with BeforeAndAfterEach {
3131

3232
it("should support ignoreErrors") {
3333
assume(TestEnvironment.isExecutedInNode10OrNewer)
34+
// https://github.com/nodejs/node/issues/33628
35+
assume(TestEnvironment.isExecutedInNode14OrNewer === false)
3436
val strictConsole = new Console(
3537
stdout = failingWritable,
3638
stderr = failingWritable,

app/nodejs-v10/src/test/scala/io/scalajs/nodejs/fs/FsTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import org.scalatest.funspec.AsyncFunSpec
1313
class FsTest extends AsyncFunSpec {
1414
override implicit val executionContext = ExecutionContext.Implicits.global
1515

16-
final val testResources = "./app/current/src/test/resources/"
16+
final val testResources = "./app/nodejs-v12/src/test/resources/"
1717

1818
describe("Fs") {
1919
it("supports watching files") {

app/nodejs-v10/src/test/scala/io/scalajs/nodejs/process/ProcessTest.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class ProcessTest extends AnyFunSpec {
1010
if (TestEnvironment.isExecutedInExactNode8) "v8."
1111
else if (TestEnvironment.isExecutedInExactNode10) "v10."
1212
else if (TestEnvironment.isExecutedInExactNode12) "v12."
13+
else if (TestEnvironment.isExecutedInExactNode14) "v14."
1314
else "Unknown node.js version"
1415

1516
it("contains the following properties") {

app/current/src/main/scala/io/scalajs/nodejs/buffer/package.scala renamed to app/nodejs-v14/src/main/scala/io/scalajs/nodejs/buffer/package.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ package object buffer {
8585
@JSImport("buffer", JSImport.Namespace)
8686
private object BufferNamespace extends js.Object {
8787
val INSPECT_MAX_BYTES: Int = js.native
88-
val kMaxLength: Int = js.native
88+
val kMaxLength: Double = js.native
8989
def transcode(source: Uint8Array, fromEnc: String, toEnc: String): Buffer = js.native
9090
}
9191

@@ -99,7 +99,7 @@ package object buffer {
9999
* On 32-bit architectures, this value is `(2^30)-1` (~1GB).
100100
* On 64-bit architectures, this value is `(2^31)-1` (~2GB).
101101
*/
102-
val MAX_LENGTH: Int = js.native
102+
val MAX_LENGTH: Double = js.native
103103

104104
/**
105105
* The largest length allowed for a single `String` instance.

build.sbt

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
organization in ThisBuild := "net.exoego"
22

33
lazy val root = (project in file("."))
4-
.aggregate(core, current, nodejs_v10)
4+
.aggregate(core, nodejs_v14, nodejs_v12, nodejs_v10)
55
.settings(MySettings.commonSettings)
66
.settings(MySettings.publishingSettings)
77
.settings(MySettings.nonPublishingSetting)
@@ -19,15 +19,36 @@ lazy val core = (project in file("./core"))
1919
libraryDependencies ++= Dependencies.core.value
2020
)
2121

22-
lazy val current = (project in file("./app/current"))
22+
lazy val nodejs_v14 = (project in file("./app/nodejs-v14"))
2323
.enablePlugins(ScalaJSPlugin)
2424
.settings(MySettings.commonSettings)
2525
.settings(MySettings.commonScalaJsSettings)
2626
.settings(MySettings.commonMacroParadiseSetting)
2727
.settings(MySettings.publishingSettings)
2828
.settings(
2929
scalacOptions ++= Seq(
30-
"-Xmacro-settings:nodeJs12.5.0"
30+
"-Xmacro-settings:nodeJs14.3.0"
31+
),
32+
name := "scala-js-nodejs-v14",
33+
description := "NodeJS v14 API for Scala.js",
34+
libraryDependencies ++= Dependencies.app.value
35+
)
36+
.dependsOn(core)
37+
38+
lazy val nodejs_v12 = (project in file("./app/nodejs-v12"))
39+
.enablePlugins(ScalaJSPlugin)
40+
.settings(MySettings.commonSettings)
41+
.settings(MySettings.commonScalaJsSettings)
42+
.settings(MySettings.commonMacroParadiseSetting)
43+
.settings(MySettings.publishingSettings)
44+
.settings(
45+
unmanagedSourceDirectories in Compile ++= {
46+
val symlinkDir = baseDirectory.value / "src" / "main"
47+
val hasSymlink = symlinkDir.exists && symlinkDir.isDirectory
48+
Seq((baseDirectory in nodejs_v14).value / "src" / "main" / "scala").filter(_ => !hasSymlink)
49+
},
50+
scalacOptions ++= Seq(
51+
"-Xmacro-settings:nodeJs12.16.3"
3152
),
3253
name := "scala-js-nodejs-v12",
3354
description := "NodeJS v12 API for Scala.js",
@@ -45,13 +66,13 @@ lazy val nodejs_v10 = (project in file("./app/nodejs-v10"))
4566
unmanagedSourceDirectories in Compile ++= {
4667
val symlinkDir = baseDirectory.value / "src" / "main"
4768
val hasSymlink = symlinkDir.exists && symlinkDir.isDirectory
48-
Seq((baseDirectory in current).value / "src" / "main" / "scala").filter(_ => !hasSymlink)
69+
Seq((baseDirectory in nodejs_v14).value / "src" / "main" / "scala").filter(_ => !hasSymlink)
4970
},
5071
scalacOptions ++= Seq(
51-
"-Xmacro-settings:nodeJs10.16.0"
72+
"-Xmacro-settings:nodeJs10.20.1"
5273
),
5374
name := "scala-js-nodejs-v10",
54-
description := "NodeJS v10.16.0 API for Scala.js",
75+
description := "NodeJS v10 API for Scala.js",
5576
libraryDependencies ++= Dependencies.app.value
5677
)
5778
.dependsOn(core)

script/setup.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
SOURCE_DIR=$(pwd)/app/nodejs-v14/src/main
4+
5+
V12_DIR=$(pwd)/app/nodejs-v12/src/main
6+
if [ -e "$V12_DIR" ]; then
7+
echo "V12 dir already exists."
8+
else
9+
ln -s "$SOURCE_DIR" "$V12_DIR";
10+
echo "V12 dir created.";
11+
fi
12+
13+
V10_DIR=$(pwd)/app/nodejs-v10/src/main
14+
if [ -e "$V10_DIR" ]; then
15+
echo "V10 dir already exists."
16+
else
17+
ln -s "$SOURCE_DIR" "$V10_DIR";
18+
echo "V1 dir created.";
19+
fi

0 commit comments

Comments
 (0)