DBDelve
Dive deep into your data. A fast, native, multi-engine database client written in Rust. Free and open source, no telemetry.
翻訳待ち
Validate and visualise your JS/TS module graph. A dependency-cruiser alternative built on the oxc toolchain.
翻訳待ち
Loading the full README.
Read the full README ↗Validate and visualise your JS/TS module graph. A dependency-cruiser alternative built on the oxc toolchain.
npx oxcruise src
error[circular-dependencies]: circular dependency: src/a.ts → src/b.ts → src/a.ts
--> src/a.ts:1:19
|
1 | import { b } from "./b";
| ^^^^^
= cycle:
╭─▶ src/a.ts
╰── src/b.ts
✖ 1 problem (1 error, 0 warnings) in 24 modules, 31 dependencies
It needs no config to start. The default rules catch circular imports, unresolvable imports, undeclared and dev-only
dependencies, and orphan modules. When you need more, you add layers, forbid rules and plugins.
type-only information.
You do not install typescript.tsconfig.json per file, workspace packages and #imports.correctness is on as error, suspicious as
warn), globs are the only pattern language, and cycles that exist only through import type are not reported.{name} captures and ! negation in globs.oxcruise --migrate converts your .dependency-cruiser.* file and says what it could not carry over.Oxcruise needs Node.js 22.18 or later.
npm install --save-dev oxcruise
npx oxcruise # check the current folder with the default rules
npx oxcruise src # start at src instead
npx oxcruise --init # write a starter oxcruise.config.ts
The command exits with 0 when there are no errors, 1 when there are errors, and 2 for a bad flag or config file.
Other things to try:
npx oxcruise --visualize # an interactive architecture site in ./oxcruise-report
npx oxcruise -f github # annotations in GitHub Actions
npx oxcruise --rules # the built-in rules by category
npx oxcruise --print-config # the config after defaults and `extends`
Add --deny-warnings or --max-warnings <N> to fail a CI run on warnings.
Write the config in oxcruise.config.ts, or in .oxcruiserc.json (comments allowed, and a $schema for editors):
// oxcruise.config.ts
import { defineConfig } from "oxcruise";
export default defineConfig({
entries: ["src"],
ignorePatterns: ["src/generated/**"], // .gitignore is always honoured
categories: { correctness: "error", suspicious: "warn" }, // this is the default
rules: {
"circular-dependencies": "error",
layers: {
level: "error",
layers: { ui: "src/ui/**", domain: "src/domain/**" },
allow: { ui: ["domain"], domain: [] },
},
},
forbid: [
{
name: "feature-isolation",
message: "features must not import each other",
from: "src/features/{feature}/**",
to: ["src/features/**", "!src/features/{feature}/**"],
},
{ name: "no-node-in-browser", from: "src/web/**", to: { kind: "builtin" } },
],
overrides: [{ files: ["scripts/**"], rules: { "dev-dependencies-in-production": "off" } }],
});
To silence one violation, say why in a comment:
// oxcruise-ignore-next-line circular-dependencies -- the registry needs the plugin list
import { plugins } from "./plugins";
See Configuration and the config reference for every key.
Run npx oxcruise --rules for the list on your version.
| Category | Default | Rules |
|---|---|---|
correctness | error | circular-dependencies, unresolved-dependencies, undeclared-packages, dev-dependencies-in-production, dependencies-on-tests, cross-package-relative-dependencies |
suspicious | warn | orphan-modules, duplicate-packages, deprecated-dependencies, unused-exports, unused-packages, unused-modules |
style | off | folder-structure |
restriction | off | layers, visibility, optional-dependencies, peer-dependencies |
The unused-code rules need exports, so they cost an extra walk. They are on by default. Set them to off in rules to skip it, add --production to leave
tests out, and --fix to apply the automatic repairs.
See Rules and categories and the rule reference.
A plugin rule runs over the finished graph:
import { definePlugin } from "oxcruise/plugin";
export default definePlugin({
meta: { name: "acme" },
rules: {
"max-fan-out": {
create: (ctx) => ({
module(m) {
/* ctx.report({ module: m, message }) */
},
}),
},
},
});
The same graph is available from code, for architecture tests:
This is the beginning of the README. Read the rest at the original. Read the full README ↗