mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
Added web and grunt scripts
This commit is contained in:
48
gruntfile.js
Normal file
48
gruntfile.js
Normal 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"]);
|
||||||
|
|
||||||
|
};
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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
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
2
web-dist/discord.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user