forked from ArkahnX/JS13KGames-2015
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dist.js
65 lines (63 loc) · 2.8 KB
/
dist.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
var fs = require("fs");
var exists = fs.existsSync("D:/GitHub/JS13KGames-2015/dist/archive.zip");
if (exists) {
// fs.truncateSync(rootDir + endFile+".temp");
fs.unlinkSync("D:/GitHub/JS13KGames-2015/dist/archive.zip");
}
// var AdmZip = require('adm-zip');
// var zip = new AdmZip();
// zip.addLocalFile("D:/GitHub/JS13KGames-2015/build/game.json","game.json");
// zip.addLocalFile("D:/GitHub/JS13KGames-2015/build/preview.svg","preview.svg");
// zip.addLocalFile("D:/GitHub/JS13KGames-2015/build/game/server.js","game/server.js");
// zip.addLocalFile("D:/GitHub/JS13KGames-2015/build/game/shared.js","game/shared.js");
// zip.addLocalFile("D:/GitHub/JS13KGames-2015/build/game/client.js","game/client.js");
// zip.addLocalFile("D:/GitHub/JS13KGames-2015/build/game/index.html","game/index.html");
// zip.addLocalFile("D:/GitHub/JS13KGames-2015/build/game/package.json","game/package.json");
// zip.addLocalFile("D:/GitHub/JS13KGames-2015/build/game/power.gif","game/power.gif");
// zip.addLocalFile("D:/GitHub/JS13KGames-2015/build/game/g.css","game/g.css");
// zip.writeZip("D:/GitHub/JS13KGames-2015/dist/archive.zip","game.json");
var archiver = require('archiver');
var output = fs.createWriteStream("D:/GitHub/JS13KGames-2015/dist/simple-construction.zip");
output.on('close', function() {
console.log(archive.pointer() + ' total bytes');
console.log('archiver has been finalized and the output file descriptor has closed.');
});
var archive = archiver('zip'); // or archiver('zip', {});
archive.on('error', function(err) {
throw err;
});
archive.pipe(output);
archive.append(fs.createReadStream("D:/GitHub/JS13KGames-2015/build/game.json"), {
name: "game.json"
});
archive.append(fs.createReadStream("D:/GitHub/JS13KGames-2015/build/preview.svg"), {
name: "preview.svg"
});
archive.append(fs.createReadStream("D:/GitHub/JS13KGames-2015/build/game/server.js"), {
name: "game/server.js"
});
archive.append(fs.createReadStream("D:/GitHub/JS13KGames-2015/build/game/client.js"), {
name: "game/client.js"
});
archive.append(fs.createReadStream("D:/GitHub/JS13KGames-2015/build/game/shared.js"), {
name: "game/shared.js"
});
archive.append(fs.createReadStream("D:/GitHub/JS13KGames-2015/build/game/index.html"), {
name: "game/index.html"
});
archive.append(fs.createReadStream("D:/GitHub/JS13KGames-2015/build/game/package.json"), {
name: "game/package.json"
});
archive.append(fs.createReadStream("D:/GitHub/JS13KGames-2015/build/game/power.gif"), {
name: "game/power.gif"
});
// archive.append(fs.createReadStream("D:/GitHub/JS13KGames-2015/build/game/tree2.gif"), {
// name: "game/tree2.gif"
// });
// archive.append(fs.createReadStream("D:/GitHub/JS13KGames-2015/build/game/grass.gif"), {
// name: "game/grass.gif"
// });
archive.append(fs.createReadStream("D:/GitHub/JS13KGames-2015/build/game/g.css"), {
name: "game/g.css"
});
archive.finalize();