Skip to content

Instantly share code, notes, and snippets.

@uzeyirdestan
Created February 2, 2020 10:46
Show Gist options
  • Save uzeyirdestan/f6f5b6c9de3c9e9ca083653615c47527 to your computer and use it in GitHub Desktop.
Save uzeyirdestan/f6f5b6c9de3c9e9ca083653615c47527 to your computer and use it in GitHub Desktop.
React index.android.bundle nicer script
#!/usr/bin/python3
#React index.android.bundle nicer script
#You need to install jsnice tool in order to work.
#Author: Uzeyir Destan
import sys
import os
if len(sys.argv) < 2:
print("Usage is %s <file to parse>" % (sys.argv[0]))
sys.exit(0)
i=0
with open(sys.argv[1]) as fp:
line = fp.readline()
print(line)
name = "%s.%04d"%(sys.argv[1],i)
tmp = open(name,"w")
tmp.write(line)
tmp.close()
command="jsnice %s | tee -a source.js" % name
os.system(command)
while line:
i = i + 1
line = fp.readline()
print(line)
name = "%s.%04d"%(sys.argv[1],i)
tmp = open(name,"w")
tmp.write(line)
tmp.close()
command="jsnice %s | tee -a source.js" % name
os.system(command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment