Skip to content

Commit

Permalink
update to scalajs 1.0.0-M1
Browse files Browse the repository at this point in the history
  • Loading branch information
chandu0101 committed Jul 8, 2017
1 parent c666d06 commit 32b4a5b
Show file tree
Hide file tree
Showing 31 changed files with 2,587 additions and 478 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore" : ["sjs.test.js"]
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ npm-debug.log


#project
*.test.js
*.test.js.map
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ env:
JSENV=node

script:
- sbt ++$TRAVIS_SCALA_VERSION test:fastOptJS test:fullOptJS
- sbt ++$TRAVIS_SCALA_VERSION 'set parallelExecution in ThisBuild := false' test
- sbt ++$TRAVIS_SCALA_VERSION 'set parallelExecution in ThisBuild := false' 'set scalaJSStage in ThisBuild := FullOptStage' test

- sbt ++$TRAVIS_SCALA_VERSION testDev testProd

deploy:
provider: script
Expand Down
46 changes: 41 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name := "mobile"

//version := "2017.3.23-beta"
//version := "2017.7.0-SNAPSHOT"

enablePlugins(ScalaJSPlugin)

Expand All @@ -21,8 +21,9 @@ scalacOptions ++= Seq(

//Dependencies

libraryDependencies += "scalajs-react-interface" %%% "universal" % "2017.4.23-beta" % Provided
libraryDependencies += "scalajs-react-interface" %%% "core" % "2017.4.23-beta" % Provided
libraryDependencies ++= Seq(
"scalajs-react-interface" %%% "universal" % "2017.7.9-RC" % Provided,
"scalajs-react-interface" %%% "core" % "2017.7.9-RC" % Provided)

//bintray
resolvers += Resolver.jcenterRepo
Expand All @@ -42,5 +43,40 @@ publishArtifact in Test := false

//Test
resolvers += Resolver.bintrayRepo("scalajs-react-interface", "maven")
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.0.0" % Test
scalaJSStage in Global := FastOptStage
scalaJSUseMainModuleInitializer in Test := true

scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule))

val TEST_FILE = s"./sjs.test.js"

artifactPath in Test in fastOptJS := new File(TEST_FILE)
artifactPath in Test in fullOptJS := new File(TEST_FILE)

val testDev = Def.taskKey[Unit]("test in dev mode")
val testProd = Def.taskKey[Unit]("test in prod mode")

testDev := {
(fastOptJS in Test).value
runJest()
}

testProd := {
(fullOptJS in Test).value
runJest()
}

def runJest() = {
import sys.process._
val jestResult = "npm test".!
if (jestResult != 0) throw new IllegalStateException("Jest Suite failed")
}

resolvers += Resolver.bintrayRepo("scalajs-react-interface", "maven")
resolvers += Resolver.bintrayRepo("scalajs-jest", "maven")

libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.3" % Test,
"scalajs-jest" %%% "core" % "2017.7.9-beta" % Test
)
//scalaJSStage in Global := FastOptStage
scalaJSStage in Global := FullOptStage
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@
"url": ""
},
"scripts": {
"start": "webpack --watch & webpack-dev-server --progress --colors --port 8090",
"build": "webpack --watch"
},
"devDependencies": {
"jsdom-global": "2.1.1",
"jsdom": "^9.9.1"
"test": "jest"
},
"devDependencies": {},
"dependencies": {

"jest": "^20.0.4"
}
}
24 changes: 0 additions & 24 deletions project/DepsVerifyPlugin.scala

This file was deleted.

2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sbt.version=0.13.13
sbt.version=0.13.15

4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.15")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.0-M1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "1.1.1")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "1.3.0")
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")
10 changes: 0 additions & 10 deletions src/main/scala/sri/mobile/ReactNative.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,10 @@ trait ReactNative extends ReactUniversal {

}

@js.native
trait ReactPlatForm extends js.Object {
val OS: String = js.native
val Version: Double = js.native
}

@js.native
@JSImport("ReactNativeFeatureFlags", JSImport.Namespace)
object ReactNativeFeatureFlags extends js.Object {

var useFiber: Boolean = js.native

}

//@js.native
//@JSImport("react-native",JSImport.Namespace)
//object ReactNative extends ReactNative
18 changes: 9 additions & 9 deletions src/main/scala/sri/mobile/apis/android/DatePickerAndroid.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package sri.mobile.apis.android

import scala.scalajs.js
import scala.scalajs.js.Promise
import scala.scalajs.js.annotation.{JSImport, ScalaJSDefined}
import scala.scalajs.js.annotation.JSImport

