refactor(multi): plugification

This commit is contained in:
Ben Allfree
2024-06-26 21:23:55 -07:00
parent c821258dea
commit e6355c1aea
591 changed files with 4970 additions and 8911 deletions

View File

@@ -2,10 +2,10 @@
"$schema": "https://unpkg.com/@changesets/config@3.0.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"fixed": [["*"]],
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"access": "public",
"baseBranch": "plugified",
"updateInternalDependencies": "minor",
"ignore": []
}

3
.gitignore vendored
View File

@@ -14,4 +14,5 @@ live-data
dist
.pockethost
.scripts
*.tgz
*.tgz
.turbo

View File

@@ -1,6 +1,6 @@
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "master" ]; then
pnpm check:types
pnpm build-frontends
# pnpm check:types
# pnpm build-frontends
fi

View File

@@ -6,13 +6,11 @@ module.exports = {
'always',
[
'root',
'dashboard',
'lander',
'superadmin',
'pockethost',
'common',
'ga',
'plugin-console-logger',
'console-logger',
'auto-admin',
'launcher-spawn',
'multi',
],
],
'scope-empty': [2, 'never'],

View File

@@ -20,9 +20,11 @@
"gobot",
"goja",
"IPCIDR",
"ipcountry",
"jsonifiable",
"Jsonifiable",
"lemonbot",
"listr",
"maildev",
"maxsize",
"memorystream",
@@ -40,6 +42,7 @@
"pbgo",
"PBOUNCE",
"pexec",
"plugified",
"pocketbase",
"pockethost",
"POCKETSTREAM",
@@ -47,6 +50,7 @@
"rizzdown",
"Rpcs",
"semvers",
"sslify",
"superadmin",
"syslogd",
"tailable",
@@ -59,6 +63,7 @@
"Unwatching",
"unzipper",
"upserting",
"Vhosts",
"Virtio"
]
}

View File

@@ -11,10 +11,8 @@
"pockethost": "dist/index.mjs"
},
"scripts": {
"check:types": "concurrently 'pnpm:check:types:*'",
"check:types:dashboard": "cd packages/dashboard && pnpm check:types",
"check:types:superadmin": "cd packages/superadmin && pnpm check:types",
"check:types:pockethost": "cd packages/pockethost && pnpm check:types",
"sherif": "sherif",
"sherif:fix": "sherif --fix",
"lint": "prettier -c \"./**/*.{ts,js,cjs,svelte,json}\"",
"lint:fix": "prettier -w \"./**/*.{ts,js,cjs,svelte,json}\"",
"build": "concurrently 'pnpm:build:*'",
@@ -29,8 +27,6 @@
"dev:superadmin": "cd packages/superadmin && pnpm dev",
"prod:cli": "cd packages/pockethost && pnpm start",
"plop": "plop --no-progress",
"nofile": "cat /proc/sys/fs/file-nr",
"mail": "tsx ./packages/pockethost/src/cli/sendmail.ts",
"gobot:download": "gobot download pocketbase",
"gobot:download:all": "gobot download pocketbase --g-use-version='*'",
"prepare": "husky"
@@ -48,52 +44,12 @@
},
"type": "module",
"devDependencies": {
"@changesets/cli": "^2.27.5",
"@types/node-os-utils": "^1.3.4",
"@types/winston-syslog": "^2.4.3",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@swc/cli": "^0.1.62",
"@swc/core": "^1.3.95",
"@types/bootstrap": "^5.2.8",
"@types/copyfiles": "^2.4.4",
"@types/cors": "^2.8.17",
"@types/d3-scale": "^4.0.6",
"@types/d3-scale-chromatic": "^3.0.1",
"@types/decompress": "^4.2.6",
"@types/dockerode": "^3.3.21",
"@types/eventsource": "^1.1.14",
"@types/express": "^4.17.21",
"@types/express-sslify": "^1.2.5",
"@types/http-proxy": "^1.17.13",
"@types/inquirer": "^9.0.7",
"@types/js-cookie": "^3.0.5",
"@types/js-yaml": "^4.0.9",
"@types/json-stringify-safe": "^5.0.2",
"@types/marked": "^4.3.2",
"@types/memorystream": "^0.3.3",
"@types/ncp": "^2.0.8",
"@types/node": "^20.8.10",
"@types/semver": "^7.5.4",
"@types/tail": "^2.2.2",
"@types/tmp": "^0.2.5",
"@types/unzipper": "^0.10.8",
"@types/vhost": "^3.0.9",
"chokidar-cli": "^3.0.0",
"concurrently": "^8.2.2",
"copyfiles": "^2.4.1",
"date-fns": "^2.30.0",
"dotenv-cli": "^7.3.0",
"esbuild": "^0.20.0",
"esbuild-node-externals": "^1.13.0",
"express": "^4.18.2",
"http-proxy-middleware": "^2.0.6",
"chalk": "^5.3.0",
"commitlint": "^19.3.0",
"husky": "^9.0.11",
"inquirer": "^9.2.15",
"ip-cidr": "^3.1.0",
"js-yaml": "^4.1.0",
"ncp": "^2.0.0",
"nodemon": "^3.0.3",
"ora": "^7.0.1",
"plop": "^4.0.0",
"postinstall-postinstall": "^2.1.0",
@@ -102,10 +58,11 @@
"prettier-plugin-organize-imports": "^3.2.3",
"prettier-plugin-svelte": "^3.0.3",
"rizzdown": "^0.0.7",
"svelte": "^4.2.2",
"sherif": "^0.8.4",
"tslib": "^2.6.2",
"tsx": "^3.14.0",
"type-fest": "^4.6.0",
"turbo": "^2.0.4",
"typescript": "^5.2.2"
}
},
"packageManager": "pnpm@9.4.0+sha256.b6fd0bfda555e7e584ad7e56b30c68b01d5a04f9ee93989f4b93ca8473c49c74",
"private": true
}

