mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-14 21:31:50 +00:00
refactor: use npm workspaces and ts project references
This commit is contained in:
parent
ffa9eeb3f5
commit
7cd56303fc
30 changed files with 20303 additions and 24327 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -85,3 +85,5 @@ npm-audit.txt
|
||||||
|
|
||||||
config-errors.txt
|
config-errors.txt
|
||||||
/config-schema.json
|
/config-schema.json
|
||||||
|
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
9127
backend/package-lock.json
generated
9127
backend/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -6,26 +6,26 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"watch": "cross-env NODE_ENV=development tsc-watch --onSuccess \"node start-dev.js\"",
|
"watch": "cross-env NODE_ENV=development tsc-watch --onSuccess \"node start-dev.js\"",
|
||||||
"watch-yaml-parse-test": "cross-env NODE_ENV=development tsc-watch --onSuccess \"node dist/backend/src/yamlParseTest.js\"",
|
"watch-yaml-parse-test": "cross-env NODE_ENV=development tsc-watch --onSuccess \"node dist/backend/src/yamlParseTest.js\"",
|
||||||
"build": "rimraf dist && tsc",
|
"build": "tsc --build",
|
||||||
"start-bot-dev": "cross-env NODE_ENV=development node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9229 dist/backend/src/index.js",
|
"start-bot-dev": "cross-env NODE_ENV=development node --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9229 dist/backend/src/index.js",
|
||||||
"start-bot-dev-debug": "NODE_ENV=development DEBUG=true clinic heapprofiler --collect-only --dest .clinic-bot -- node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9229 dist/backend/src/index.js",
|
"start-bot-dev-debug": "NODE_ENV=development DEBUG=true clinic heapprofiler --collect-only --dest .clinic-bot -- node --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9229 dist/backend/src/index.js",
|
||||||
"start-bot-prod": "cross-env NODE_ENV=production node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/index.js",
|
"start-bot-prod": "cross-env NODE_ENV=production node --enable-source-maps --stack-trace-limit=30 dist/backend/src/index.js",
|
||||||
"start-bot-prod-debug": "NODE_ENV=production DEBUG=true clinic heapprofiler --collect-only --dest .clinic-bot -- node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/index.js",
|
"start-bot-prod-debug": "NODE_ENV=production DEBUG=true clinic heapprofiler --collect-only --dest .clinic-bot -- node --enable-source-maps --stack-trace-limit=30 dist/backend/src/index.js",
|
||||||
"watch-bot": "cross-env NODE_ENV=development tsc-watch --onSuccess \"npm run start-bot-dev\"",
|
"watch-bot": "cross-env NODE_ENV=development tsc-watch --onSuccess \"npm run start-bot-dev\"",
|
||||||
"start-api-dev": "cross-env NODE_ENV=development node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9239 dist/backend/src/api/index.js",
|
"start-api-dev": "cross-env NODE_ENV=development node --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9239 dist/backend/src/api/index.js",
|
||||||
"start-api-dev-debug": "NODE_ENV=development DEBUG=true clinic heapprofiler --collect-only --dest .clinic-api -- node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9239 dist/backend/src/api/index.js",
|
"start-api-dev-debug": "NODE_ENV=development DEBUG=true clinic heapprofiler --collect-only --dest .clinic-api -- node --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9239 dist/backend/src/api/index.js",
|
||||||
"start-api-prod": "cross-env NODE_ENV=production node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/api/index.js",
|
"start-api-prod": "cross-env NODE_ENV=production node --enable-source-maps --stack-trace-limit=30 dist/backend/src/api/index.js",
|
||||||
"start-api-prod-debug": "NODE_ENV=production DEBUG=true clinic heapprofiler --collect-only --dest .clinic-api -- node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/api/index.js",
|
"start-api-prod-debug": "NODE_ENV=production DEBUG=true clinic heapprofiler --collect-only --dest .clinic-api -- node --enable-source-maps --stack-trace-limit=30 dist/backend/src/api/index.js",
|
||||||
"watch-api": "cross-env NODE_ENV=development tsc-watch --onSuccess \"npm run start-api-dev\"",
|
"watch-api": "cross-env NODE_ENV=development tsc-watch --onSuccess \"npm run start-api-dev\"",
|
||||||
"typeorm": "node -r ./register-tsconfig-paths.js ./node_modules/typeorm/cli.js",
|
"typeorm": "node ./node_modules/typeorm/cli.js",
|
||||||
"migrate": "npm run typeorm -- migration:run -d dist/backend/src/data/dataSource.js",
|
"migrate": "npm run typeorm -- migration:run -d dist/backend/src/data/dataSource.js",
|
||||||
"migrate-prod": "cross-env NODE_ENV=production npm run migrate",
|
"migrate-prod": "cross-env NODE_ENV=production npm run migrate",
|
||||||
"migrate-dev": "cross-env NODE_ENV=development npm run build && npm run migrate",
|
"migrate-dev": "cross-env NODE_ENV=development npm run build && npm run migrate",
|
||||||
"migrate-rollback": "npm run typeorm -- migration:revert -d dist/backend/src/data/dataSource.js",
|
"migrate-rollback": "npm run typeorm -- migration:revert -d dist/backend/src/data/dataSource.js",
|
||||||
"migrate-rollback-prod": "cross-env NODE_ENV=production npm run migrate",
|
"migrate-rollback-prod": "cross-env NODE_ENV=production npm run migrate",
|
||||||
"migrate-rollback-dev": "cross-env NODE_ENV=development npm run build && npm run migrate",
|
"migrate-rollback-dev": "cross-env NODE_ENV=development npm run build && npm run migrate",
|
||||||
"validate-active-configs": "cross-env NODE_ENV=development node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps dist/backend/src/validateActiveConfigs.js > ../config-errors.txt",
|
"validate-active-configs": "cross-env NODE_ENV=development node --enable-source-maps dist/backend/src/validateActiveConfigs.js > ../config-errors.txt",
|
||||||
"export-config-json-schema": "cross-env NODE_ENV=development node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps dist/backend/src/exportSchemas.js > ../config-schema.json",
|
"export-config-json-schema": "cross-env NODE_ENV=development node --enable-source-maps dist/backend/src/exportSchemas.js > ../config-schema.json",
|
||||||
"test": "npm run build && npm run run-tests",
|
"test": "npm run build && npm run run-tests",
|
||||||
"run-tests": "ava",
|
"run-tests": "ava",
|
||||||
"test-watch": "tsc-watch --onSuccess \"npx ava\""
|
"test-watch": "tsc-watch --onSuccess \"npx ava\""
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
"fp-ts": "^2.0.1",
|
"fp-ts": "^2.0.1",
|
||||||
"humanize-duration": "^3.15.0",
|
"humanize-duration": "^3.15.0",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
"knub": "^32.0.0-next.16",
|
"knub": "^32.0.0-next.17",
|
||||||
"knub-command-manager": "^9.1.0",
|
"knub-command-manager": "^9.1.0",
|
||||||
"last-commit-log": "^2.1.0",
|
"last-commit-log": "^2.1.0",
|
||||||
"lodash.chunk": "^4.2.0",
|
"lodash.chunk": "^4.2.0",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ApiPermissions } from "@shared/apiPermissions";
|
import { ApiPermissions } from "@zeppelinbot/shared";
|
||||||
import express, { Request, Response } from "express";
|
import express, { Request, Response } from "express";
|
||||||
import { YAMLException } from "js-yaml";
|
import { YAMLException } from "js-yaml";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ApiPermissions } from "@shared/apiPermissions";
|
import { ApiPermissions } from "@zeppelinbot/shared";
|
||||||
import express, { Request, Response } from "express";
|
import express, { Request, Response } from "express";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ApiPermissions } from "@shared/apiPermissions";
|
import { ApiPermissions } from "@zeppelinbot/shared";
|
||||||
import express, { Request, Response } from "express";
|
import express, { Request, Response } from "express";
|
||||||
import { YAMLException } from "js-yaml";
|
import { YAMLException } from "js-yaml";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ApiPermissions, hasPermission, permissionArrToSet } from "@shared/apiPermissions";
|
import { ApiPermissions, hasPermission, permissionArrToSet } from "@zeppelinbot/shared";
|
||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
|
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
|
||||||
import { isStaff } from "../staff";
|
import { isStaff } from "../staff";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ApiPermissions } from "@shared/apiPermissions";
|
import { ApiPermissions } from "@zeppelinbot/shared";
|
||||||
import { Repository } from "typeorm";
|
import { Repository } from "typeorm";
|
||||||
import { ApiAuditLog } from "./ApiAuditLog";
|
import { ApiAuditLog } from "./ApiAuditLog";
|
||||||
import { BaseRepository } from "./BaseRepository";
|
import { BaseRepository } from "./BaseRepository";
|
||||||
|
|
|
@ -24,7 +24,7 @@ export const AutoDeletePlugin = zeppelinGuildPlugin<AutoDeletePluginType>()({
|
||||||
description: "Allows Zeppelin to auto-delete messages from a channel after a delay",
|
description: "Allows Zeppelin to auto-delete messages from a channel after a delay",
|
||||||
configurationGuide: "Maximum deletion delay is currently 5 minutes",
|
configurationGuide: "Maximum deletion delay is currently 5 minutes",
|
||||||
configSchema: zAutoDeleteConfig,
|
configSchema: zAutoDeleteConfig,
|
||||||
},
|
} as any,
|
||||||
|
|
||||||
dependencies: () => [TimeAndDatePlugin, LogsPlugin],
|
dependencies: () => [TimeAndDatePlugin, LogsPlugin],
|
||||||
configParser: (input) => zAutoDeleteConfig.parse(input),
|
configParser: (input) => zAutoDeleteConfig.parse(input),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ApiPermissions } from "@shared/apiPermissions";
|
import { ApiPermissions } from "@zeppelinbot/shared";
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||||
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||||
import { renderUsername } from "../../../utils";
|
import { renderUsername } from "../../../utils";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ApiPermissions } from "@shared/apiPermissions";
|
import { ApiPermissions } from "@zeppelinbot/shared";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ApiPermissions } from "@shared/apiPermissions";
|
import { ApiPermissions } from "@zeppelinbot/shared";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||||
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
{
|
{
|
||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "NodeNext",
|
||||||
"module": "NodeNext",
|
"module": "NodeNext",
|
||||||
"baseUrl": ".",
|
"baseUrl": "./src",
|
||||||
"outDir": "./dist",
|
"rootDir": "./src",
|
||||||
"paths": {
|
"outDir": "./dist"
|
||||||
"@shared/*": ["../shared/src/*"]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts"]
|
"include": ["src/**/*.ts", "src/**/*.json"],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../shared/tsconfig.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
11819
dashboard/package-lock.json
generated
11819
dashboard/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -100,7 +100,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ApiPermissions, hasPermission } from "@shared/apiPermissions";
|
import { ApiPermissions, hasPermission } from "@zeppelinbot/shared";
|
||||||
import PermissionTree from "./PermissionTree.vue";
|
import PermissionTree from "./PermissionTree.vue";
|
||||||
import { mapState } from "vuex";
|
import { mapState } from "vuex";
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { mapState } from "vuex";
|
import { mapState } from "vuex";
|
||||||
import { ApiPermissions, hasPermission } from "@shared/apiPermissions";
|
import { ApiPermissions, hasPermission } from "@zeppelinbot/shared";
|
||||||
import { AuthState, GuildState } from "../../store/types";
|
import { AuthState, GuildState } from "../../store/types";
|
||||||
import { ApiError, formPost } from "../../api";
|
import { ApiError, formPost } from "../../api";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { mapState } from "vuex";
|
import { mapState } from "vuex";
|
||||||
import { ApiPermissions, hasPermission } from "@shared/apiPermissions";
|
import { ApiPermissions, hasPermission } from "@zeppelinbot/shared";
|
||||||
import { AuthState, GuildState } from "../../store/types";
|
import { AuthState, GuildState } from "../../store/types";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ApiPermissions, permissionNames } from "@shared/apiPermissions";
|
import { ApiPermissions, permissionNames } from "@zeppelinbot/shared";
|
||||||
import { PropType } from "vue";
|
import { PropType } from "vue";
|
||||||
import { TPermissionHierarchyWithState } from "./permissionTreeUtils";
|
import { TPermissionHierarchyWithState } from "./permissionTreeUtils";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ApiPermissions, hasPermission, TPermissionHierarchy } from "@shared/apiPermissions";
|
import { ApiPermissions, hasPermission, TPermissionHierarchy } from "@zeppelinbot/shared";
|
||||||
|
|
||||||
export type TPermissionHierarchyState = {
|
export type TPermissionHierarchyState = {
|
||||||
locked: boolean;
|
locked: boolean;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ApiPermissions } from "@shared/apiPermissions";
|
import { ApiPermissions } from "@zeppelinbot/shared";
|
||||||
|
|
||||||
export enum LoadStatus {
|
export enum LoadStatus {
|
||||||
None = 1,
|
None = 1,
|
||||||
|
|
|
@ -13,9 +13,12 @@
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"allowJs": true,
|
"allowJs": true
|
||||||
"paths": {
|
},
|
||||||
"@shared/*": ["../shared/src/*"]
|
"include": ["src/**/*.ts"],
|
||||||
}
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../shared/tsconfig.json"
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
20333
package-lock.json
generated
20333
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -32,5 +32,10 @@
|
||||||
"prettier --write",
|
"prettier --write",
|
||||||
"git add"
|
"git add"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"workspaces": [
|
||||||
|
"shared",
|
||||||
|
"backend",
|
||||||
|
"dashboard"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
1
shared/.gitignore
vendored
Normal file
1
shared/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/dist
|
3190
shared/package-lock.json
generated
3190
shared/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -3,6 +3,8 @@
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"types": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "ava"
|
"test": "ava"
|
||||||
},
|
},
|
||||||
|
|
1
shared/src/index.ts
Normal file
1
shared/src/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export * from "./apiPermissions";
|
|
@ -1,10 +1,14 @@
|
||||||
{
|
{
|
||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "NodeNext",
|
||||||
"module": "NodeNext",
|
"module": "NodeNext",
|
||||||
"baseUrl": "src",
|
"baseUrl": "./src",
|
||||||
"outDir": "./dist"
|
"rootDir": "./src",
|
||||||
|
"outDir": "./dist",
|
||||||
|
|
||||||
|
"composite": true,
|
||||||
|
"declaration": true
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts"]
|
"include": ["src/**/*.ts"]
|
||||||
}
|
}
|
||||||
|
|
19
tsconfig.base.json
Normal file
19
tsconfig.base.json
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"target": "esnext",
|
||||||
|
"lib": ["es2023"],
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"alwaysStrict": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strict": true,
|
||||||
|
"strictPropertyInitialization": false,
|
||||||
|
"useUnknownInCatchVariables": false
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +1,14 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"files": [],
|
||||||
"noImplicitAny": false,
|
"references": [
|
||||||
"allowSyntheticDefaultImports": true,
|
{
|
||||||
"experimentalDecorators": true,
|
"path": "./shared/tsconfig.json"
|
||||||
"emitDecoratorMetadata": true,
|
},
|
||||||
"target": "esnext",
|
{
|
||||||
"lib": ["es2023"],
|
"path": "./backend/tsconfig.json"
|
||||||
"resolveJsonModule": true,
|
},
|
||||||
"esModuleInterop": true,
|
{
|
||||||
"sourceMap": true,
|
"path": "./dashboard/tsconfig.json"
|
||||||
"alwaysStrict": true,
|
|
||||||
"noImplicitThis": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"strict": true,
|
|
||||||
"strictPropertyInitialization": false,
|
|
||||||
"useUnknownInCatchVariables": false
|
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue