diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 00000000..1ddf16e7
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,20 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "node",
+ "request": "launch",
+ "name": "Launch Program",
+ "skipFiles": [
+ "<node_internals>/**"
+ ],
+ "program": "${file}",
+ "outFiles": [
+ "${workspaceFolder}/**/*.js"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/fosscord-server.code-workspace b/fosscord-server.code-workspace
index 4a7440f6..1d6774ad 100644
--- a/fosscord-server.code-workspace
+++ b/fosscord-server.code-workspace
@@ -1,22 +1,16 @@
{
"folders": [
{
- "path": "bundle"
+ "path": "src/"
},
{
- "path": "api"
+ "path": "assets/"
},
{
- "path": "cdn"
+ "path": "scripts/"
},
{
- "path": "gateway"
- },
- {
- "path": "util"
- },
- {
- "path": "plugins"
+ "path": "."
}
],
"settings": {
@@ -26,18 +20,6 @@
".prettierrc": true,
".vscode": true,
"*.ansi": true,
- "benchmarks": true,
- "database.db": true,
- "files/": true,
- "jest": true,
- "locales/[!e]*": true,
- "locales/e[!n]*": true,
- "node_modules": true,
- "package-lock.json": true,
- "patches": true,
- "README.md": true,
- "tests/": true,
- "tsconfig.tsbuildinfo": true
}
}
-}
+}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index a97e75be..2da3174e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -7,6 +7,7 @@
"": {
"name": "@fosscord/server",
"version": "1.0.0",
+ "hasInstallScript": true,
"license": "AGPL-3.0-only",
"dependencies": {
"@aws-sdk/client-s3": "^3.137.0",
@@ -68,7 +69,7 @@
"supertest": "^6.1.6",
"ts-node": "^10.2.1",
"ts-node-dev": "^2.0.0",
- "ts-patch": "^2.0.1",
+ "ts-patch": "^2.0.2",
"typescript": "^4.2.3",
"typescript-json-schema": "^0.54.0"
},
@@ -12125,18 +12126,18 @@
}
},
"node_modules/ts-patch": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/ts-patch/-/ts-patch-2.0.1.tgz",
- "integrity": "sha512-mP7beU1QkmyDs1+SzXYVaSTD6Xo7ZCibOJ3sZkb/xsQjoAQXvn4oPjk0keC2LfCNAgilqtqgjiWp3pQri1uz4w==",
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/ts-patch/-/ts-patch-2.0.2.tgz",
+ "integrity": "sha512-NbgdS/J/ylaARJVaF1w4cPw378yvw6C1026fU5NKC2GO4jCwRlkuE/G7gwknNMHwkAOhwamKjuzkuLw/u4KlBg==",
"dev": true,
"dependencies": {
- "chalk": "^4.1.0",
- "glob": "^7.1.7",
+ "chalk": "^4.1.2",
+ "glob": "^8.0.3",
"global-prefix": "^3.0.0",
- "minimist": "^1.2.5",
- "resolve": "^1.20.0",
- "shelljs": "^0.8.4",
- "strip-ansi": "^6.0.0"
+ "minimist": "^1.2.6",
+ "resolve": "^1.22.1",
+ "shelljs": "^0.8.5",
+ "strip-ansi": "^6.0.1"
},
"bin": {
"ts-patch": "bin/cli.js"
@@ -12160,6 +12161,15 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
+ "node_modules/ts-patch/node_modules/brace-expansion": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
+ "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+ "dev": true,
+ "dependencies": {
+ "balanced-match": "^1.0.0"
+ }
+ },
"node_modules/ts-patch/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -12194,6 +12204,25 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
+ "node_modules/ts-patch/node_modules/glob": {
+ "version": "8.0.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
+ "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==",
+ "dev": true,
+ "dependencies": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^5.0.1",
+ "once": "^1.3.0"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
"node_modules/ts-patch/node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -12203,6 +12232,18 @@
"node": ">=8"
}
},
+ "node_modules/ts-patch/node_modules/minimatch": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
+ "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
+ "dev": true,
+ "dependencies": {
+ "brace-expansion": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/ts-patch/node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@@ -22153,18 +22194,18 @@
}
},
"ts-patch": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/ts-patch/-/ts-patch-2.0.1.tgz",
- "integrity": "sha512-mP7beU1QkmyDs1+SzXYVaSTD6Xo7ZCibOJ3sZkb/xsQjoAQXvn4oPjk0keC2LfCNAgilqtqgjiWp3pQri1uz4w==",
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/ts-patch/-/ts-patch-2.0.2.tgz",
+ "integrity": "sha512-NbgdS/J/ylaARJVaF1w4cPw378yvw6C1026fU5NKC2GO4jCwRlkuE/G7gwknNMHwkAOhwamKjuzkuLw/u4KlBg==",
"dev": true,
"requires": {
- "chalk": "^4.1.0",
- "glob": "^7.1.7",
+ "chalk": "^4.1.2",
+ "glob": "^8.0.3",
"global-prefix": "^3.0.0",
- "minimist": "^1.2.5",
- "resolve": "^1.20.0",
- "shelljs": "^0.8.4",
- "strip-ansi": "^6.0.0"
+ "minimist": "^1.2.6",
+ "resolve": "^1.22.1",
+ "shelljs": "^0.8.5",
+ "strip-ansi": "^6.0.1"
},
"dependencies": {
"ansi-styles": {
@@ -22176,6 +22217,15 @@
"color-convert": "^2.0.1"
}
},
+ "brace-expansion": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
+ "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+ "dev": true,
+ "requires": {
+ "balanced-match": "^1.0.0"
+ }
+ },
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -22201,12 +22251,34 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
+ "glob": {
+ "version": "8.0.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
+ "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^5.0.1",
+ "once": "^1.3.0"
+ }
+ },
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true
},
+ "minimatch": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
+ "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
+ "dev": true,
+ "requires": {
+ "brace-expansion": "^2.0.1"
+ }
+ },
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
diff --git a/scripts/depcheck.js b/scripts/depcheck.js
index 1957f794..08df156c 100644
--- a/scripts/depcheck.js
+++ b/scripts/depcheck.js
@@ -4,7 +4,7 @@ const { env } = require("process");
const { execSync } = require("child_process");
const { argv, stdout, exit } = require("process");
-const { execIn, getLines, parts } = require("./utils");
+const { execIn, getLines } = require("./utils");
let npmi_extra_flags = "";
diff --git a/scripts/depclean.js b/scripts/depclean.js
index 830081b9..333f5aa0 100644
--- a/scripts/depclean.js
+++ b/scripts/depclean.js
@@ -4,62 +4,59 @@ const { env } = require("process");
const { execSync } = require("child_process");
const { argv, stdout, exit } = require("process");
-const { execIn, getLines, parts } = require('./utils');
+const { execIn, getLines } = require('./utils');
const bundleRequired = ["@ovos-media/ts-transform-paths"];
const removeModules = argv.includes("cleanup");
-parts.forEach((part) => {
- console.log(`Installing all packages for ${part}...`);
- execIn("npm i", path.join(__dirname, "..", "..", part));
-});
+console.log(`Installing all packages...`);
+execIn("npm i", path.join(__dirname, ".."));
+
+let partDir = path.join(__dirname, "..");
+let distDir = path.join(partDir, "dist");
+let start = 0;
+start = getLines(
+ execIn("npm ls --parseable --package-lock-only -a", partDir)
+);
+if (fs.existsSync(distDir))
+ fs.rmSync(distDir, {
+ recursive: true,
+ force: true,
+ });
+let x = {
+ dependencies: [],
+ devDependencies: [],
+ invalidDirs: [],
+ invalidFiles: [],
+ missing: [],
+ using: [],
+};
+let dcproc = execIn("npx depcheck --json", partDir);
+if(dcproc.stdout) x = JSON.parse(dcproc.stdout);
+else x = JSON.parse(dcproc);
+
+fs.writeFileSync(
+ path.join(__dirname, "..", `depclean.out.json`),
+ JSON.stringify(x, null, "\t"),
+ { encoding: "utf8" }
+);
+
+let depsToRemove = x.dependencies.join(" ");
+if (depsToRemove) execIn(`npm r --save ${depsToRemove}`, partDir);
+
+depsToRemove = x.devDependencies.join(" ");
+if (depsToRemove) execIn(`npm r --save --dev ${depsToRemove}`, partDir);
+
+if (removeModules && fs.existsSync(path.join(partDir, "node_modules")))
+ fs.rmSync(path.join(partDir, "node_modules"), {
+ recursive: true,
+ force: true,
+ });
+let end = getLines(
+ execIn("npm ls --parseable --package-lock-only -a", partDir)
+);
+console.log(`${part}: ${start} -> ${end} (diff: ${start - end})`);
-parts.forEach((part) => {
- let partDir = path.join(__dirname, "..", "..", part);
- let distDir = path.join(partDir, "dist");
- let start = 0;
- start = getLines(
- execIn("npm ls --parseable --package-lock-only -a", partDir)
- );
- if (fs.existsSync(distDir))
- fs.rmSync(distDir, {
- recursive: true,
- force: true,
- });
- let x = {
- dependencies: [],
- devDependencies: [],
- invalidDirs: [],
- invalidFiles: [],
- missing: [],
- using: [],
- };
- let dcproc = execIn("npx depcheck --json", partDir);
- if(dcproc.stdout) x = JSON.parse(dcproc.stdout);
- else x = JSON.parse(dcproc);
-
- fs.writeFileSync(
- path.join(__dirname, "..", `depclean.out.${part}.json`),
- JSON.stringify(x, null, "\t"),
- { encoding: "utf8" }
- );
-
- let depsToRemove = x.dependencies.join(" ");
- if (depsToRemove) execIn(`npm r --save ${depsToRemove}`, partDir);
-
- depsToRemove = x.devDependencies.join(" ");
- if (depsToRemove) execIn(`npm r --save --dev ${depsToRemove}`, partDir);
-
- if (removeModules && fs.existsSync(path.join(partDir, "node_modules")))
- fs.rmSync(path.join(partDir, "node_modules"), {
- recursive: true,
- force: true,
- });
- let end = getLines(
- execIn("npm ls --parseable --package-lock-only -a", partDir)
- );
- console.log(`${part}: ${start} -> ${end} (diff: ${start - end})`);
-});
console.log("Installing required packages for bundle...");
execIn(`npm i --save ${bundleRequired.join(" ")}`, path.join(__dirname, ".."));
diff --git a/scripts/install.js b/scripts/install.js
deleted file mode 100644
index db9dadbc..00000000
--- a/scripts/install.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const path = require("path");
-const fs = require("fs");
-const parts = ["api", "util", "cdn", "gateway"];
-
-const bundle = require("../package.json");
-
-for (const part of parts) {
- const { devDependencies, dependencies } = require(path.join(
- "..",
- "..",
- part,
- "package.json"
- ));
- bundle.devDependencies = { ...bundle.devDependencies, ...devDependencies };
- bundle.dependencies = { ...bundle.dependencies, ...dependencies };
- delete bundle.dependencies["@fosscord/util"];
-}
-
-fs.writeFileSync(
- path.join(__dirname, "..", "package.json"),
- JSON.stringify(bundle, null, "\t"),
- { encoding: "utf8" }
-);
diff --git a/scripts/rights.js b/scripts/rights.js
index c363b0c5..20fd139c 100644
--- a/scripts/rights.js
+++ b/scripts/rights.js
@@ -6,7 +6,7 @@ const { argv, stdout, exit } = require("process");
const { execIn, getLines, parts } = require("./utils");
-let lines = fs.readFileSync(path.join(__dirname, "..", "..", "util", "src","util","Rights.ts")).toString()
+let lines = fs.readFileSync(path.join(__dirname, "..", "src", "util", "util","Rights.ts")).toString()
let lines2 = lines.split("\n");
let lines3 = lines2.filter(y=>y.includes(": BitFlag("));
let lines4 = lines3.map(x=>x.split("//")[0].trim())
diff --git a/scripts/update_schemas.js b/scripts/update_schemas.js
index a018120b..361bedc1 100644
--- a/scripts/update_schemas.js
+++ b/scripts/update_schemas.js
@@ -6,4 +6,4 @@ const { argv, stdout, exit } = require("process");
const { execIn, getLines, parts } = require("./utils");
-execIn("node scripts/generate_schema.js", path.join("..", "api"));
\ No newline at end of file
+execIn("node scripts/generate_schema.js", path.join('.'));
\ No newline at end of file
diff --git a/scripts/utils.js b/scripts/utils.js
index f4b1ad7f..ca41bcf2 100644
--- a/scripts/utils.js
+++ b/scripts/utils.js
@@ -4,8 +4,6 @@ const { env } = require("process");
const { execSync } = require("child_process");
const { argv, stdout, exit } = require("process");
-const parts = ["api", "util", "cdn", "gateway", "bundle"];
-
function copyRecursiveSync(src, dest) {
//if (verbose) console.log(`cpsync: ${src} -> ${dest}`);
let exists = fs.existsSync(src);
|