Use Flow to typecheck JavaScript code.

Change-Id: I9c0c9b5aa74d592a04eb6533e64669f1896fb7cd
diff --git a/build.gradle b/build.gradle
index 6274531..773eb8e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -129,8 +129,20 @@
   commandLine "yarn", "run", "snowpack", "--optimize"
 }
 
+task flow(type:Exec) {
+  def resourceDir = "src/main/resources/META-INF/resources"
+
+  onlyIf { !project.hasProperty('skipWeb') }
+
+  dependsOn snowpack
+
+  workingDir resourceDir
+  commandLine "yarn", "run", "flow", "--color=always"
+}
+
 task compileWeb {
   dependsOn snowpack
+  dependsOn flow
 
   doLast {}
 }