🎨 fix imports with new build script
This commit is contained in:
parent
826b2c9820
commit
41a193dff0
@ -22,7 +22,7 @@ const router: Router = Router();
|
|||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
||||||
export function isTextChannel(type: ChannelType): boolean {
|
function isTextChannel(type: ChannelType): boolean {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ChannelType.GUILD_STORE:
|
case ChannelType.GUILD_STORE:
|
||||||
case ChannelType.GUILD_VOICE:
|
case ChannelType.GUILD_VOICE:
|
||||||
@ -39,6 +39,7 @@ export function isTextChannel(type: ChannelType): boolean {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
module.exports.isTextChannel = isTextChannel;
|
||||||
|
|
||||||
export interface MessageCreateSchema {
|
export interface MessageCreateSchema {
|
||||||
content?: string;
|
content?: string;
|
||||||
|
@ -2,11 +2,11 @@ process.on("unhandledRejection", console.error);
|
|||||||
process.on("uncaughtException", console.error);
|
process.on("uncaughtException", console.error);
|
||||||
|
|
||||||
import http from "http";
|
import http from "http";
|
||||||
import { FosscordServer as APIServer } from "@fosscord/api";
|
import * as Api from "@fosscord/api";
|
||||||
import { Server as GatewayServer } from "@fosscord/gateway";
|
import * as Gateway from "@fosscord/gateway";
|
||||||
import { CDNServer } from "@fosscord/cdn/";
|
import { CDNServer } from "@fosscord/cdn/";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import { red, green, bold } from "nanocolors";
|
import { green, bold } from "nanocolors";
|
||||||
import { Config, initDatabase } from "@fosscord/util";
|
import { Config, initDatabase } from "@fosscord/util";
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
@ -16,11 +16,11 @@ const production = false;
|
|||||||
server.on("request", app);
|
server.on("request", app);
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const api = new APIServer({ server, port, production, app });
|
const api = new Api.FosscordServer({ server, port, production, app });
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const cdn = new CDNServer({ server, port, production, app });
|
const cdn = new CDNServer({ server, port, production, app });
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const gateway = new GatewayServer({ server, port, production });
|
const gateway = new Gateway.Server({ server, port, production });
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
await initDatabase();
|
await initDatabase();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// process.env.MONGOMS_DEBUG = "true";
|
// process.env.MONGOMS_DEBUG = "true";
|
||||||
const tsConfigPaths = require("tsconfig-paths");
|
const tsConfigPaths = require("tsconfig-paths");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const baseUrl = path.join(__dirname, ".."); // Either absolute or relative path. If relative it's resolved to current working directory.
|
const baseUrl = path.join(__dirname, "..");
|
||||||
const cleanup = tsConfigPaths.register({
|
const cleanup = tsConfigPaths.register({
|
||||||
baseUrl,
|
baseUrl,
|
||||||
paths: {
|
paths: {
|
||||||
@ -13,6 +13,7 @@ const cleanup = tsConfigPaths.register({
|
|||||||
"@fosscord/cdn/*": ["../cdn/dist/*"],
|
"@fosscord/cdn/*": ["../cdn/dist/*"],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
console.log(require("@fosscord/gateway"));
|
||||||
|
|
||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
import cluster from "cluster";
|
import cluster from "cluster";
|
||||||
@ -26,7 +27,7 @@ import { execSync } from "child_process";
|
|||||||
// TODO: add tcp socket event transmission
|
// TODO: add tcp socket event transmission
|
||||||
const cores = 1 || Number(process.env.threads) || os.cpus().length;
|
const cores = 1 || Number(process.env.threads) || os.cpus().length;
|
||||||
|
|
||||||
export function getCommitOrFail() {
|
function getCommitOrFail() {
|
||||||
try {
|
try {
|
||||||
return execSync("git rev-parse HEAD").toString().trim();
|
return execSync("git rev-parse HEAD").toString().trim();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -1 +1,4 @@
|
|||||||
export * from "./Server";
|
export * from "./Server";
|
||||||
|
export * from "./util/FileStorage";
|
||||||
|
export * from "./util/Storage";
|
||||||
|
export * from "./util/multer";
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { Router, Response, Request } from "express";
|
import { Router, Response, Request } from "express";
|
||||||
import { Config, Snowflake } from "@fosscord/util";
|
import { Config, Snowflake } from "@fosscord/util";
|
||||||
import { storage } from "@fosscord/cdn/util/Storage";
|
import { storage } from "@fosscord/cdn";
|
||||||
import FileType from "file-type";
|
import FileType from "file-type";
|
||||||
import { HTTPError } from "lambert-server";
|
import { HTTPError } from "lambert-server";
|
||||||
import { multer } from "@fosscord/cdn/util/multer";
|
import { multer } from "@fosscord/cdn";
|
||||||
import imageSize from "image-size";
|
import imageSize from "image-size";
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { Router, Response, Request } from "express";
|
import { Router, Response, Request } from "express";
|
||||||
import { Config, Snowflake } from "@fosscord/util";
|
import { Config, Snowflake } from "@fosscord/util";
|
||||||
import { storage } from "@fosscord/cdn/util/Storage";
|
import { storage } from "@fosscord/cdn";
|
||||||
import FileType from "file-type";
|
import FileType from "file-type";
|
||||||
import { HTTPError } from "lambert-server";
|
import { HTTPError } from "lambert-server";
|
||||||
import { multer } from "@fosscord/cdn/util/multer";
|
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
|
import { multer } from "../util/multer";
|
||||||
|
|
||||||
// TODO: check premium and animated pfp are allowed in the config
|
// TODO: check premium and animated pfp are allowed in the config
|
||||||
// TODO: generate different sizes of icon
|
// TODO: generate different sizes of icon
|
||||||
|
@ -2,7 +2,7 @@ import { Router, Response, Request } from "express";
|
|||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
import { HTTPError } from "lambert-server";
|
import { HTTPError } from "lambert-server";
|
||||||
import { Snowflake } from "@fosscord/util";
|
import { Snowflake } from "@fosscord/util";
|
||||||
import { storage } from "@fosscord/cdn/util/Storage";
|
import { storage } from "@fosscord/cdn";
|
||||||
import FileType from "file-type";
|
import FileType from "file-type";
|
||||||
import { Config } from "@fosscord/util";
|
import { Config } from "@fosscord/util";
|
||||||
|
|
||||||
|
3
cdn/src/util/index.ts
Normal file
3
cdn/src/util/index.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export * from "./FileStorage";
|
||||||
|
export * from "./multer";
|
||||||
|
export * from "./Storage";
|
@ -2,12 +2,12 @@ import "missing-native-js-functions";
|
|||||||
import dotenv from "dotenv";
|
import dotenv from "dotenv";
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
import { closeDatabase, Config, initDatabase, initEvent } from "@fosscord/util";
|
import { closeDatabase, Config, initDatabase, initEvent } from "@fosscord/util";
|
||||||
import { Server as WebSocketServer } from "ws";
|
import ws from "ws";
|
||||||
import { Connection } from "./events/Connection";
|
import { Connection } from "./events/Connection";
|
||||||
import http from "http";
|
import http from "http";
|
||||||
|
|
||||||
export class Server {
|
export class Server {
|
||||||
public ws: WebSocketServer;
|
public ws: ws.Server;
|
||||||
public port: number;
|
public port: number;
|
||||||
public server: http.Server;
|
public server: http.Server;
|
||||||
public production: boolean;
|
public production: boolean;
|
||||||
@ -39,7 +39,7 @@ export class Server {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.ws = new WebSocketServer({
|
this.ws = new ws.Server({
|
||||||
maxPayload: 4096,
|
maxPayload: 4096,
|
||||||
noServer: true,
|
noServer: true,
|
||||||
});
|
});
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
import WS from "ws";
|
import WS from "ws";
|
||||||
import {
|
import { WebSocket } from "@fosscord/gateway";
|
||||||
setHeartbeat,
|
import { Send } from "../util/Send";
|
||||||
Send,
|
import { CLOSECODES, OPCODES } from "../util/Constants";
|
||||||
CLOSECODES,
|
import { setHeartbeat } from "../util/Heartbeat";
|
||||||
OPCODES,
|
|
||||||
WebSocket,
|
|
||||||
} from "@fosscord/gateway";
|
|
||||||
import { IncomingMessage } from "http";
|
import { IncomingMessage } from "http";
|
||||||
import { Close } from "./Close";
|
import { Close } from "./Close";
|
||||||
import { Message } from "./Message";
|
import { Message } from "./Message";
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { WebSocket, Payload, CLOSECODES, OPCODES } from "@fosscord/gateway";
|
import { CLOSECODES, OPCODES } from "../util/Constants";
|
||||||
|
import { WebSocket, Payload } from "@fosscord/gateway";
|
||||||
var erlpack: any;
|
var erlpack: any;
|
||||||
try {
|
try {
|
||||||
erlpack = require("@yukikaze-bot/erlpack");
|
erlpack = require("@yukikaze-bot/erlpack");
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import {
|
import {
|
||||||
User,
|
|
||||||
getPermission,
|
getPermission,
|
||||||
Permissions,
|
Permissions,
|
||||||
Channel,
|
|
||||||
RabbitMQ,
|
RabbitMQ,
|
||||||
listenEvent,
|
listenEvent,
|
||||||
EventOpts,
|
EventOpts,
|
||||||
ListenEventOpts,
|
ListenEventOpts,
|
||||||
Member,
|
Member,
|
||||||
} from "@fosscord/util";
|
} from "@fosscord/util";
|
||||||
import { OPCODES, WebSocket, Send } from "@fosscord/gateway";
|
import { OPCODES } from "../util/Constants";
|
||||||
|
import { Send } from "../util/Send";
|
||||||
|
import { WebSocket } from "@fosscord/gateway";
|
||||||
import "missing-native-js-functions";
|
import "missing-native-js-functions";
|
||||||
import { Channel as AMQChannel } from "amqplib";
|
import { Channel as AMQChannel } from "amqplib";
|
||||||
import { Recipient } from "@fosscord/util";
|
import { Recipient } from "@fosscord/util";
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { Payload, Send, setHeartbeat, WebSocket } from "@fosscord/gateway";
|
import { Payload, WebSocket } from "@fosscord/gateway";
|
||||||
|
import { setHeartbeat } from "../util/Heartbeat";
|
||||||
|
import { Send } from "../util/Send";
|
||||||
|
|
||||||
export async function onHeartbeat(this: WebSocket, data: Payload) {
|
export async function onHeartbeat(this: WebSocket, data: Payload) {
|
||||||
// TODO: validate payload
|
// TODO: validate payload
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
|
import { WebSocket, Payload } from "@fosscord/gateway";
|
||||||
import {
|
import {
|
||||||
WebSocket,
|
|
||||||
CLOSECODES,
|
|
||||||
Payload,
|
|
||||||
OPCODES,
|
|
||||||
genSessionId,
|
|
||||||
} from "@fosscord/gateway";
|
|
||||||
import {
|
|
||||||
Channel,
|
|
||||||
checkToken,
|
checkToken,
|
||||||
Guild,
|
|
||||||
Intents,
|
Intents,
|
||||||
Member,
|
Member,
|
||||||
ReadyEventData,
|
ReadyEventData,
|
||||||
@ -16,16 +8,15 @@ import {
|
|||||||
Session,
|
Session,
|
||||||
EVENTEnum,
|
EVENTEnum,
|
||||||
Config,
|
Config,
|
||||||
dbConnection,
|
|
||||||
PublicMemberProjection,
|
|
||||||
PublicMember,
|
PublicMember,
|
||||||
ChannelType,
|
|
||||||
PublicUser,
|
PublicUser,
|
||||||
PrivateUserProjection,
|
PrivateUserProjection,
|
||||||
} from "@fosscord/util";
|
} from "@fosscord/util";
|
||||||
|
import { Send } from "../util/Send";
|
||||||
|
import { CLOSECODES, OPCODES } from "../util/Constants";
|
||||||
|
import { genSessionId } from "../util/SessionUtils";
|
||||||
import { setupListener } from "../listener/listener";
|
import { setupListener } from "../listener/listener";
|
||||||
import { IdentifySchema } from "../schema/Identify";
|
import { IdentifySchema } from "../schema/Identify";
|
||||||
import { Send } from "@fosscord/gateway/util/Send";
|
|
||||||
// import experiments from "./experiments.json";
|
// import experiments from "./experiments.json";
|
||||||
const experiments: any = [];
|
const experiments: any = [];
|
||||||
import { check } from "./instanceOf";
|
import { check } from "./instanceOf";
|
||||||
|
@ -5,7 +5,9 @@ import {
|
|||||||
Role,
|
Role,
|
||||||
} from "@fosscord/util";
|
} from "@fosscord/util";
|
||||||
import { LazyRequest } from "../schema/LazyRequest";
|
import { LazyRequest } from "../schema/LazyRequest";
|
||||||
import { WebSocket, Send, OPCODES, Payload } from "@fosscord/gateway";
|
import { Send } from "../util/Send";
|
||||||
|
import { OPCODES } from "../util/Constants";
|
||||||
|
import { WebSocket, Payload } from "@fosscord/gateway";
|
||||||
import { check } from "./instanceOf";
|
import { check } from "./instanceOf";
|
||||||
import "missing-native-js-functions";
|
import "missing-native-js-functions";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user