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-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": {
|
||||
"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\"",
|
||||
"build": "rimraf dist && tsc",
|
||||
"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-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-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-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",
|
||||
"build": "tsc --build",
|
||||
"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 --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 --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\"",
|
||||
"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-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-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-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-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 --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 --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\"",
|
||||
"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-prod": "cross-env NODE_ENV=production 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-prod": "cross-env NODE_ENV=production 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",
|
||||
"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",
|
||||
"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 --enable-source-maps dist/backend/src/exportSchemas.js > ../config-schema.json",
|
||||
"test": "npm run build && npm run run-tests",
|
||||
"run-tests": "ava",
|
||||
"test-watch": "tsc-watch --onSuccess \"npx ava\""
|
||||
|
@ -45,7 +45,7 @@
|
|||
"fp-ts": "^2.0.1",
|
||||
"humanize-duration": "^3.15.0",
|
||||
"js-yaml": "^3.13.1",
|
||||
"knub": "^32.0.0-next.16",
|
||||
"knub": "^32.0.0-next.17",
|
||||
"knub-command-manager": "^9.1.0",
|
||||
"last-commit-log": "^2.1.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 { YAMLException } from "js-yaml";
|
||||
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 moment from "moment-timezone";
|
||||
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 { YAMLException } from "js-yaml";
|
||||
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 { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
|
||||
import { isStaff } from "../staff";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ApiPermissions } from "@shared/apiPermissions";
|
||||
import { ApiPermissions } from "@zeppelinbot/shared";
|
||||
import { Repository } from "typeorm";
|
||||
import { ApiAuditLog } from "./ApiAuditLog";
|
||||
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",
|
||||
configurationGuide: "Maximum deletion delay is currently 5 minutes",
|
||||
configSchema: zAutoDeleteConfig,
|
||||
},
|
||||
} as any,
|
||||
|
||||
dependencies: () => [TimeAndDatePlugin, LogsPlugin],
|
||||
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 { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { renderUsername } from "../../../utils";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ApiPermissions } from "@shared/apiPermissions";
|
||||
import { ApiPermissions } from "@zeppelinbot/shared";
|
||||
import moment from "moment-timezone";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
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 { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "NodeNext",
|
||||
"module": "NodeNext",
|
||||
"baseUrl": ".",
|
||||
"outDir": "./dist",
|
||||
"paths": {
|
||||
"@shared/*": ["../shared/src/*"]
|
||||
}
|
||||
"baseUrl": "./src",
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"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>
|
||||
|
||||
<script lang="ts">
|
||||
import { ApiPermissions, hasPermission } from "@shared/apiPermissions";
|
||||
import { ApiPermissions, hasPermission } from "@zeppelinbot/shared";
|
||||
import PermissionTree from "./PermissionTree.vue";
|
||||
import { mapState } from "vuex";
|
||||
import {
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { mapState } from "vuex";
|
||||
import { ApiPermissions, hasPermission } from "@shared/apiPermissions";
|
||||
import { ApiPermissions, hasPermission } from "@zeppelinbot/shared";
|
||||
import { AuthState, GuildState } from "../../store/types";
|
||||
import { ApiError, formPost } from "../../api";
|
||||
import moment from "moment";
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { mapState } from "vuex";
|
||||
import { ApiPermissions, hasPermission } from "@shared/apiPermissions";
|
||||
import { ApiPermissions, hasPermission } from "@zeppelinbot/shared";
|
||||
import { AuthState, GuildState } from "../../store/types";
|
||||
|
||||
export default {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
</style>
|
||||
|
||||
<script lang="ts">
|
||||
import { ApiPermissions, permissionNames } from "@shared/apiPermissions";
|
||||
import { ApiPermissions, permissionNames } from "@zeppelinbot/shared";
|
||||
import { PropType } from "vue";
|
||||
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 = {
|
||||
locked: boolean;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ApiPermissions } from "@shared/apiPermissions";
|
||||
import { ApiPermissions } from "@zeppelinbot/shared";
|
||||
|
||||
export enum LoadStatus {
|
||||
None = 1,
|
||||
|
|
|
@ -13,9 +13,12 @@
|
|||
"baseUrl": ".",
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"allowJs": true,
|
||||
"paths": {
|
||||
"@shared/*": ["../shared/src/*"]
|
||||
"allowJs": true
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../shared/tsconfig.json"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
20339
package-lock.json
generated
20339
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -32,5 +32,10 @@
|
|||
"prettier --write",
|
||||
"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",
|
||||
"description": "",
|
||||
"private": true,
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"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": {
|
||||
"moduleResolution": "NodeNext",
|
||||
"module": "NodeNext",
|
||||
"baseUrl": "src",
|
||||
"outDir": "./dist"
|
||||
"baseUrl": "./src",
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
|
||||
"composite": true,
|
||||
"declaration": true
|
||||
},
|
||||
"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": {
|
||||
"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
|
||||
}
|
||||
"files": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./shared/tsconfig.json"
|
||||
},
|
||||
{
|
||||
"path": "./backend/tsconfig.json"
|
||||
},
|
||||
{
|
||||
"path": "./dashboard/tsconfig.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue