Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/packages/crawl-admission/.c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"all": true,
"src": "src",
"reporter": ["html", "json-summary"],
"reports-dir": "./coverage",
"resolve": ".",
"source-map": true,
"exclude-after-remap": true
}
4 changes: 4 additions & 0 deletions src/packages/crawl-admission/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://biomejs.dev/schemas/2.4.16/schema.json",
"extends": ["../../../biome.config.base.json"]
}
21 changes: 21 additions & 0 deletions src/packages/crawl-admission/enforce-coverage.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const baseConfig = require('../../../enforce-coverage.config.base');
const path = require('path');

const config = {
...baseConfig,
thresholds: {
statements: 100,
branches: 100,
functions: 100,
lines: 100,
},
};

config.enforceCoverage({
projectRoot: path.resolve(__dirname),
thresholds: config.thresholds,
showTextTable: true,
extraExcludePatterns: [
...(config.extraExcludePatterns || []),
],
});
9 changes: 9 additions & 0 deletions src/packages/crawl-admission/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Run the c8 coverage pass IN-BAND. Multi-worker coverage loses a worker's V8
// shard when jest SIGKILLs a leaked-handle worker before it flushes, dropping
// coverage below threshold on a per-run lottery; nx still runs the packages in
// parallel, so cross-package parallelism is preserved. Non-coverage `jest`
// keeps the default pool.
/** @type {import('jest').Config} */
module.exports = {
...(process.env.NODE_V8_COVERAGE ? { maxWorkers: 1 } : {}),
};
12 changes: 12 additions & 0 deletions src/packages/crawl-admission/knip.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { KnipConfig } from "knip";

export default {
ignoreBinaries: [
"knip",
"biome",
"nx",
],
jest: {
entry: ["src/**/*.test.ts"],
},
} satisfies KnipConfig;
27 changes: 27 additions & 0 deletions src/packages/crawl-admission/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@packages/crawl-admission",
"version": "1.0.0",
"description": "Fleetwide per-host crawl admission, pacing and cooldown policy backed by the shared rate-limits table",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"private": true,
"scripts": {
"compile": "rm -rf dist && tsc",
"lint": "concurrently --kill-others-on-fail \"tsc --project tsconfig.lint.json\" \"biome lint src\" \"knip\"",
"test": "jest --testMatch='**/dist/**/*.test.js'",
"test-with-coverage": "c8 pnpm test && node enforce-coverage.config.js",
"check": "nx run @packages/crawl-admission:check",
"check-infra": "echo 'No infrastructure — shared library'"
},
"dependencies": {
"@packages/storage-client": "workspace:*",
"zod": "4.4.3"
},
"devDependencies": {
"@types/jest": "30.0.0",
"c8": "11.0.0",
"concurrently": "10.0.0",
"jest": "30.4.2",
"typescript": "6.0.3"
}
}
10 changes: 10 additions & 0 deletions src/packages/crawl-admission/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@packages/crawl-admission",
"targets": {
"check": {
"command": "pnpm lint && pnpm test-with-coverage",
"options": { "cwd": "{projectRoot}" },
"dependsOn": ["compile"]
}
}
}
Loading
Loading