Added web and grunt scripts

This commit is contained in:
hydrabolt
2015-08-27 21:21:35 +01:00
parent 96846654df
commit 6b3cbdbde8
16 changed files with 3415 additions and 15 deletions

48
gruntfile.js Normal file
View File

@@ -0,0 +1,48 @@
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// define source files and their destinations
babel: {
dist: {
files: [{
expand: true,
cwd: "src/",
src: ["**.*"],
dest: "lib/",
ext: ".js"
}]
}
},
browserify: {
dist: {
files: {
'web-dist/discord.js': ["lib/index.js"],
},
options: {
browserifyOptions: {
standalone: "Discord"
}
}
}
},
uglify: {
min: {
files: {
"./web-dist/discord.min.js": "./web-dist/discord.js"
}
}
}
});
// load plugins
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
// register at least this one task
grunt.registerTask('default', ['babel']);
grunt.registerTask('web', ['browserify', "uglify"]);
};

View File

@@ -1265,7 +1265,7 @@ var Client = (function () {
key: "trySendConnData",
value: function trySendConnData() {
if (this.token && this.websocket.readyState === WebSocket.OPEN && !this.alreadySentData) {
if (this.token && !this.alreadySentData) {
this.alreadySentData = true;
@@ -1433,4 +1433,4 @@ function getGateway() {
});
}
module.exports = Client;
module.exports = Client;

View File

@@ -10,4 +10,4 @@ exports.LOGIN = exports.AUTH + "/login";
exports.LOGOUT = exports.AUTH + "/logout";
exports.USERS = exports.API + "/users";
exports.SERVERS = exports.API + "/guilds";
exports.CHANNELS = exports.API + "/channels";
exports.CHANNELS = exports.API + "/channels";

View File

@@ -58,4 +58,4 @@ var PMChannel = (function () {
return PMChannel;
})();
module.exports = PMChannel;
module.exports = PMChannel;

View File

@@ -76,4 +76,4 @@ var Channel = (function () {
return Channel;
})();
module.exports = Channel;
module.exports = Channel;

View File

@@ -4,5 +4,9 @@ var request = require("superagent");
var Endpoints = require("./Endpoints.js");
var Client = require("./Client.js");
exports.Endpoints = Endpoints;
exports.Client = Client;
var Discord = {
Endpoints: Endpoints,
Client: Client
};
module.exports = Discord;

View File

@@ -200,4 +200,4 @@ Internal.XHR.setUsername = function (token, avatar, email, newPassword, password
});
};
exports.Internal = Internal;
exports.Internal = Internal;

View File

@@ -32,4 +32,4 @@ var Invite = (function () {
return Invite;
})();
module.exports = Invite;
module.exports = Invite;

View File

@@ -69,4 +69,4 @@ var Message = (function () {
return Message;
})();
module.exports = Message;
module.exports = Message;

View File

@@ -170,4 +170,4 @@ var Server = (function () {
return Server;
})();
module.exports = Server;
module.exports = Server;

View File

@@ -53,4 +53,4 @@ var User = (function () {
return User;
})();
module.exports = User;
module.exports = User;

View File

@@ -27,5 +27,12 @@
"dependencies": {
"superagent": "^1.3.0",
"ws": "^0.7.2"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-babel": "^5.0.1",
"grunt-browserify": "^4.0.0",
"grunt-contrib-uglify": "^0.9.2",
"load-grunt-tasks": "^3.2.0"
}
}

View File

@@ -1045,7 +1045,7 @@ class Client {
//def trySendConnData
trySendConnData() {
if (this.token && this.websocket.readyState === WebSocket.OPEN && !this.alreadySentData) {
if (this.token && !this.alreadySentData) {
this.alreadySentData = true;

View File

@@ -2,5 +2,9 @@ var request = require("superagent");
var Endpoints = require("./Endpoints.js");
var Client = require("./Client.js");
exports.Endpoints = Endpoints;
exports.Client = Client;
var Discord = {
Endpoints : Endpoints,
Client : Client
}
module.exports = Discord;

3335
web-dist/discord.js Normal file

File diff suppressed because it is too large Load Diff

2
web-dist/discord.min.js vendored Normal file

File diff suppressed because one or more lines are too long