-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
quick build script to bundle everything together for the web
- Loading branch information
Showing
6 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pkg/ | ||
tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "thirdparty/browser-require"] | ||
path = thirdparty/browser-require | ||
url = https://github.com/rsms/browser-require.git | ||
[submodule "node_modules/uglify-js"] | ||
path = node_modules/uglify-js | ||
url = https://github.com/mishoo/UglifyJS.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,53 @@ | ||
var DEPLOY = __dirname + "/pkg/"; | ||
|
||
desc("runs build"); | ||
task('default', ['build'], function () {}); | ||
|
||
desc("clean"); | ||
task('clean', [], function () { | ||
var childProcess = require('child_process'); | ||
|
||
var cmd = 'rm -rf ' + DEPLOY + ' && ' + | ||
'mkdir ' + DEPLOY; | ||
|
||
childProcess.exec(cmd, complete); | ||
}, true); | ||
|
||
desc("compiles the source files for all extensions"); | ||
task('build', [], function () { | ||
task('build', ['clean'], function () { | ||
|
||
var util = require('util'), | ||
fs = require('fs'); | ||
fs = require('fs'), | ||
files = [ | ||
"lib/Channel.js", | ||
"lib/utils.js", | ||
"lib/exec/blackberry.js" | ||
], | ||
include = function (files, transform) { | ||
files = files.map ? files : [files]; | ||
return files.map(function (file) { | ||
var str = fs.readFileSync(file, "utf-8") + "\n"; | ||
return transform ? transform(str, file) : str; | ||
}).join('\n'); | ||
} | ||
output = ""; | ||
|
||
//include require | ||
output += include("thirdparty/browser-require/require.js"); | ||
|
||
//include modules | ||
output += include(files, function (file, path) { | ||
return "require.define('" + path.replace(/lib\//, "phonegap/").replace(/\.js$/, '') + | ||
"', function (require, module, exports) {\n" + file + "});\n"; | ||
}); | ||
|
||
//include phonegap | ||
output += include('lib/phonegap.js', function (file, path) { | ||
return "require.define('phonegap'" + | ||
", function (require, module, exports) {\n" + file + "});\n"; | ||
}); | ||
|
||
fs.writeFileSync(__dirname + "/pkg/phonegap.js", output); | ||
|
||
util.puts(fs.readFileSync("build/dalek", "utf-8")); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<html> | ||
<head> | ||
<script type="text/javascript" src="../pkg/phonegap.js"></script> | ||
</head> | ||
<body> | ||
<div> | ||
So this file is just something to include phonegap.js and play with it. I know right! #EPIC | ||
</div> | ||
</body> | ||
</html> |
Submodule browser-require
added at
0f1c1f