File size: 674 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#!/usr/bin/env python
import os
import sys
import repoutils
if not os.getcwd().endswith('/scripts'):
print('[Error] Please run this script from the scripts dir!')
sys.exit(1)
def fileNameOperator(filePath, fileName):
if not fileName.endswith('.react.js'):
return True
moduleName = fileName.replace('.react.js', '')
modulePath = filePath.replace('.js', '').replace('../src', '.')
statement = 'import {} from "{}";'.format(moduleName, modulePath)
imports.append(statement)
return True
imports = []
repoutils.walkLibFileNames(fileNameOperator, None, None)
print('// @flow\n\n{}'.format('\n'.join(imports)))
|