@@ -6,13 +6,16 @@ lazy val `scala-2.13` = "2.13.6"
66lazy val `scala-3.0` = " 3.0.1"
77
88// This is used in a couple places
9- lazy val fs2Version = " 3.0.5 "
9+ lazy val fs2Version = " 3.1.0 "
1010lazy val natchezVersion = " 0.1.5"
1111
1212// We do `evictionCheck` in CI
1313inThisBuild(Seq (
1414 evictionRules ++= Seq (
1515 " org.typelevel" % " cats-*" % " semver-spec" ,
16+ " org.scala-js" % " scalajs-*" % " semver-spec" ,
17+ " org.portable-scala" % " portable-scala-reflect_*" % " semver-spec" ,
18+ " io.github.cquiroz" % " scala-java-time_*" % " semver-spec" ,
1619 )
1720))
1821
@@ -65,9 +68,9 @@ lazy val commonSettings = Seq(
6568 Compile / unmanagedSourceDirectories ++= {
6669 val sourceDir = (Compile / sourceDirectory).value
6770 CrossVersion .partialVersion(scalaVersion.value) match {
68- case Some ((3 , _)) => Seq (sourceDir / " scala-2.13+" )
71+ case Some ((3 , _)) => Seq (sourceDir / " scala-2.13+" , file(sourceDir.getPath.replaceFirst( " jvm " , " shared " ).replaceFirst( " js " , " shared " )) / " scala-2.13+ " )
6972 case Some ((2 , 12 )) => Seq ()
70- case Some ((2 , _)) => Seq (sourceDir / " scala-2.13+" )
73+ case Some ((2 , _)) => Seq (sourceDir / " scala-2.13+" , file(sourceDir.getPath.replaceFirst( " jvm " , " shared " ).replaceFirst( " js " , " shared " )) / " scala-2.13+ " )
7174 case _ => Seq ()
7275 }
7376 },
@@ -89,99 +92,124 @@ lazy val skunk = project
8992 .enablePlugins(AutomateHeaderPlugin )
9093 .settings(commonSettings)
9194 .settings(publish / skip := true )
92- .dependsOn(core, tests, circe, refined, example)
93- .aggregate(core, tests, circe, refined, example)
95+ .dependsOn(core.jvm, core.js, tests.jvm, tests.js, circe.jvm, circe.js, refined.jvm, refined.js , example)
96+ .aggregate(core.jvm, core.js, tests.jvm, tests.js, circe.jvm, circe.js, refined.jvm, refined.js , example)
9497
95- lazy val core = project
98+ lazy val core = crossProject(JVMPlatform , JSPlatform )
99+ .crossType(CrossType .Full )
96100 .in(file(" modules/core" ))
97101 .enablePlugins(AutomateHeaderPlugin )
102+ .jsEnablePlugins(ScalaJSBundlerPlugin )
103+ .jsConfigure(_.disablePlugins(ScoverageSbtPlugin ))
98104 .settings(commonSettings)
99105 .settings(
100106 name := " skunk-core" ,
101107 description := " Tagless, non-blocking data access library for Postgres." ,
102108 resolvers += " Sonatype OSS Snapshots" at " https://oss.sonatype.org/content/repositories/snapshots" ,
103109 libraryDependencies ++= Seq (
104- " org.typelevel" %% " cats-core" % " 2.6.1" ,
105- " org.typelevel" %% " cats-effect" % " 3.1.1" ,
106- " co.fs2" %% " fs2-core" % fs2Version,
107- " co.fs2" %% " fs2-io" % fs2Version,
108- " org.scodec" %% " scodec-core" % (if (scalaVersion.value.startsWith(" 3." )) " 2.0.0" else " 1.11.8" ),
109- " org.scodec" %% " scodec-cats" % " 1.1.0" ,
110- " org.tpolecat" %% " natchez-core" % natchezVersion,
111- " org.tpolecat" %% " sourcepos" % " 1.0.0" ,
112- " com.ongres.scram" % " client" % " 2.1" ,
113- " org.scala-lang.modules" %% " scala-collection-compat" % " 2.4.4" ,
110+ " org.typelevel" %%% " cats-core" % " 2.6.1" ,
111+ " org.typelevel" %%% " cats-effect" % " 3.1.1" ,
112+ " co.fs2" %%% " fs2-core" % fs2Version,
113+ " co.fs2" %%% " fs2-io" % fs2Version,
114+ " org.scodec" %%% " scodec-core" % (if (scalaVersion.value.startsWith(" 3." )) " 2.0.0" else " 1.11.8" ),
115+ " org.scodec" %%% " scodec-cats" % " 1.1.0" ,
116+ " org.tpolecat" %%% " natchez-core" % natchezVersion,
117+ " org.tpolecat" %%% " sourcepos" % " 1.0.1" ,
118+ " org.scala-lang.modules" %%% " scala-collection-compat" % " 2.4.4" ,
114119 ) ++ Seq (
115- " com.beachape" %% " enumeratum" % " 1.6.1" ,
120+ " com.beachape" %%% " enumeratum" % " 1.6.1" ,
116121 ).filterNot(_ => scalaVersion.value.startsWith(" 3." ))
122+ ).jvmSettings(
123+ libraryDependencies += " com.ongres.scram" % " client" % " 2.1" ,
124+ ).jsSettings(
125+ libraryDependencies ++= Seq (
126+ " io.github.cquiroz" %%% " scala-java-time" % " 2.3.0" ,
127+ " io.github.cquiroz" %%% " locales-minimal-en_us-db" % " 1.2.1"
128+ ),
129+ Compile / npmDependencies += " saslprep" -> " 1.0.3" ,
130+ useYarn := true ,
131+ yarnExtraArgs += " --frozen-lockfile" ,
117132 )
118133
119- lazy val refined = project
134+ lazy val refined = crossProject(JVMPlatform , JSPlatform )
135+ .crossType(CrossType .Pure )
120136 .in(file(" modules/refined" ))
121137 .dependsOn(core)
122138 .enablePlugins(AutomateHeaderPlugin )
139+ .jsConfigure(_.disablePlugins(ScoverageSbtPlugin ))
123140 .settings(commonSettings)
124141 .settings(
125142 libraryDependencies ++= Seq (
126- " eu.timepit" %% " refined" % " 0.9.27" ,
143+ " eu.timepit" %%% " refined" % " 0.9.27" ,
127144 )
128145 )
129146
130- lazy val circe = project
147+ lazy val circe = crossProject(JVMPlatform , JSPlatform )
148+ .crossType(CrossType .Pure )
131149 .in(file(" modules/circe" ))
132150 .dependsOn(core)
133151 .enablePlugins(AutomateHeaderPlugin )
152+ .jsConfigure(_.disablePlugins(ScoverageSbtPlugin ))
134153 .settings(commonSettings)
135154 .settings(
136155 name := " skunk-circe" ,
137156 libraryDependencies ++= Seq (
138- " io.circe" %% " circe-core" % " 0.14.1" ,
139- " io.circe" %% " circe-parser" % " 0.14.1"
157+ " io.circe" %%% " circe-core" % " 0.14.1" ,
158+ " io.circe" %%% " circe-parser" % " 0.14.1"
140159 )
141160 )
142161
143- lazy val tests = project
162+ lazy val tests = crossProject(JVMPlatform , JSPlatform )
163+ .crossType(CrossType .Full )
144164 .in(file(" modules/tests" ))
145165 .dependsOn(core, circe)
146166 .enablePlugins(AutomateHeaderPlugin )
167+ .jsEnablePlugins(ScalaJSBundlerPlugin )
168+ .jsConfigure(_.disablePlugins(ScoverageSbtPlugin ))
147169 .settings(commonSettings)
148170 .settings(
149171 publish / skip := true ,
150172 scalacOptions -= " -Xfatal-warnings" ,
151173 libraryDependencies ++= Seq (
152- " org.typelevel" %% " scalacheck-effect-munit" % " 1.0.2" ,
153- " org.typelevel" %% " munit-cats-effect-3" % " 1.0.5" ,
154- " org.typelevel" %% " cats-free" % " 2.6.1" ,
155- " org.typelevel" %% " cats-laws" % " 2.6.1" ,
156- " org.typelevel" %% " discipline-munit" % " 1.0.9" ,
174+ " org.scalameta" %%% " munit" % " 0.7.27" ,
175+ " org.scalameta" % " junit-interface" % " 0.7.27" ,
176+ " org.typelevel" %%% " scalacheck-effect-munit" % " 1.0.2" ,
177+ " org.typelevel" %%% " munit-cats-effect-3" % " 1.0.5" ,
178+ " org.typelevel" %%% " cats-free" % " 2.6.1" ,
179+ " org.typelevel" %%% " cats-laws" % " 2.6.1" ,
180+ " org.typelevel" %%% " discipline-munit" % " 1.0.9" ,
157181 ) ++ Seq (
158- " io.chrisdavenport" %% " cats-time" % " 0.3.4" ,
182+ " io.chrisdavenport" %%% " cats-time" % " 0.3.4" ,
159183 ).filterNot(_ => scalaVersion.value.startsWith(" 3." )),
160184 testFrameworks += new TestFramework (" munit.Framework" )
161185 )
186+ .jsSettings(
187+ Test / scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind .CommonJSModule )),
188+ useYarn := true
189+ )
162190
163191lazy val example = project
164192 .in(file(" modules/example" ))
165- .dependsOn(core)
193+ .dependsOn(core.jvm )
166194 .enablePlugins(AutomateHeaderPlugin )
167195 .settings(commonSettings)
168196 .settings(
169197 publish / skip := true ,
170198 libraryDependencies ++= Seq (
171- " org.tpolecat" %% " natchez-honeycomb" % natchezVersion,
172- " org.tpolecat" %% " natchez-jaeger" % natchezVersion,
199+ " org.tpolecat" %%% " natchez-honeycomb" % natchezVersion,
200+ " org.tpolecat" %%% " natchez-jaeger" % natchezVersion,
173201 )
174202 // ) ++ Seq(
175- // "org.http4s" %% "http4s-dsl" % "0.21.22",
176- // "org.http4s" %% "http4s-blaze-server" % "0.21.22",
177- // "org.http4s" %% "http4s-circe" % "0.21.22",
178- // "io.circe" %% "circe-generic" % "0.13.0",
203+ // "org.http4s" %%% "http4s-dsl" % "0.21.22",
204+ // "org.http4s" %%% "http4s-blaze-server" % "0.21.22",
205+ // "org.http4s" %%% "http4s-circe" % "0.21.22",
206+ // "io.circe" %%% "circe-generic" % "0.13.0",
179207 // ).filterNot(_ => scalaVersion.value.startsWith("3."))
180208 )
181209
182210lazy val docs = project
183211 .in(file(" modules/docs" ))
184- .dependsOn(core)
212+ .dependsOn(core.jvm )
185213 .enablePlugins(AutomateHeaderPlugin )
186214 .enablePlugins(ParadoxPlugin )
187215 .enablePlugins(ParadoxSitePlugin )
@@ -196,11 +224,11 @@ lazy val docs = project
196224 paradoxTheme := Some (builtinParadoxTheme(" generic" )),
197225 version := version.value.takeWhile(_ != '+' ), // strip off the +3-f22dca22+20191110-1520-SNAPSHOT business
198226 paradoxProperties ++= Map (
199- " scala-versions" -> (core / crossScalaVersions).value.map(CrossVersion .partialVersion).flatten.map(_._2).mkString(" 2." , " /" , " " ),
227+ " scala-versions" -> (core.jvm / crossScalaVersions).value.map(CrossVersion .partialVersion).flatten.map(_._2).mkString(" 2." , " /" , " " ),
200228 " org" -> organization.value,
201229 " scala.binary.version" -> s " 2. ${CrossVersion .partialVersion(scalaVersion.value).get._2}" ,
202- " core-dep" -> s " ${(core / name).value}_2. ${CrossVersion .partialVersion(scalaVersion.value).get._2}" ,
203- " circe-dep" -> s " ${(circe / name).value}_2. ${CrossVersion .partialVersion(scalaVersion.value).get._2}" ,
230+ " core-dep" -> s " ${(core.jvm / name).value}_2. ${CrossVersion .partialVersion(scalaVersion.value).get._2}" ,
231+ " circe-dep" -> s " ${(circe.jvm / name).value}_2. ${CrossVersion .partialVersion(scalaVersion.value).get._2}" ,
204232 " version" -> version.value,
205233 " scaladoc.skunk.base_url" -> s " https://static.javadoc.io/org.tpolecat/skunk-core_2.12/ ${version.value}" ,
206234 " scaladoc.fs2.io.base_url" -> s " https://static.javadoc.io/co.fs2/fs2-io_2.12/ ${fs2Version}" ,
@@ -210,6 +238,6 @@ lazy val docs = project
210238 makeSite := makeSite.dependsOn(mdoc.toTask(" " )).value,
211239 mdocExtraArguments := Seq (" --no-link-hygiene" ), // paradox handles this
212240 libraryDependencies ++= Seq (
213- " org.tpolecat" %% " natchez-jaeger" % natchezVersion,
241+ " org.tpolecat" %%% " natchez-jaeger" % natchezVersion,
214242 )
215243)
0 commit comments