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", key: "trySendConnData",
value: function trySendConnData() { value: function trySendConnData() {
if (this.token && this.websocket.readyState === WebSocket.OPEN && !this.alreadySentData) { if (this.token && !this.alreadySentData) {
this.alreadySentData = true; this.alreadySentData = true;

View File

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

View File

@@ -27,5 +27,12 @@
"dependencies": { "dependencies": {
"superagent": "^1.3.0", "superagent": "^1.3.0",
"ws": "^0.7.2" "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 //def trySendConnData
trySendConnData() { trySendConnData() {
if (this.token && this.websocket.readyState === WebSocket.OPEN && !this.alreadySentData) { if (this.token && !this.alreadySentData) {
this.alreadySentData = true; this.alreadySentData = true;

View File

@@ -2,5 +2,9 @@ var request = require("superagent");
var Endpoints = require("./Endpoints.js"); var Endpoints = require("./Endpoints.js");
var Client = require("./Client.js"); var Client = require("./Client.js");
exports.Endpoints = Endpoints; var Discord = {
exports.Client = Client; 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