Rewrite hook as a node script to fix prepare on windows.