From b9d01e5d119fc39fe581d311556fcb6c884b3c98 Mon Sep 17 00:00:00 2001 From: exoego Date: Tue, 18 Jun 2019 19:31:45 +0900 Subject: [PATCH 01/10] Explicitly name projects --- build.sbt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 4eef00dc7..c9a99b92f 100644 --- a/build.sbt +++ b/build.sbt @@ -42,6 +42,9 @@ lazy val commonMacroParadiseSetting = Seq( lazy val root = (project in file(".")) .aggregate(core, common, nodejs_v8) + .settings( + name := "scala-js-nodejs" + ) lazy val core = (project in file("./core")) .enablePlugins(ScalaJSPlugin) @@ -83,7 +86,7 @@ lazy val nodejs_v8 = (project in file("./app/nodejs_v8")) .settings(commonSettings) .settings(commonScalaJsSettings) .settings( - name := "nodejs", + name := "nodejs_v8", version := apiVersion, organization := "io.scalajs", description := "NodeJS v8.7.0 API for Scala.js", From 853e445ee01753c4f9133e739d100be3d621323a Mon Sep 17 00:00:00 2001 From: exoego Date: Tue, 18 Jun 2019 19:47:08 +0900 Subject: [PATCH 02/10] Configure publish using sbt-release --- build.sbt | 84 +++++++++++++++++++++++++-------------------- project/plugins.sbt | 30 +++------------- sonatype.sbt | 32 ----------------- version.sbt | 1 + 4 files changed, 53 insertions(+), 94 deletions(-) delete mode 100644 sonatype.sbt create mode 100644 version.sbt diff --git a/build.sbt b/build.sbt index c9a99b92f..8f0824080 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,6 @@ -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) @@ -67,7 +68,6 @@ lazy val common = (project in file("./app/common")) .settings(commonScalaJsSettings) .settings( name := "nodejs-common", - version := apiVersion, organization := "io.scalajs", description := "NodeJS common API", homepage := Some(url("https://github.com/scalajs-io/nodejs")), @@ -87,7 +87,6 @@ lazy val nodejs_v8 = (project in file("./app/nodejs_v8")) .settings(commonScalaJsSettings) .settings( name := "nodejs_v8", - version := apiVersion, organization := "io.scalajs", description := "NodeJS v8.7.0 API for Scala.js", homepage := Some(url("https://github.com/scalajs-io/nodejs")), @@ -101,42 +100,53 @@ lazy val nodejs_v8 = (project in file("./app/nodejs_v8")) .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:git@github.com:exoego/scala-js-nodejs.git" + ) + ), + homepage := scmInfo.value.map(_.browseUrl), + developers := List( + Developer( + id = "exoego", + name = "TATSUNO Yasuhiro", + email = "ytatsuno.jp@gmail.com", + 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 := - https://github.com/scalajs-io/nodejs - - - MIT License - http://www.opensource.org/licenses/mit-license.php - - - - scm:git:github.com/scalajs-io/nodejs.git - scm:git:git@github.com:scalajs-io/nodejs.git - github.com/scalajs-io/nodejs.git - - - - scalajs-io - Lawrence Daniels - lawrence.daniels@gmail.com - io.scalajs - https://github.com/scalajs-io - - Project-Administrator - Developer - - +7 - - + 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 diff --git a/project/plugins.sbt b/project/plugins.sbt index 64c851be9..2692883f2 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -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") diff --git a/sonatype.sbt b/sonatype.sbt deleted file mode 100644 index 5305695d5..000000000 --- a/sonatype.sbt +++ /dev/null @@ -1,32 +0,0 @@ -// Your profile name of the sonatype account. The default is the same with the organization value -sonatypeProfileName := "ldaniels528" - -// To sync with Maven central, you need to supply the following information: -pomExtra in Global := { - https://github.com/ldaniels528/scalajs-nodejs - - - MIT License - http://www.opensource.org/licenses/mit-license.php - - - - scm:git:github.com/ldaniels528/scalajs-nodejs.git - scm:git:git@github.com:ldaniels528/scalajs-nodejs.git - github.com/ldaniels528/scalajs-nodejs.git - - - - ldaniels528 - Lawrence Daniels - lawrence.daniels@gmail.com - com.github.ldaniels528 - https://github.com/ldaniels528 - - Project-Administrator - Developer - - +7 - - -} diff --git a/version.sbt b/version.sbt new file mode 100644 index 000000000..404aa03e0 --- /dev/null +++ b/version.sbt @@ -0,0 +1 @@ +version in ThisBuild := "0.5.0-SNAPSHOT" From 2891c6c0250b803bbbd95f2660be79d9f25127d4 Mon Sep 17 00:00:00 2001 From: exoego Date: Tue, 18 Jun 2019 19:53:30 +0900 Subject: [PATCH 03/10] Publish nodejs_v8 only since core, common and root are for internal --- build.sbt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index 8f0824080..ba8f9eab4 100644 --- a/build.sbt +++ b/build.sbt @@ -44,8 +44,11 @@ lazy val commonMacroParadiseSetting = Seq( lazy val root = (project in file(".")) .aggregate(core, common, nodejs_v8) .settings( - name := "scala-js-nodejs" + name := "scala-js-nodejs", + publish := {}, + publishLocal := {} ) + .settings(publishingSettings) lazy val core = (project in file("./core")) .enablePlugins(ScalaJSPlugin) @@ -53,9 +56,8 @@ lazy val core = (project in file("./core")) .settings(commonScalaJsSettings) .settings( name := "core", - organization := "io.scalajs", - description := "Core utilities for the ScalaJs.io platform", - version := apiVersion, + publish := {}, + publishLocal := {}, libraryDependencies ++= Seq( "org.scala-lang" % "scala-reflect" % scalaVersion.value, "org.scalatest" %%% "scalatest" % scalatestVersion % "test" @@ -68,9 +70,8 @@ lazy val common = (project in file("./app/common")) .settings(commonScalaJsSettings) .settings( name := "nodejs-common", - organization := "io.scalajs", - description := "NodeJS common API", - homepage := Some(url("https://github.com/scalajs-io/nodejs")), + publish := {}, + publishLocal := {}, libraryDependencies ++= Seq( "org.scala-lang" % "scala-reflect" % scalaVersion.value, "org.scalactic" %% "scalactic" % scalacticVersion, From fada3ad6bc41c842154c08774dd808d15cd3ca67 Mon Sep 17 00:00:00 2001 From: exoego Date: Tue, 18 Jun 2019 19:53:51 +0900 Subject: [PATCH 04/10] Specify proper organization and homepage --- build.sbt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index ba8f9eab4..3f09649d8 100644 --- a/build.sbt +++ b/build.sbt @@ -8,6 +8,8 @@ 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, @@ -88,9 +90,8 @@ lazy val nodejs_v8 = (project in file("./app/nodejs_v8")) .settings(commonScalaJsSettings) .settings( name := "nodejs_v8", - organization := "io.scalajs", 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, From e57be1ef1e3ff6978fd942b31369e6f4ae4bf17a Mon Sep 17 00:00:00 2001 From: exoego Date: Tue, 18 Jun 2019 19:59:06 +0900 Subject: [PATCH 05/10] Add .jvmopts for stable building --- .jvmopts | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .jvmopts diff --git a/.jvmopts b/.jvmopts new file mode 100644 index 000000000..539156e58 --- /dev/null +++ b/.jvmopts @@ -0,0 +1,4 @@ +-Xss4M +-Xmx2G +-XX:MaxMetaspaceSize=1G +-XX:+CMSClassUnloadingEnabled From 3dcf5c9ec89d0d32dd9156d2af3dc2a2cf118dd3 Mon Sep 17 00:00:00 2001 From: exoego Date: Tue, 18 Jun 2019 20:18:42 +0900 Subject: [PATCH 06/10] Fix root project settings --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 3f09649d8..a87bffd95 100644 --- a/build.sbt +++ b/build.sbt @@ -50,6 +50,7 @@ lazy val root = (project in file(".")) publish := {}, publishLocal := {} ) + .settings(commonSettings) .settings(publishingSettings) lazy val core = (project in file("./core")) From 11397a21abb387da800d3345ee74b8aca678f31b Mon Sep 17 00:00:00 2001 From: exoego Date: Wed, 19 Jun 2019 07:32:22 +0900 Subject: [PATCH 07/10] Do not publish for these artifacts --- build.sbt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index a87bffd95..00f40bdb6 100644 --- a/build.sbt +++ b/build.sbt @@ -47,8 +47,7 @@ lazy val root = (project in file(".")) .aggregate(core, common, nodejs_v8) .settings( name := "scala-js-nodejs", - publish := {}, - publishLocal := {} + publishArtifact := false ) .settings(commonSettings) .settings(publishingSettings) @@ -59,8 +58,7 @@ lazy val core = (project in file("./core")) .settings(commonScalaJsSettings) .settings( name := "core", - publish := {}, - publishLocal := {}, + publishArtifact := false, libraryDependencies ++= Seq( "org.scala-lang" % "scala-reflect" % scalaVersion.value, "org.scalatest" %%% "scalatest" % scalatestVersion % "test" @@ -73,8 +71,7 @@ lazy val common = (project in file("./app/common")) .settings(commonScalaJsSettings) .settings( name := "nodejs-common", - publish := {}, - publishLocal := {}, + publishArtifact := false, libraryDependencies ++= Seq( "org.scala-lang" % "scala-reflect" % scalaVersion.value, "org.scalactic" %% "scalactic" % scalacticVersion, From ffb03d096d29c529dcf4863020f133fde5d2cff9 Mon Sep 17 00:00:00 2001 From: exoego Date: Wed, 19 Jun 2019 07:43:43 +0900 Subject: [PATCH 08/10] Global publishing settings --- build.sbt | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/build.sbt b/build.sbt index 00f40bdb6..af6825124 100644 --- a/build.sbt +++ b/build.sbt @@ -42,23 +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( - name := "scala-js-nodejs", - publishArtifact := false - ) .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", - publishArtifact := false, + name := "scala-js-nodejs-core", libraryDependencies ++= Seq( "org.scala-lang" % "scala-reflect" % scalaVersion.value, "org.scalatest" %%% "scalatest" % scalatestVersion % "test" @@ -69,16 +74,16 @@ lazy val common = (project in file("./app/common")) .enablePlugins(ScalaJSPlugin) .settings(commonSettings) .settings(commonScalaJsSettings) + .settings(commonMacroParadiseSetting) + .settings(publishingSettings) .settings( - name := "nodejs-common", - publishArtifact := false, + 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")) @@ -86,8 +91,10 @@ lazy val nodejs_v8 = (project in file("./app/nodejs_v8")) .enablePlugins(ScalaJSPlugin) .settings(commonSettings) .settings(commonScalaJsSettings) + .settings(commonMacroParadiseSetting) + .settings(publishingSettings) .settings( - name := "nodejs_v8", + name := "scala-js-nodejs-v8", description := "NodeJS v8.7.0 API for Scala.js", homepage := Some(url("https://github.com/exoego/scala-js-nodejs")), libraryDependencies ++= Seq( @@ -96,7 +103,6 @@ lazy val nodejs_v8 = (project in file("./app/nodejs_v8")) "org.scalatest" %%% "scalatest" % scalatestVersion % "test" ) ) - .settings(commonMacroParadiseSetting) .dependsOn(core) lazy val publishingSettings = Seq( From d3a791f411294ce6daeac26eeeeea4a2d8ecc95d Mon Sep 17 00:00:00 2001 From: exoego Date: Wed, 19 Jun 2019 11:44:11 +0900 Subject: [PATCH 09/10] Setting version to 0.8.1-SNAPSHOT --- version.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.sbt b/version.sbt index 404aa03e0..e74ced496 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -version in ThisBuild := "0.5.0-SNAPSHOT" +version in ThisBuild := "0.8.1-SNAPSHOT" From 41e2874ebd9e958d96341fe0a4120fccef568188 Mon Sep 17 00:00:00 2001 From: exoego Date: Thu, 20 Jun 2019 10:14:29 +0900 Subject: [PATCH 10/10] Update how to use and support matrix --- README.md | 81 ++++++++++++++++++++++++++++------------------------ package.json | 11 +++++++ 2 files changed, 55 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index a3224fce5..3130f1a4c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json index dbe378ecb..34f1da8dd 100644 --- a/package.json +++ b/package.json @@ -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" } }