Bootstrap pnpm monorepo workspace

This commit is contained in:
ZTatman 2026-03-30 16:32:04 -04:00
parent c6567440c7
commit b22d46ff84
17 changed files with 226 additions and 2 deletions

3
.gitignore vendored
View file

@ -5,5 +5,4 @@ coverage/
.env
.env.*
!.env.example
pnpm-lock.yaml
*.tsbuildinfo

15
package.json Normal file
View file

@ -0,0 +1,15 @@
{
"name": "embargo",
"private": true,
"version": "0.1.0",
"packageManager": "pnpm@10.11.0",
"devDependencies": {
"@types/node": "^24.0.0",
"typescript": "^5.8.3"
},
"scripts": {
"build": "tsc -b tsconfig.json",
"check": "tsc -b tsconfig.json",
"clean": "pnpm -r clean"
}
}

17
packages/cli/package.json Normal file
View file

@ -0,0 +1,17 @@
{
"name": "@embargo/cli",
"version": "0.1.0",
"private": true,
"type": "module",
"bin": {
"embargo": "./dist/index.js"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"check": "tsc -b tsconfig.json",
"clean": "rm -rf dist"
},
"dependencies": {
"@embargo/shared": "workspace:*"
}
}

14
packages/cli/src/index.ts Normal file
View file

@ -0,0 +1,14 @@
import { EMBARGO_DEFAULT_FORGEJO_PORT, EMBARGO_DEFAULT_SERVICE_PORT } from "@embargo/shared";
function main(): void {
process.stdout.write(
[
"Embargo CLI bootstrap",
`Forgejo default port: ${EMBARGO_DEFAULT_FORGEJO_PORT}`,
`Service default port: ${EMBARGO_DEFAULT_SERVICE_PORT}`
].join("\n") + "\n"
);
}
main();

View file

@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "dist"
},
"references": [
{ "path": "../shared" }
],
"include": ["src/**/*.ts"]
}

View file

@ -0,0 +1,14 @@
{
"name": "@embargo/service",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"build": "tsc -p tsconfig.json",
"check": "tsc -b tsconfig.json",
"clean": "rm -rf dist"
},
"dependencies": {
"@embargo/shared": "workspace:*"
}
}

View file

@ -0,0 +1,3 @@
import { EMBARGO_DEFAULT_SERVICE_PORT } from "@embargo/shared";
process.stdout.write(`Embargo service bootstrap on port ${EMBARGO_DEFAULT_SERVICE_PORT}\n`);

View file

@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "dist"
},
"references": [
{ "path": "../shared" }
],
"include": ["src/**/*.ts"]
}

View file

@ -0,0 +1,19 @@
{
"name": "@embargo/shared",
"version": "0.1.0",
"private": true,
"type": "module",
"exports": {
".": {
"types": "./src/index.ts",
"default": "./src/index.ts"
}
},
"main": "./src/index.ts",
"types": "./src/index.ts",
"scripts": {
"build": "tsc -p tsconfig.json",
"check": "tsc -b tsconfig.json",
"clean": "rm -rf dist"
}
}

View file

@ -0,0 +1,8 @@
export const EMBARGO_DEFAULT_FORGEJO_PORT = 3000;
export const EMBARGO_DEFAULT_SERVICE_PORT = 4000;
export const EMBARGO_VISIBILITY_MODES = {
TEAM: "team",
ALLOWLIST: "allowlist"
} as const;

View file

@ -0,0 +1,3 @@
export * from "./constants.js";
export * from "./types.js";

View file

@ -0,0 +1,13 @@
export type VisibilityMode = "team" | "allowlist";
export interface RepoRef {
owner: string;
name: string;
}
export interface GrantSnapshot {
repo: RepoRef;
sourceBranch: string;
commitSha: string;
}

View file

@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "dist"
},
"include": ["src/**/*.ts"]
}

53
pnpm-lock.yaml generated Normal file
View file

@ -0,0 +1,53 @@
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.:
devDependencies:
'@types/node':
specifier: ^24.0.0
version: 24.12.0
typescript:
specifier: ^5.8.3
version: 5.9.3
packages/cli:
dependencies:
'@embargo/shared':
specifier: workspace:*
version: link:../shared
packages/service:
dependencies:
'@embargo/shared':
specifier: workspace:*
version: link:../shared
packages/shared: {}
packages:
'@types/node@24.12.0':
resolution: {integrity: sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ==}
typescript@5.9.3:
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
engines: {node: '>=14.17'}
hasBin: true
undici-types@7.16.0:
resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==}
snapshots:
'@types/node@24.12.0':
dependencies:
undici-types: 7.16.0
typescript@5.9.3: {}
undici-types@7.16.0: {}

3
pnpm-workspace.yaml Normal file
View file

@ -0,0 +1,3 @@
packages:
- packages/*

21
tsconfig.base.json Normal file
View file

@ -0,0 +1,21 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"lib": ["ES2022"],
"baseUrl": ".",
"paths": {
"@embargo/shared": ["packages/shared/src/index.ts"]
},
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"skipLibCheck": true,
"declaration": true,
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
}
}

9
tsconfig.json Normal file
View file

@ -0,0 +1,9 @@
{
"files": [],
"references": [
{ "path": "./packages/shared" },
{ "path": "./packages/cli" },
{ "path": "./packages/service" }
]
}