Skip to content

Commit

Permalink
Move node.js/npm build stuff into utils/, also output npm package int…
Browse files Browse the repository at this point in the history
…o build/npm (WIP)
  • Loading branch information
sole committed Jun 4, 2013
1 parent b52334d commit 1c97a06
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .gitignore
@@ -1,2 +1 @@
nodejs/index.js
nodejs/README.md
build/npm*
2 changes: 1 addition & 1 deletion build/tween.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions utils/builder.py
Expand Up @@ -3,19 +3,26 @@

source = '../src/Tween.js'
output = '../build/tween.min.js'
nodeOutput = '../nodejs/index.js'
NPM_DIR = '../build/npm/'
readme = '../README.md'
nodeReadme = '../nodejs/README.md'
nodeOutput = NPM_DIR + 'index.js'
nodeReadme = NPM_DIR + 'README.md'
srcJSON = './npm/package.json'
dstJSON = NPM_DIR + 'package.json'

os.system( 'java -jar compiler/compiler.jar --language_in=ECMASCRIPT5_STRICT --js ' + source + ' --js_output_file ' + output )

# header

# Add header with library name and url to the compressed output
with open(output,'r') as f: text = f.read()
with open(output,'w') as f: f.write('// tween.js - http://github.com/sole/tween.js\n' + text)

# Build npm package for node.js
if not os.path.exists(NPM_DIR):
os.makedirs(NPM_DIR)

shutil.copyfile(source, nodeOutput)
shutil.copyfile(readme, nodeReadme)
shutil.copyfile(srcJSON, dstJSON)

with open(nodeOutput,'r') as f: text = f.read()
with open(nodeOutput,'w') as f: f.write('// tween.js - http://github.com/sole/tween.js\n' + text + '\nmodule.exports=TWEEN;')
4 changes: 2 additions & 2 deletions nodejs/package.json → utils/npm/package.json
@@ -1,7 +1,7 @@
{
"name": "tween",
"name": "tween.js",
"description": "Super simple, fast and easy to use tweening engine which incorporates optimised Robert Penner's equations.",
"version": "0.10.0",
"version": "0.11.0",
"homepage": "https://github.com/sole/tween.js",
"repository": {
"type": "git",
Expand Down

0 comments on commit 1c97a06

Please sign in to comment.