Public Repository

Last pushed: a year ago
Short Description
Flow for Windows via Docker. Until Flow provides Windows binaries.
Full Description

Just an up to date fork of https://github.com/motiz88/flow-docker.

Script that will flow a folder.
This script accepts arguments. You can run it with babel-node flow.js [args].

It has been tested in Windows 10 with cmd, PowerShell and MINGW64 ("Git for Windows" Bash prompt).

import { execFileSync } from "child_process"
import flowBin from "flow-bin"

const execOpts = { stdio: "inherit" }

// Accept arguments
const argv = process.argv.slice(2)

// <WINDOWS>
//
// Should work in cmd/PowerShell/MNGW64 with or without TTY (via winpty)
//
// @todo remove this when flow offers native bin for windows
// https://github.com/facebook/flow/issues/6#issuecomment-229050447
// see also https://github.com/motiz88/flow-docker
if (process.platform === "win32") {
  // const path = "/" + process.cwd().replace(":\\", "\\").replace("\\", "/")
  const path = process.cwd()
  const dockerArgs = [
    "run", "--rm", "-it", "-v", path + ":/app", // docker run args
    "moox/flow", // hub moox/flow instead of motiz88/flow to use flow 0.27.0
    "flow", // the command !
  ]
  console.log("Running flow via docker...")
  try {
    // cmd or powershell (provided by Windows)
    execFileSync("docker", [ ...dockerArgs, ...argv ], execOpts)
  }
  catch (e) {
    if (e.message.indexOf("input device is not a TTY")) {
      // mingw64 (provided with "Git for Windows")
      execFileSync("winpty", [ "docker", ...dockerArgs, ...argv ], execOpts)
    }
    else {
      throw e
    }
  }
}
else
// </WINDOWS>

execFileSync(flowBin, argv, execOpts)
Docker Pull Command
Owner
moox

Comments (0)