Skip to content

Commit b7effbf

Browse files
committed
Build
1 parent 0ca0b03 commit b7effbf

File tree

5 files changed

+76
-12
lines changed

5 files changed

+76
-12
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
node_modules/
1+
build/node_modules
2+
node_modules
23
build/output

build/build.js

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
var request = require('superagent');
2+
var fs = require('fs-extra');
3+
var http = require('http-get');
4+
var rjs = require('requirejs');
5+
var knox = require('knox');
6+
var glob = require("glob")
7+
8+
9+
10+
var version = Date.now();
11+
var outputFolder = 'output/version/' + version
12+
console.log('Building client');
13+
var startTime = Date.now();
14+
15+
fs.removeSync('output');
16+
fs.mkdirSync('output');
17+
fs.mkdirSync('output/version');
18+
fs.mkdirSync(outputFolder);
19+
var rootPath = '..';
20+
rjs.optimize({
21+
name: 'almond',
22+
include: ['main'],
23+
out: outputFolder + '/js/main.js',
24+
findNestedDependencies: true,
25+
mainConfigFile: rootPath + '/js/main.js',
26+
wrap: true
27+
});
28+
var index = fs.readFileSync(rootPath + '/index.html', 'ascii');
29+
index = index.replace('js/libs/require/require.js', 'version/' + version + '/js/main.js');
30+
index = index.replace('css/styles.css', 'version/' + version + '/css/styles.css');
31+
index = index.replace(' data-main="js/main"', '');
32+
fs.writeFileSync('output/index.html', index);
33+
rjs.optimize({
34+
cssIn: rootPath + '/css/styles.css',
35+
out: outputFolder + '/css/styles.css'
36+
});
37+
fs.copy(rootPath + '/googleaa49fe030680ef6c.html', 'output/googleaa49fe030680ef6c.html', function (){
38+
fs.copy(rootPath + '/favicon.ico', 'output/favicon.ico', function (){
39+
fs.copy(rootPath + '/img', outputFolder +'/img', function () {
40+
fs.copy(rootPath + '/css/Aller_Std_Rg.ttf', outputFolder +'/css/Aller_Std_Rg.ttf', function () {
41+
var endTime = (Date.now() - startTime) / 1000;
42+
43+
});
44+
});
45+
});
46+
});
47+

build/package.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"dependencies": {
3+
"superagent": "~0.8.1",
4+
"fs-extra": "~0.1.3",
5+
"requirejs": "~2.0.6",
6+
"knox": "~0.3.0",
7+
"http-get": "~0.4.2",
8+
"glob": "~3.1.12"
9+
}
10+
}

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
<script type="text/javascript">try{ clicky.init(66632578); }catch(e){}</script>
1717

1818
</body>
19-
</html>
19+
</html>

package.json

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
{
2-
"name": "apiengine-client"
3-
, "version": "0.0.1"
4-
, "description": "ApiEngine is going to kick ass"
5-
, "keywords": ["api", "rest"]
6-
, "author": "Thomas Davis <[email protected]>"
7-
, "main": "index"
8-
, "scripts": {
2+
"name": "apiengine-client",
3+
"version": "0.0.1",
4+
"description": "ApiEngine is going to kick ass",
5+
"keywords": [
6+
"api",
7+
"rest"
8+
],
9+
"author": "Thomas Davis <[email protected]>",
10+
"main": "index",
11+
"scripts": {
912
"test": "make test"
10-
}
11-
, "devDependencies": {
13+
},
14+
"devDependencies": {
1215
"mocha": "1.3.0",
1316
"w3cjs": "0.1.6"
17+
},
18+
"dependencies": {
19+
"superagent": "~0.8.1"
1420
}
15-
}
21+
}

0 commit comments

Comments
 (0)