@js.native
trait DatePickerAndroid extends js.Object {
Expand All @@ -11,14 +11,15 @@ trait DatePickerAndroid extends js.Object {

val dateSetAction: String = js.native

def open(options: DatePickerAndroidOptions): Promise[DatePickerAndroidResult] = js.native
def open(
options: DatePickerAndroidOptions): Promise[DatePickerAndroidResult] =
js.native
}

@js.native
@JSImport("react-native","DatePickerAndroid")
@JSImport("react-native", "DatePickerAndroid")
object DatePickerAndroid extends DatePickerAndroid

@ScalaJSDefined
trait DatePickerAndroidOptions extends js.Object {
var date: js.UndefOr[js.Date] = js.undefined
var minDate: js.UndefOr[js.Date] = js.undefined
Expand All @@ -30,15 +31,14 @@ trait DatePickerAndroidOptions extends js.Object {
trait DatePickerAndroidMode extends js.Object

object DatePickerAndroidMode {
val CALENDER = "calender".asInstanceOf[DatePickerAndroidMode]
val SPINNER = "spinner".asInstanceOf[DatePickerAndroidMode]
val DEFAULT = "default".asInstanceOf[DatePickerAndroidMode]
@inline def CALENDER = "calender".asInstanceOf[DatePickerAndroidMode]
@inline def SPINNER = "spinner".asInstanceOf[DatePickerAndroidMode]
@inline def DEFAULT = "default".asInstanceOf[DatePickerAndroidMode]
}

@ScalaJSDefined
trait DatePickerAndroidResult extends js.Object {
val action: String
val year: Int
val month: Int
val day: Int
}
}
10 changes: 5 additions & 5 deletions src/main/scala/sri/mobile/apis/android/TimerPickerAndroid.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package sri.mobile.apis.android

import scala.scalajs.js
import scala.scalajs.js.Promise
import scala.scalajs.js.annotation.{JSImport, ScalaJSDefined}
import scala.scalajs.js.annotation.JSImport

@js.native
trait TimerPickerAndroid extends js.Object {
Expand All @@ -11,14 +11,14 @@ trait TimerPickerAndroid extends js.Object {

val timeSetAction: String = js.native

def open(options: TimerPickerAndroidOptions): Promise[TimerPickerAndroidResponse] = js.native
def open(options: TimerPickerAndroidOptions)
: Promise[TimerPickerAndroidResponse] = js.native
}

@js.native
@JSImport("react-native","TimePickerAndroid")
@JSImport("react-native", "TimePickerAndroid")
object TimerPickerAndroid extends TimerPickerAndroid

@ScalaJSDefined
trait TimerPickerAndroidOptions extends js.Object {
var hour: js.UndefOr[Int] = js.undefined
var minute: js.UndefOr[Int] = js.undefined
Expand All @@ -30,4 +30,4 @@ trait TimerPickerAndroidResponse extends js.Object {
val action: String
val hour: Int
val minute: Int
}
}
9 changes: 3 additions & 6 deletions src/main/scala/sri/mobile/apis/ios/AlertIOSButton.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ package sri.mobile.apis.ios

import scala.scalajs.js
import scala.scalajs.js.Dynamic.{literal => json}
import scala.scalajs.js.annotation.ScalaJSDefined


@ScalaJSDefined
trait AlertIOSButton extends js.Object {
var text:String
var onPress : js.Function
}
var text: String
var onPress: js.Function
}
17 changes: 7 additions & 10 deletions src/main/scala/sri/mobile/apis/ios/PushNotificationIOS.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package sri.mobile.apis.ios

import scala.scalajs.js
import scala.scalajs.js.annotation.{JSImport, ScalaJSDefined}
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.{Promise, UndefOr}

@js.native
Expand All @@ -21,7 +21,8 @@ trait PushNotificationIOS extends js.Object {

def removeEventListener(tpe: String, handler: js.Function): Unit = js.native

def requestPermissions(permissions: Permissions = ???): Promise[Permissions] = js.native
def requestPermissions(
permissions: Permissions = ???): Promise[Permissions] = js.native

def popInitialNotification(): js.Dynamic = js.native

Expand All @@ -35,18 +36,14 @@ trait PushNotificationIOS extends js.Object {

def getBadgeCount(): UndefOr[Int] = js.native


}

@js.native
@JSImport("react-native","PushNotificationIOS")
@JSImport("react-native", "PushNotificationIOS")
object PushNotificationIOS extends PushNotificationIOS


@ScalaJSDefined
trait Permissions extends js.Object {
var alert : js.UndefOr[Boolean] = js.undefined
var badge : js.UndefOr[Boolean] = js.undefined
var sound : js.UndefOr[Boolean] = js.undefined
var alert: js.UndefOr[Boolean] = js.undefined
var badge: js.UndefOr[Boolean] = js.undefined
var sound: js.UndefOr[Boolean] = js.undefined
}

Loading

0 comments on commit 32b4a5b

Please sign in to comment.