defneProperty = JSBuilder.read(os.path.join("..", "src", "defineProperty.js")) for dirname, dirnames, filenames in os.walk("src"): for subdirname in dirnames: subdirname = "build/" + os.path.join(dirname, subdirname)[4:] if not os.path.exists(subdirname): os.makedirs(subdirname) for filename in filenames: if filename in ["yunode.js", "yuno.package.js", "defineProperty.js"]: continue filename = os.path.join(dirname, filename)[4:] print("") print("-----------------------") print(filename) print("-----------------------") JSBuilder.compile( copyright, os.path.join("build", filename), os.path.join("build", JSBuilder.replace(filename, [".js"], [".min.js"])), [filename], ["//:inject defineProperty.js"], [defneProperty], ) print("----------------------") print("") # let me read the result ... import time time.sleep(2)
copyright = '(C) @WebReflection - Mit Style License' import JSBuilder, string, re, os defneProperty = JSBuilder.read(os.path.join('..', 'src', 'defineProperty.js')) for dirname, dirnames, filenames in os.walk('src'): for subdirname in dirnames: subdirname = 'build/' + os.path.join(dirname, subdirname)[4:] if not os.path.exists(subdirname): os.makedirs(subdirname) for filename in filenames: if (filename in ["yunode.js", "yuno.package.js", "defineProperty.js"]): continue filename = os.path.join(dirname, filename)[4:] print("") print("-----------------------") print(filename) print("-----------------------") JSBuilder.compile( copyright, os.path.join('build', filename), os.path.join('build', JSBuilder.replace(filename, ['.js'], ['.min.js'])), [filename], ["//:inject defineProperty.js"], [defneProperty]) print("----------------------") print("") # let me read the result ... import time time.sleep(2)
JSBuilder.write('../build/wru.console.js', compiled) print ("----------------------") print ("") # web JSBuilder.write( '../build/template.html', JSBuilder.replace( JSBuilder.read('../src/template.html'), [ '{{CSS}}', '{{JS}}', 'var wru=', '}(this);' ], [ JSBuilder.read('../src/template.css'), JSBuilder.read('../build/wru.min.js'), 'wru(', '}(this));' ] ) ) # server JSBuilder.write( '../build/template.js', JSBuilder.replace( JSBuilder.read('../src/template.js'), [
compiled) compiled = re.sub(r'\w+=global.clearInterval=', 'clearInterval=global.clearInterval=', compiled) compiled = re.sub(r'\w+=global.clearTimeout=', 'clearTimeout=global.clearTimeout=', compiled) JSBuilder.write('../build/wru.console.js', compiled) print("----------------------") print("") # web JSBuilder.write( '../build/template.html', JSBuilder.replace( JSBuilder.read('../src/template.html'), ['{{CSS}}', '{{JS}}', 'var wru=', '}(this);'], [ JSBuilder.read('../src/template.css'), JSBuilder.read('../build/wru.min.js'), 'wru(', '}(this));' ])) # server JSBuilder.write( '../build/template.js', JSBuilder.replace( JSBuilder.read('../src/template.js'), ['{{JS}}', 'var wru=', '}(this);'], [JSBuilder.read('../build/wru.console.js'), 'wru(', '}(this));'])) # phantomjs JSBuilder.write( '../build/template.phantom.js', 'var page=new WebPage;page.open(phantom.args[0]||"about:blank",function(){page.evaluate(function(){'