Skip to content

Commit e3f66f2

Browse files
authored
Merge pull request #3 from kinoplan/new
Add cross-build for ScalaJS 1.x and 0.6.x, add cross-build for 2.12x …
2 parents b682ac1 + 58d4db7 commit e3f66f2

File tree

167 files changed

+1166
-748
lines changed

Some content is hidden

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

167 files changed

+1166
-748
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v1
11-
- uses: olafurpg/setup-scala@v2
11+
- uses: olafurpg/setup-scala@v10
1212
- uses: actions/setup-node@v1
1313
- uses: olafurpg/setup-gpg@v2
1414
- name: Publish
15-
run: sbt -mem 4096 ci-release
15+
run: DEMO_ENABLED=0 sbt -mem 4096 ci-release
1616
env:
1717
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
1818
PGP_SECRET: ${{ secrets.PGP_SECRET }}
1919
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
2020
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
21+
- name: Publish 0.6
22+
run: SCALAJS_VERSION=0.6.33 DEMO_ENABLED=0 sbt -mem 4096 ci-release
23+
env:
24+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
25+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
26+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
27+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}

.github/workflows/scala.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Scala CI
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
build:
@@ -11,5 +11,7 @@ jobs:
1111
uses: actions/setup-java@v1
1212
with:
1313
java-version: 1.8
14-
- name: Run tests
15-
run: sbt -mem 4096 test
14+
- name: Run test
15+
run: sbt -mem 4096 clean test
16+
- name: Run test 0.6
17+
run: SCALAJS_VERSION=0.6.33 DEMO_ENABLED=0 sbt -mem 4096 clean test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ target/
44
.idea/
55
.metals/
66
.bloop/
7+
.bsp/
78
local.*
89
node_modules/
910
package-lock.json

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ In the demo you can also find very detailed examples of using a bunch of:
5252
- [ScalablyTyped/Distribution](https://github.com/ScalablyTyped/Distribution)
5353

5454
Start:
55-
1. `sbt -mem 2048 restartWDS`
55+
1. `sbt -mem 2048 runDev`
5656
2. Open in browser `localhost:8080`
5757

5858
## License

build.sbt

Lines changed: 71 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
addCommandAlias("restartWDS", "; demo/fastOptJS::stopWebpackDevServer; ~demo/fastOptJS::startWebpackDevServer")
2-
3-
lazy val root = project.in(file(".")).settings(commonSettings).aggregate(core, icons, lab, demo).settings(
4-
name := "scalajs-react-material-ui",
5-
skip in publish := true
6-
)
1+
lazy val root = if (Settings.isDemoEnabled)
2+
project.in(file(".")).aggregate(core, icons, lab, bridge, demo).configure(Settings.rootProject)
3+
else
4+
project.in(file(".")).aggregate(core, icons, lab, bridge).configure(Settings.rootProject)
75

86
inThisBuild(
97
List(
108
homepage := Some(url("https://github.com/kinoplan/scalajs-react-material-ui")),
119
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
1210
developers := List(
1311
Developer(
14-
"kazievab",
15-
"Alexey Kaziev",
16-
"kazievab@gmail.com",
17-
url("https://github.com/kazievab")
12+
"kinoplan",
13+
"Kinoplan",
14+
"job@kinoplan.ru",
15+
url("https://kinoplan.tech")
1816
)
1917
),
2018
scmInfo := Some(
@@ -28,53 +26,80 @@ inThisBuild(
2826

2927
lazy val muiColorsGenerator = taskKey[Seq[File]]("mui-colors-generator")
3028

31-
lazy val core = (project in file("core")).settings(commonSettings).settings(
29+
lazy val core = (project in file("core")).dependsOn(bridge)
30+
.settings(commonSettings).settings(
3231
name := "scalajs-react-material-ui-core",
33-
scalaJSUseMainModuleInitializer := false,
32+
scalaJSUseMainModuleInitializer := false,
3433
npmDependencies in Compile ++= Settings.npmDependenciesCore.value,
34+
npmResolutions in Compile ++= (npmDependencies in Compile).value.toMap,
3535
libraryDependencies ++= Settings.scalajsDependenciesLib.value,
36-
muiColorsGenerator := Settings.generateColors(
36+
muiColorsGenerator := Generator.muiColors(
3737
(sourceManaged in Compile).value / "io" / "kinoplan" / "scalajs" / "react" / "material" / "ui" / "core" / "colors",
3838
(npmInstallDependencies in Compile).value
3939
),
40-
sourceGenerators in Compile += muiColorsGenerator.taskValue
40+
sourceGenerators in Compile += muiColorsGenerator.taskValue,
41+
sources in(Compile, doc) := Seq.empty,
42+
publishArtifact in(Compile, packageDoc) := false,
4143
).enablePlugins(ScalaJSBundlerPlugin)
4244

4345
lazy val muiIconsGenerator = taskKey[Seq[File]]("mui-icons-generator")
4446

45-
lazy val icons = (project in file("icons")).settings(commonSettings).settings(
47+
lazy val icons = (project in file("icons")).dependsOn(bridge)
48+
.settings(commonSettings).settings(
4649
name := "scalajs-react-material-ui-icons",
47-
scalaJSUseMainModuleInitializer := false,
50+
scalaJSUseMainModuleInitializer := false,
4851
npmDependencies in Compile ++= Settings.npmDependenciesIcons.value,
52+
npmResolutions in Compile ++= (npmDependencies in Compile).value.toMap,
4953
libraryDependencies ++= Settings.scalajsDependenciesLib.value,
50-
muiIconsGenerator := Settings.generateIcons(
54+
muiIconsGenerator := Generator.muiIcons(
5155
(sourceManaged in Compile).value / "io" / "kinoplan" / "scalajs" / "react" / "material" / "ui" / "icons",
5256
(npmInstallDependencies in Compile).value
5357
),
54-
sourceGenerators in Compile += muiIconsGenerator.taskValue
58+
sourceGenerators in Compile += muiIconsGenerator.taskValue,
59+
sources in(Compile, doc) := Seq.empty,
60+
publishArtifact in(Compile, packageDoc) := false,
5561
).enablePlugins(ScalaJSBundlerPlugin)
5662

57-
lazy val lab = (project in file("lab")).settings(commonSettings).settings(
63+
lazy val lab = (project in file("lab")).dependsOn(bridge)
64+
.settings(commonSettings).settings(
5865
name := "scalajs-react-material-ui-lab",
59-
scalaJSUseMainModuleInitializer := false,
66+
scalaJSUseMainModuleInitializer := false,
6067
npmDependencies in Compile ++= Settings.npmDependenciesLab.value,
61-
libraryDependencies ++= Settings.scalajsDependenciesLib.value
68+
npmResolutions in Compile ++= (npmDependencies in Compile).value.toMap,
69+
libraryDependencies ++= Settings.scalajsDependenciesLib.value,
70+
sources in(Compile, doc) := Seq.empty,
71+
publishArtifact in(Compile, packageDoc) := false,
6272
).enablePlugins(ScalaJSBundlerPlugin)
6373

64-
lazy val demo = (project in file("demo")).dependsOn(core, lab)
74+
lazy val demo = (project in file("demo")).dependsOn(core, lab, bridge)
6575
.settings(commonSettings).settings(
66-
scalaJSUseMainModuleInitializer := true,
76+
scalaJSUseMainModuleInitializer := true,
77+
scalaJSLinkerConfig ~= (_.withSourceMap(false)),
78+
stUseScalaJsDom := false,
79+
stFlavour := Flavour.Japgolly,
80+
stIgnore ++= Settings.stIgnore,
81+
stOutputPackage := "io.kinoplan.scalajs.react.libs.external",
6782
npmDependencies in Compile ++= Settings.npmDependenciesDemo.value,
83+
npmResolutions in Compile ++= (npmDependencies in Compile).value.toMap,
6884
libraryDependencies ++= Settings.scalajsDependenciesDemo.value,
69-
webpackDevServerExtraArgs := Seq("--inline"),
70-
yarnExtraArgs := Seq("--silent"),
71-
webpackConfigFile in fastOptJS := Some(baseDirectory.value / "dev.webpack.config.js"),
85+
webpackDevServerExtraArgs := Seq("--inline"),
86+
yarnExtraArgs := Seq("--silent"),
87+
webpackConfigFile in fastOptJS := Some(baseDirectory.value / "dev.webpack.config.js"),
7288
skip in publish := true
73-
).enablePlugins(ScalaJSBundlerPlugin)
89+
).enablePlugins(ScalaJSBundlerPlugin, ScalablyTypedConverterPlugin)
90+
91+
lazy val bridge = (project in file("utils/bridge")).settings(commonSettings).settings(
92+
name := "scalajs-react-bridge",
93+
scalaJSUseMainModuleInitializer := false,
94+
npmDependencies in Compile ++= Settings.npmDependenciesBridge.value,
95+
npmResolutions in Compile ++= (npmDependencies in Compile).value.toMap,
96+
libraryDependencies ++= Settings.scalajsDependenciesBridge.value
97+
).enablePlugins(ScalaJSBundlerPlugin, BridgeGeneratorPlugin)
7498

7599
lazy val commonSettings = Seq(
76100
version := Settings.version,
77-
scalaVersion := Settings.versions.scala,
101+
crossScalaVersions := Seq("2.12.11", "2.13.3"),
102+
scalaVersion := crossScalaVersions.value.last,
78103
organization := Settings.organization,
79104
description := Settings.description,
80105
homepage := Some(url("https://github.com/kinoplan/scalajs-react-material-ui")),
@@ -85,7 +110,23 @@ lazy val commonSettings = Seq(
85110
version in webpack := Settings.versions.bundler.webpack,
86111
version in startWebpackDevServer := Settings.versions.bundler.webpackDev,
87112
webpackCliVersion := Settings.versions.bundler.webpackCli,
88-
emitSourceMaps := false,
89113
javacOptions ++= Settings.javacOptions,
90-
scalacOptions in ThisBuild ++= Settings.scalacOptions
114+
scalacOptions ++= Settings.scalacOptions,
115+
scalacOptions ~= (_.filterNot(
116+
Set(
117+
"-Wdead-code",
118+
"-Wunused:params",
119+
"-Ywarn-dead-code",
120+
"-Ywarn-unused:params",
121+
"-Ywarn-unused:patvars",
122+
"-Wunused:explicits"
123+
)
124+
))
91125
)
126+
127+
onLoad in Global := (
128+
"project bridge" ::
129+
"bridgeImplicitsGenerator" ::
130+
"project root" ::
131+
(_: State)
132+
) compose (onLoad in Global).value

commands.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addCommandAlias("runDev", "; demo/fastOptJS::stopWebpackDevServer; ~demo/fastOptJS::startWebpackDevServer")

core/src/main/scala/io/kinoplan/scalajs/react/material/ui/core/JsWriterImplicits.scala

Lines changed: 0 additions & 15 deletions
This file was deleted.

core/src/main/scala/io/kinoplan/scalajs/react/material/ui/core/MuiAppBar.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.kinoplan.scalajs.react.material.ui.core
22

3-
import com.payalabs.scalajs.react.bridge.{ReactBridgeComponent, WithProps}
3+
import io.kinoplan.scalajs.react.bridge.{ReactBridgeComponent, WithProps}
44
import io.kinoplan.scalajs.react.material.ui.core.internal.PaperClassKey
55

66
import scala.scalajs.js
@@ -17,7 +17,7 @@ object MuiAppBar extends ReactBridgeComponent with MuiAppBarExtensions {
1717
classes: js.UndefOr[Map[ClassKey.Value, String]] = js.undefined,
1818
color: js.UndefOr[Color.Value] = js.undefined,
1919
position: js.UndefOr[Position.Value] = js.undefined,
20-
component: OptComponentPropType = js.undefined,
20+
component: js.UndefOr[ComponentPropType] = js.undefined,
2121
elevation: js.UndefOr[Int] = js.undefined,
2222
square: js.UndefOr[Boolean] = js.undefined
2323
): WithProps = auto

core/src/main/scala/io/kinoplan/scalajs/react/material/ui/core/MuiAvatar.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.kinoplan.scalajs.react.material.ui.core
22

3-
import com.payalabs.scalajs.react.bridge.{ReactBridgeComponent, WithProps}
3+
import io.kinoplan.scalajs.react.bridge.{ReactBridgeComponent, WithProps}
44

55
import scala.scalajs.js
66
import scala.scalajs.js.annotation.JSImport
@@ -14,7 +14,7 @@ object MuiAvatar extends ReactBridgeComponent with MuiAvatarExtensions {
1414

1515
def apply(
1616
classes: js.UndefOr[Map[ClassKey.Value, String]] = js.undefined,
17-
component: OptComponentPropType = js.undefined,
17+
component: js.UndefOr[ComponentPropType] = js.undefined,
1818
imgProps: js.UndefOr[js.Object] = js.undefined
1919
): WithProps = auto
2020
}

core/src/main/scala/io/kinoplan/scalajs/react/material/ui/core/MuiBackdrop.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.kinoplan.scalajs.react.material.ui.core
22

3-
import com.payalabs.scalajs.react.bridge.{ReactBridgeComponent, WithPropsNoChildren}
3+
import io.kinoplan.scalajs.react.bridge.{ReactBridgeComponent, WithPropsNoChildren}
44

55
import scala.scalajs.js
66
import scala.scalajs.js.annotation.JSImport

0 commit comments

Comments
 (0)