Skip to content

Instantly share code, notes, and snippets.

@ptmt
ptmt / add_flow.sh
Created August 2, 2017 06:54 — forked from djoeman84/add_flow.sh
Add flow to all your JS files
#!/bin/bash
# Based on http://stackoverflow.com/questions/151677/tool-for-adding-license-headers-to-source-files
find . -type f -iname "*.js" -print0 | while IFS= read -r -d $'\0' i;
do
added=$(grep -q @flow $i)
if [[ (!$added) && ( $i != *"node_modules"* ) ]]
then
(echo "" & echo "/* @flow */") > flowificator
cat flowificator $i >$i.new && mv $i.new $i