refactor: fold shared ui/server packages into the cloud app
Le depot ne contient plus qu'une seule application : plus de paquets
@cohaise/ui ni @cohaise/server.
- backend/shared/src -> backend/cloud/src/lib (socle serveur inline)
- frontend/shared/src -> frontend/cloud/src/{ui,styles,fonts}
- imports @cohaise/server / @cohaise/ui remplaces par des chemins relatifs
- package.json, tsconfig, Dockerfiles et docker-compose sans workspace partage
- docs (README, architecture, standards, workflow, agents, api, security,
deployment, docker) alignes sur la structure autonome
This commit is contained in:
@@ -11,7 +11,9 @@
|
||||
"admin": "node dist/admin.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cohaise/server": "*",
|
||||
"@hono/node-server": "^2.1.3",
|
||||
"hono": "^4.13.13",
|
||||
"mysql2": "^3.24.5",
|
||||
"nodemailer": "^10.1.1",
|
||||
"sharp": "^0.35.5",
|
||||
"zod": "^4.6.5"
|
||||
@@ -22,6 +24,7 @@
|
||||
"typescript": "^7.0.2"
|
||||
},
|
||||
"bin": {
|
||||
"cohaise-admin": "./dist/admin.js"
|
||||
"cohaise-admin": "./dist/admin.js",
|
||||
"cohaise-migrate": "./dist/cli.js"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Context } from "hono";
|
||||
import { clientIp as sharedClientIp, type Db, type SessionUser } from "@cohaise/server";
|
||||
import { clientIp as sharedClientIp, type Db, type SessionUser } from "./lib/index.js";
|
||||
|
||||
/**
|
||||
* Les droits sont toujours recalcules depuis la session serveur. Le role de
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { ConfigError, loadDbConfig, hashPassword, AppError, toSafeError } from "@cohaise/server";
|
||||
import { ConfigError, loadDbConfig, hashPassword, AppError, toSafeError } from "./lib/index.js";
|
||||
|
||||
/**
|
||||
* Creation et reinitialisation des comptes, en dehors de toute requete HTTP.
|
||||
@@ -98,7 +98,7 @@ const main = async (argv: string[]): Promise<number> => {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const { Db } = await import("@cohaise/server");
|
||||
const { Db } = await import("./lib/index.js");
|
||||
const db = new Db(config);
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { purgeExpiredSessions, startService } from "@cohaise/server";
|
||||
import { purgeExpiredSessions, startService } from "./lib/index.js";
|
||||
import { registerAccountRoutes } from "./routes/account.js";
|
||||
import { registerAdminRoutes } from "./routes/admin.js";
|
||||
import { registerAuthRoutes } from "./routes/auth.js";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto";
|
||||
import { mkdir, stat } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import sharp from "sharp";
|
||||
import type { Config, Db } from "@cohaise/server";
|
||||
import type { Config, Db } from "./lib/index.js";
|
||||
import { absolutePath } from "./storage.js";
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
type Config,
|
||||
type Db,
|
||||
type SessionUser,
|
||||
} from "@cohaise/server";
|
||||
} from "../lib/index.js";
|
||||
import { audit } from "../access.js";
|
||||
import { absolutePath, fileExists, openForDownload } from "../storage.js";
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
type App,
|
||||
type Config,
|
||||
type Db,
|
||||
} from "@cohaise/server";
|
||||
} from "../lib/index.js";
|
||||
|
||||
const uuidParam = z
|
||||
.string()
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
type App,
|
||||
type Config,
|
||||
type Db,
|
||||
} from "@cohaise/server";
|
||||
} from "../lib/index.js";
|
||||
|
||||
const credentials = z.object({
|
||||
email: z.string().trim().min(3).max(255),
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
type App,
|
||||
type Config,
|
||||
type Db,
|
||||
} from "@cohaise/server";
|
||||
} from "../lib/index.js";
|
||||
import { audit, canRead, canWrite, canWriteExplicit } from "../access.js";
|
||||
import { indexMedia, thumbnailSize } from "../media.js";
|
||||
import {
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
type App,
|
||||
type Config,
|
||||
type Db,
|
||||
} from "@cohaise/server";
|
||||
} from "../lib/index.js";
|
||||
import { audit, canManageFolder, canRead, canWrite } from "../access.js";
|
||||
|
||||
const uuid = z
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
requireAuth,
|
||||
type App,
|
||||
type Db,
|
||||
} from "@cohaise/server";
|
||||
} from "../lib/index.js";
|
||||
|
||||
/**
|
||||
* Galerie : liste des fichiers accompagnes de leur nature (image, video,
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
requireAuth,
|
||||
type App,
|
||||
type Db,
|
||||
} from "@cohaise/server";
|
||||
} from "../lib/index.js";
|
||||
|
||||
/**
|
||||
* Recherche par nom, filtree par les droits de la session. Le motif est
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
type App,
|
||||
type Config,
|
||||
type Db,
|
||||
} from "@cohaise/server";
|
||||
} from "../lib/index.js";
|
||||
import { audit } from "../access.js";
|
||||
import { absolutePath, discard } from "../storage.js";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { mkdir, rename, rm, stat } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { Readable, Transform } from "node:stream";
|
||||
import { pipeline } from "node:stream/promises";
|
||||
import { AppError, type Db } from "@cohaise/server";
|
||||
import { AppError, type Db } from "./lib/index.js";
|
||||
|
||||
/**
|
||||
* Chemin physique : ${MEDIA_DIR}/${slug emplacement}/${uuid}.
|
||||
|
||||
@@ -12,6 +12,5 @@
|
||||
"declaration": true,
|
||||
"sourceMap": true
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"references": [{ "path": "../shared" }]
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
{
|
||||
"name": "@cohaise/server",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc --build",
|
||||
"clean": "node --eval \"import('node:fs').then(fs => { fs.rmSync('dist', { recursive: true, force: true }); fs.rmSync('tsconfig.tsbuildinfo', { force: true }); })\"",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.0.0",
|
||||
"typescript": "^7.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hono/node-server": "^2.1.3",
|
||||
"hono": "^4.13.13",
|
||||
"mysql2": "^3.24.5",
|
||||
"zod": "^4.6.5"
|
||||
},
|
||||
"bin": {
|
||||
"cohaise-migrate": "./dist/cli.js"
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"lib": ["ES2023"],
|
||||
"types": ["node"],
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"composite": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user