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

Publish for Scala 2.12 and 2.13 #9

Merged
merged 10 commits into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jvmopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-Xss4M
-Xmx2G
-XX:MaxMetaspaceSize=1G
-XX:+CMSClassUnloadingEnabled
81 changes: 44 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,60 @@
This is a complete Scala.js facade for Node.js for Scala 2.12 and 2.13.
A fork of https://github.com/scalajs-io/nodejs to sustain the project.

## Build Requirements

* [SBT 1.3.x] (http://www.scala-sbt.org/download.html)
* JDK 8 or JDK 11

## Features

The Node.js integration is nearly complete (feature for feature), and should be more than sufficient for most web-based
and CLI applications.

### Supported Modules
## How to use

The following core Node.js modules (v8.7.0) have been implemented:
Add below line to your SBT project.

| Node Module | Description |
|-----------------------|---------------------------------------------------------------------------------|
| assert | Provides a simple set of assertion tests that can be used to test invariants. |
| buffer | The Buffer class was introduced as part of the Node.js API to make it possible to interact with octet streams in the context of things like TCP streams and file system operations. |
| child_process | The child_process module provides the ability to spawn child processes. |
| cluster | The cluster module allows you to easily create child processes that all share server ports. |
| crypto | The crypto module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions.|
| dns | Support for DNS queries. |
| events | Node.js Events Interface |
| fs | File I/O is provided by simple wrappers around standard POSIX functions. |
| http | Node.js HTTP Interface |
| https | Node.js HTTPS Interface |
| net | The net module provides you with an asynchronous network wrapper. |
| os | Provides a few basic operating-system related utility functions. |
| path | This module contains utilities for handling and transforming file paths. |
| querystring | The querystring module provides utilities for parsing and formatting URL query strings. |
| readline | Readline allows reading of a stream on a line-by-line basis. |
| repl | The REPL provides a way to interactively run JavaScript and see the results. |
| stream | A stream is an abstract interface implemented by various objects in Node.js. |
| string-decoder | The string_decoder module provides an API for decoding Buffer objects into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 characters. |
| timers | The timer module exposes a global API for scheduling functions to be called at some future period of time. |
| tty | The tty module provides the tty.ReadStream and tty.WriteStream classes. |
| url | The url module provides utilities for URL resolution and parsing. |
| util | The util module is primarily designed to support the needs of Node.js's internal APIs.|
| vm | The vm module provides APIs for compiling and running code within V8 Virtual Machine contexts.|
| zlib | This provides bindings to Gzip/Gunzip, Deflate/Inflate, and DeflateRaw/InflateRaw classes. |
```sbt
libraryDependencies += "net.exoego" %%% "scala-js-nodejs-v8" % "0.8.0"
```

## How to use
## Support matrix

| | ScalaJS 0.6.28+ | ScalaJS 1.x |
| ---------- | :----------------: | :------------: |
| Scala 2.13 | :heavy_check_mark: | :construction: |
| Scala 2.12 | :heavy_check_mark: | :construction: |
| Scala 2.11 | N/A | N/A |
| Scala 2.10 | N/A | N/A |

**TBD**: Not published yet.
- :heavy_check_mark: Supported
- :construction: Not supported but planned

See https://github.com/exoego/scala-js-nodejs/issues/3
### Supported Modules

The following core Node.js modules (v8.7.0) have been implemented:

| Node Module | Description |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| assert | Provides a simple set of assertion tests that can be used to test invariants. |
| buffer | The Buffer class was introduced as part of the Node.js API to make it possible to interact with octet streams in the context of things like TCP streams and file system operations. |
| child_process | The child_process module provides the ability to spawn child processes. |
| cluster | The cluster module allows you to easily create child processes that all share server ports. |
| crypto | The crypto module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions. |
| dns | Support for DNS queries. |
| events | Node.js Events Interface |
| fs | File I/O is provided by simple wrappers around standard POSIX functions. |
| http | Node.js HTTP Interface |
| https | Node.js HTTPS Interface |
| net | The net module provides you with an asynchronous network wrapper. |
| os | Provides a few basic operating-system related utility functions. |
| path | This module contains utilities for handling and transforming file paths. |
| querystring | The querystring module provides utilities for parsing and formatting URL query strings. |
| readline | Readline allows reading of a stream on a line-by-line basis. |
| repl | The REPL provides a way to interactively run JavaScript and see the results. |
| stream | A stream is an abstract interface implemented by various objects in Node.js. |
| string-decoder | The string_decoder module provides an API for decoding Buffer objects into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 characters. |
| timers | The timer module exposes a global API for scheduling functions to be called at some future period of time. |
| tty | The tty module provides the tty.ReadStream and tty.WriteStream classes. |
| url | The url module provides utilities for URL resolution and parsing. |
| util | The util module is primarily designed to support the needs of Node.js's internal APIs. |
| vm | The vm module provides APIs for compiling and running code within V8 Virtual Machine contexts. |
| zlib | This provides bindings to Gzip/Gunzip, Deflate/Inflate, and DeflateRaw/InflateRaw classes. |

## Example of code

Expand Down
119 changes: 69 additions & 50 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
val scalaJsIOVersion = "0.4.3"
val apiVersion = scalaJsIOVersion
import sbt.url
import sbtrelease.ReleaseStateTransformations._

val scala212Version = "2.12.8"
val scala213Version = "2.13.0"
val supportedScalaVersion = Seq(scala212Version, scala213Version)

val scalatestVersion = "3.0.8"
val scalacticVersion = "3.0.8"

organization in ThisBuild := "net.exoego"

lazy val commonSettings = Seq(
autoCompilerPlugins := true,
crossScalaVersions := supportedScalaVersion,
Expand Down Expand Up @@ -39,19 +42,28 @@ lazy val commonMacroParadiseSetting = Seq(
}
}
)
val nonPublishingSetting = Seq(
publishArtifact := false,
publish := {},
publishLocal := {}
)