View File

@@ -0,0 +1,5 @@
*
!**/*.ts
!package.json
!readme.md
!LICENSE.md

View File

@@ -22,3 +22,25 @@ export type UserFields = BaseFields & {
subscription: SubscriptionType
notifyMaintenanceMode: boolean
}
export type InstanceFieldExtensions = {
uid: UserId
status: InstanceStatus
maintenance: boolean
suspension: string
syncAdmin: boolean
cname: string
dev: boolean
cname_active: boolean
notifyMaintenanceMode: boolean
}
export type WithUser = {
expand: { uid: UserFields }
}
export type InstanceFields_WithUser = InstanceFields & WithUser
export type InstanceFields_Create = Omit<InstanceFields, keyof BaseFields>
export type InstanceRecordsById = { [_: RecordId]: InstanceFields }

View File

@@ -1,10 +1,10 @@
{
"name": "@pockethost/dashboard",
"version": "1.0.0-rc.1",
"name": "@pockethost/mothership-dashboard",
"version": "0.0.1",
"private": true,
"main": "./src/app.html",
"scripts": {
"check:types": "svelte-check",
"check-types": "svelte-check",
"preview": "npx http-server@latest ../../dist/dashboard -P \"http://localhost:8080?\"",
"dev": "vite dev --force --host=0.0.0.0 --port=5174",
"build": "NODE_ENV=production vite build",
@@ -14,15 +14,15 @@
"type": "module",
"devDependencies": {
"@microsoft/fetch-event-source": "https://github.com/pockethost/fetch-event-source.git#ebe3b7122647b48b93fd11effbbfb915d98956b0",
"pockethost": "workspace:../pockethost",
"@pockethost/plugin-console-logger": "workspace:^",
"@s-libs/micro-dash": "^16.1.0",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.25.2",
"@tailwindcss/typography": "^0.5.10",
"@types/bootstrap": "^5.2.6",
"@types/d3-scale": "^4.0.3",
"@types/d3-scale-chromatic": "^3.0.0",
"@types/js-cookie": "^3.0.2",
"@types/d3-scale": "^4.0.6",
"@types/d3-scale-chromatic": "^3.0.1",
"@types/js-cookie": "^3.0.5",
"autoprefixer": "^10.4.16",
"boolean": "^3.2.0",
"chart.js": "4.4.0",
@@ -38,7 +38,9 @@
"svelte-highlight": "^7.3.0",
"svelte-preprocess": "^5.0.4",
"tailwindcss": "^3.3.3",
"typescript": "^5.4.5",
"vite": "^4.4.9",
"@pockethost/plugin-console-logger": "link:../plugin-console-logger"
"pocketbase": "^0.21.3",
"pockethost": "workspace:^"
}
}

View File

@@ -1,12 +1,11 @@
import Ajv, { JSONSchemaType } from 'ajv'
import PocketBase, { ClientResponseError } from 'pocketbase'
import type { JsonObject } from 'type-fest'
import {
ClientResponseError,
LoggerService,
PocketBase,
RestCommands,
RestMethods,
} from '..'
} from '../../../pockethost/src/common'
export type RestHelperConfig = {
client: PocketBase

View File

@@ -1,16 +1,12 @@
import { INSTANCE_URL } from '$src/env'
import { createGenericSyncEvent } from '$util/events'
import { fetchEventSource } from '@microsoft/fetch-event-source'
import { keys, map } from '@s-libs/micro-dash'
import PocketBase, { BaseAuthStore, type AuthModel } from 'pocketbase'
import {
AuthModel,
BaseAuthStore,
ClientResponseError,
CreateInstancePayloadSchema,
DeleteInstancePayload,
DeleteInstancePayloadSchema,
DeleteInstanceResult,
PocketBase,
RestCommands,
RestMethods,
UpdateInstancePayload,
@@ -164,15 +160,6 @@ export const createPocketbaseClient = (config: PocketbaseClientConfig) => {
{} as { [_: InstanceId]: InstanceFields },
)
const parseError = (e: Error): string[] => {
if (!(e instanceof ClientResponseError)) return [e.message]
if (e.data.message && keys(e.data.data).length === 0)
return [e.data.message]
return map(e.data.data, (v, k) => (v ? v.message : undefined)).filter(
(v) => !!v,
)
}
const resendVerificationEmail = async () => {
const user = client.authStore.model
assertExists(user, `Login required`)

View File

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 364 B

Some files were not shown because too many files have changed in this diff Show More