From b93f479a66b0d4e74b15ebe61f674f14c29c363d Mon Sep 17 00:00:00 2001 From: Julio Date: Mon, 24 Jun 2024 15:39:33 -0600 Subject: [PATCH 1/4] feat: neable js and native plugins --- project/plugins.sbt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/project/plugins.sbt b/project/plugins.sbt index 4a74d56..5729a22 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1 +1,7 @@ addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.22") + +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.4") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") + +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") From 0a6badfbbb64e9f2e8a29d2c279ac3a2737b4bd1 Mon Sep 17 00:00:00 2001 From: Julio Date: Mon, 24 Jun 2024 15:40:04 -0600 Subject: [PATCH 2/4] feat: turn project into cross-project * Create project root as recommended by sbt-crossproject * Aggregate dependency between core ("squids") and root projects * Update munit library to 1.0.0 --- build.sbt | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index f8be4fd..e74cbb2 100644 --- a/build.sbt +++ b/build.sbt @@ -14,12 +14,22 @@ ThisBuild / crossScalaVersions := supportedScalaVersions ThisBuild / scalaVersion := scala213 ThisBuild / tlSonatypeUseLegacyHost := false -lazy val sqids = project - .in(file(".")) - .settings( - name := "sqids", - headerLicenseStyle := HeaderLicenseStyle.SpdxSyntax, - libraryDependencies ++= Seq( - "org.scalameta" %% "munit-scalacheck" % "0.7.29" % Test +lazy val root = + project + .in(file(".")) + .settings( + publish / skip := true + ) + .aggregate(core.jvm, core.native, core.js) + +lazy val core = + crossProject(JVMPlatform, NativePlatform, JSPlatform) + .crossType(CrossType.Pure) + .in(file("core")) + .settings( + name := "sqids", + headerLicenseStyle := HeaderLicenseStyle.SpdxSyntax, + libraryDependencies ++= Seq( + "org.scalameta" %%% "munit-scalacheck" % "1.0.0" % Test + ) ) - ) From cca38cfb2c0454830348da594792621437db7e55 Mon Sep 17 00:00:00 2001 From: Julio Date: Mon, 24 Jun 2024 15:41:05 -0600 Subject: [PATCH 3/4] chore: ignore garbage --- .gitignore | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2f7896d..f3fc256 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,10 @@ -target/ +.bloop +.bsp +.metals +.vscode + +metals.sbt +project/project + +target +build From 45767a11cd98f4a9a8edd71eb136d627acd254b2 Mon Sep 17 00:00:00 2001 From: Julio Date: Mon, 24 Jun 2024 15:42:00 -0600 Subject: [PATCH 4/4] chore!: move src into core --- {src => core/src}/main/scala/sqids/Sqid.scala | 0 {src => core/src}/main/scala/sqids/Sqids.scala | 0 {src => core/src}/main/scala/sqids/SqidsError.scala | 0 {src => core/src}/main/scala/sqids/options/Alphabet.scala | 0 {src => core/src}/main/scala/sqids/options/Blocklist.scala | 0 {src => core/src}/main/scala/sqids/options/SqidsOptions.scala | 0 {src => core/src}/test/scala/sqids/AlphabetSuite.scala | 1 + {src => core/src}/test/scala/sqids/BlocklistSuite.scala | 2 ++ {src => core/src}/test/scala/sqids/SqidsSuite_encoding.scala | 0 {src => core/src}/test/scala/sqids/SqidsSuite_minLength.scala | 1 + 10 files changed, 4 insertions(+) rename {src => core/src}/main/scala/sqids/Sqid.scala (100%) rename {src => core/src}/main/scala/sqids/Sqids.scala (100%) rename {src => core/src}/main/scala/sqids/SqidsError.scala (100%) rename {src => core/src}/main/scala/sqids/options/Alphabet.scala (100%) rename {src => core/src}/main/scala/sqids/options/Blocklist.scala (100%) rename {src => core/src}/main/scala/sqids/options/SqidsOptions.scala (100%) rename {src => core/src}/test/scala/sqids/AlphabetSuite.scala (99%) rename {src => core/src}/test/scala/sqids/BlocklistSuite.scala (99%) rename {src => core/src}/test/scala/sqids/SqidsSuite_encoding.scala (100%) rename {src => core/src}/test/scala/sqids/SqidsSuite_minLength.scala (99%) diff --git a/src/main/scala/sqids/Sqid.scala b/core/src/main/scala/sqids/Sqid.scala similarity index 100% rename from src/main/scala/sqids/Sqid.scala rename to core/src/main/scala/sqids/Sqid.scala diff --git a/src/main/scala/sqids/Sqids.scala b/core/src/main/scala/sqids/Sqids.scala similarity index 100% rename from src/main/scala/sqids/Sqids.scala rename to core/src/main/scala/sqids/Sqids.scala diff --git a/src/main/scala/sqids/SqidsError.scala b/core/src/main/scala/sqids/SqidsError.scala similarity index 100% rename from src/main/scala/sqids/SqidsError.scala rename to core/src/main/scala/sqids/SqidsError.scala diff --git a/src/main/scala/sqids/options/Alphabet.scala b/core/src/main/scala/sqids/options/Alphabet.scala similarity index 100% rename from src/main/scala/sqids/options/Alphabet.scala rename to core/src/main/scala/sqids/options/Alphabet.scala diff --git a/src/main/scala/sqids/options/Blocklist.scala b/core/src/main/scala/sqids/options/Blocklist.scala similarity index 100% rename from src/main/scala/sqids/options/Blocklist.scala rename to core/src/main/scala/sqids/options/Blocklist.scala diff --git a/src/main/scala/sqids/options/SqidsOptions.scala b/core/src/main/scala/sqids/options/SqidsOptions.scala similarity index 100% rename from src/main/scala/sqids/options/SqidsOptions.scala rename to core/src/main/scala/sqids/options/SqidsOptions.scala diff --git a/src/test/scala/sqids/AlphabetSuite.scala b/core/src/test/scala/sqids/AlphabetSuite.scala similarity index 99% rename from src/test/scala/sqids/AlphabetSuite.scala rename to core/src/test/scala/sqids/AlphabetSuite.scala index 3e3fbe7..40642c3 100644 --- a/src/test/scala/sqids/AlphabetSuite.scala +++ b/core/src/test/scala/sqids/AlphabetSuite.scala @@ -7,6 +7,7 @@ package sqids import munit.ScalaCheckSuite + import sqids.options.Alphabet class AlphabetSuite extends ScalaCheckSuite { diff --git a/src/test/scala/sqids/BlocklistSuite.scala b/core/src/test/scala/sqids/BlocklistSuite.scala similarity index 99% rename from src/test/scala/sqids/BlocklistSuite.scala rename to core/src/test/scala/sqids/BlocklistSuite.scala index 1d4972a..35016ac 100644 --- a/src/test/scala/sqids/BlocklistSuite.scala +++ b/core/src/test/scala/sqids/BlocklistSuite.scala @@ -5,7 +5,9 @@ */ package sqids + import munit.ScalaCheckSuite + import sqids.options.Blocklist import sqids.options.SqidsOptions import sqids.options.Alphabet diff --git a/src/test/scala/sqids/SqidsSuite_encoding.scala b/core/src/test/scala/sqids/SqidsSuite_encoding.scala similarity index 100% rename from src/test/scala/sqids/SqidsSuite_encoding.scala rename to core/src/test/scala/sqids/SqidsSuite_encoding.scala diff --git a/src/test/scala/sqids/SqidsSuite_minLength.scala b/core/src/test/scala/sqids/SqidsSuite_minLength.scala similarity index 99% rename from src/test/scala/sqids/SqidsSuite_minLength.scala rename to core/src/test/scala/sqids/SqidsSuite_minLength.scala index face587..d95729c 100644 --- a/src/test/scala/sqids/SqidsSuite_minLength.scala +++ b/core/src/test/scala/sqids/SqidsSuite_minLength.scala @@ -7,6 +7,7 @@ package sqids import munit.ScalaCheckSuite + import sqids.options.SqidsOptions import sqids.options.Alphabet