lazy val root = (project in file("."))
.aggregate(core, common, nodejs_v8)
.settings(commonSettings)
.settings(publishingSettings)
.settings(nonPublishingSetting)
.settings(
name := "scala-js-nodejs-all"
)

lazy val core = (project in file("./core"))
.enablePlugins(ScalaJSPlugin)
.settings(commonSettings)
.settings(commonScalaJsSettings)
.settings(publishingSettings)
.settings(
name := "core",
organization := "io.scalajs",
description := "Core utilities for the ScalaJs.io platform",
version := apiVersion,
name := "scala-js-nodejs-core",
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scalatest" %%% "scalatest" % scalatestVersion % "test"
Expand All @@ -62,78 +74,85 @@ lazy val common = (project in file("./app/common"))
.enablePlugins(ScalaJSPlugin)
.settings(commonSettings)
.settings(commonScalaJsSettings)
.settings(commonMacroParadiseSetting)
.settings(publishingSettings)
.settings(
name := "nodejs-common",
version := apiVersion,
organization := "io.scalajs",
description := "NodeJS common API",
homepage := Some(url("https://github.com/scalajs-io/nodejs")),
name := "scala-js-nodejs-common",
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scalactic" %% "scalactic" % scalacticVersion,
"org.scalatest" %%% "scalatest" % scalatestVersion % "test"
)
)
.settings(commonMacroParadiseSetting)
.dependsOn(core)

lazy val nodejs_v8 = (project in file("./app/nodejs_v8"))
.dependsOn(common)
.enablePlugins(ScalaJSPlugin)
.settings(commonSettings)
.settings(commonScalaJsSettings)
.settings(commonMacroParadiseSetting)
.settings(publishingSettings)
.settings(
name := "nodejs",
version := apiVersion,
organization := "io.scalajs",
name := "scala-js-nodejs-v8",
description := "NodeJS v8.7.0 API for Scala.js",
homepage := Some(url("https://github.com/scalajs-io/nodejs")),
homepage := Some(url("https://github.com/exoego/scala-js-nodejs")),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scalactic" %% "scalactic" % scalacticVersion,
"org.scalatest" %%% "scalatest" % scalatestVersion % "test"
)
)
.settings(commonMacroParadiseSetting)
.dependsOn(core)

lazy val publishingSettings = Seq(
sonatypeProfileName := "org.xerial",
licenses := Seq("APL2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
scmInfo := Some(
ScmInfo(
url("https://github.com/exoego/scala-js-nodejs"),
"scm:git:[email protected]:exoego/scala-js-nodejs.git"
)
),
homepage := scmInfo.value.map(_.browseUrl),
developers := List(
Developer(
id = "exoego",
name = "TATSUNO Yasuhiro",
email = "[email protected]",
url = url("https://www.exoego.net")
)
),
publishMavenStyle := true,
publishTo := {
val nexus = "https://oss.sonatype.org/"
publishArtifact in Test := false,
publishArtifact in (Compile, packageDoc) := true,
publishArtifact in (Compile, packageSrc) := true,
publishArtifact in packageDoc := false,
pomIncludeRepository := { _ =>
false
},
publishTo := Some(
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
Opts.resolver.sonatypeSnapshots
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
pomExtra :=
<url>https://github.com/scalajs-io/nodejs</url>
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>
<scm>
<connection>scm:git:github.com/scalajs-io/nodejs.git</connection>
<developerConnection>scm:git:[email protected]:scalajs-io/nodejs.git</developerConnection>
<url>github.com/scalajs-io/nodejs.git</url>
</scm>
<developers>
<developer>
<id>scalajs-io</id>
<name>Lawrence Daniels</name>
<email>[email protected]</email>
<organization>io.scalajs</organization>
<organizationUrl>https://github.com/scalajs-io</organizationUrl>
<roles>
<role>Project-Administrator</role>
<role>Developer</role>
</roles>
<timezone>+7</timezone>
</developer>
</developers>
Opts.resolver.sonatypeStaging
),
publishConfiguration := publishConfiguration.value.withOverwrite(false),
publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true),
sources in (Compile, doc) := Seq.empty,
releaseIgnoreUntrackedFiles := true,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
setNextVersion,
commitNextVersion,
releaseStepCommand("sonatypeReleaseAll")
)
)

// loads the Scalajs-io root project at sbt startup
Expand Down
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
"name": "nodejs-sfs",
"version": "0.4.2",
"private": true,
"scripts": {
"lint-md": "remark .",
"fix-md": "remark . -o"
},
"remarkConfig": {
"plugins": [
"remark-preset-lint-recommended"
]
},
"dependencies": {
"remark-cli": "^6.0.1",
"remark-preset-lint-recommended": "^3.0.2",
"source-map-support": "^0.4.14"
}
}
30 changes: 5 additions & 25 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
// Scala.js

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.28")

// Code Formatting

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.1")

// Testing

//addSbtPlugin("com.artima.supersafe" % "sbtplugin" % "1.1.2")

// Publishing

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.5")

addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2-1")

//// Resolvers
//
//resolvers += "Artima Maven Repository" at "http://repo.artima.com/releases"
//
//resolvers += "TypeSafe repository" at "http://repo.typesafe.com/typesafe/releases/"
//
//resolvers += Resolver.url("scala-js-snapshots", url("http://repo.scala-js.org/repo/snapshots/"))(Resolver.ivyStylePatterns)
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.28")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.5")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.11")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
32 changes: 0 additions & 32 deletions sonatype.sbt

This file was deleted.

1 change: 1 addition & 0 deletions version.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version in ThisBuild := "0.8.1-SNAPSHOT"