Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import jsbeautifier
import sys
import os
import random
filename = sys.argv[2]+"-"+str(os.times()[4])+"-"+str(random.randint(1,99999))+".txt"
os.system("copy NUL db/"+filename)
parser = open(sys.argv[1],"r")
body = parser.read().split('\r\n\r\n')
with open("db/"+filename,'w') as f:
f.write(body[1])
parser.close()
res = jsbeautifier.beautify_file("db/"+filename)
with open("db/"+filename,'w') as f:
f.write(res)
print filename
def build_theme(theme, output):
min_file_name = os.path.join(output, theme + '.min.js')
file_name = os.path.join(output, theme + '.js')
(err, output) = __compile(__get_theme_entry_point(theme), min_file_name, flag_file=CHECKS_FLAGS)
if len(output) > 0:
print output
try:
import jsbeautifier
res = jsbeautifier.beautify_file(min_file_name)
with open(file_name, 'w') as f:
f.write(res)
except ImportError:
raise ImportError('Please install jsbeautifier manually first.')
def clean_js(self, jsfile):
try:
res = jsbeautifier.beautify_file(jsfile)
if res:
fileWriter = open(jsfile, 'w')
fileWriter.write(res)
fileWriter.close()
print "Cleaned", jsfile
except Exception, e:
print e
# coding: u8
import jsbeautifier
opts = jsbeautifier.default_options()
opts.indent_size = 2
opts.break_chained_methods = True
opts.comma_first = True
min_js_file_path = '../wx7c8d593b2c3a7703_3.wxapkg.unpack/game.js'
res = jsbeautifier.beautify_file(min_js_file_path)
open('./game.beautified2.js', 'w').write(res)