@lambda-solutions/arc-presets
v0.1.0
Published
Sheriff architecture presets: config factory + Nx generators + installer for vertical-slice and hexagonal architectures, with the @lambda-solutions Sheriff fork.
Maintainers
Readme
@lambda-solutions/arc-presets
Sheriff architecture presets as an Nx plugin: a config factory, code generators,
and a one-shot installer that wires Sheriff into a
workspace from a chosen architecture preset — using the
@lambda-solutions Sheriff fork
(published v1) where a preset needs it.
The four presets and the reasoning behind each are documented in
docs/ansaetze.md.
Presets
| id | architecture | fork required |
|---|---|---|
| inverted (default) | Vertical slice, api/ contract + infra/ impl | no |
| blueprint | Vertical slice, base (no infra/) | no |
| hexagonal-fwcore | Ports & Adapters, framework-aware core (3 layers) | no |
| hexagonal-strict | Ports & Adapters, framework-free core (denyRules) | yes |
Setup in a target repo
pnpm add -D @lambda-solutions/arc-presets
nx g @lambda-solutions/arc-presets:init --preset inverted --app client
pnpm sheriff:verifyinit does four things:
- writes
sheriff.config.tsfor the chosen preset, - adds the Sheriff engine as dev dependencies (fork v1, or upstream
@softarcwith--installFork=false) and installs them with the target repo's package manager, - wires
sheriff.configs.allintoeslint.config.*(or prints a snippet), - adds a
sheriff:verifynpm script (and, with--ci, a GitHub Actions workflow).
Package manager detection
init derives the package manager from the target repo — it never assumes the
one that happens to run the generator — and uses it for the install, for the
--ci workflow, and for every command it prints. Resolution order:
--packageManager(explicit override),cli.packageManagerinnx.json,- the corepack
packageManagerfield inpackage.json, - a lockfile (
bun.lockb/bun.lock,yarn.lock,pnpm-lock.yaml,package-lock.json), - nx's own detection as a fallback.
The chosen manager is logged with its reason, e.g.
arc-presets: package manager: pnpm (pnpm-lock.yaml). Pass --skipInstall to
write the dev dependencies to package.json without running the install.
init options
| flag | default | meaning |
|---|---|---|
| --preset | inverted | one of the four ids above |
| --app | – | primary app name (seeds entryPoints) |
| --installFork | true | install the fork; false uses upstream @softarc (blocked for hexagonal-strict) |
| --skipEslint | false | don't touch eslint.config.*; print a snippet |
| --ci | false | drop .github/workflows/sheriff.yml (uses the detected package manager) |
| --aliasPrefix | @blueprint | tsconfig path-alias prefix for extracted libs |
| --packageManager | derived | force npm / pnpm / yarn / bun instead of deriving it |
| --skipInstall | false | add the dev dependencies but don't run the install |
Generators
# vertical-slice presets (blueprint / inverted)
nx g @lambda-solutions/arc-presets:domain booking # lib under libs/domains/
nx g @lambda-solutions/arc-presets:domain billing --app client
nx g @lambda-solutions/arc-presets:feat check-in --domain booking [--app client]
nx g @lambda-solutions/arc-presets:shared-feature auth --app client
# hexagonal presets (hexagonal-fwcore / hexagonal-strict)
nx g @lambda-solutions/arc-presets:hexagon booking --app client
# utilities
nx g @lambda-solutions/arc-presets:migrate # blueprint -> inverted
nx g @lambda-solutions/arc-presets:doctor # check config/deps/eslint/scriptThe slice generators detect the active preset from sheriff.config.ts (a marker
comment written by init); pass --preset to override.
Library API
sheriff.config.ts on the vertical-slice presets calls the factory:
import { verticalSliceConfig } from '@lambda-solutions/arc-presets';
export const config = verticalSliceConfig('inverted', {
sharedFeatures: ['auth', 'layout'],
entryPoints: { client: 'apps/client/src/main.ts' },
});Hexagonal presets use hexagonalConfig(preset, { apps: { client: ['booking'] } }).
Also exported: nxModuleBoundariesOptions, slice, hexSlice, sameApp,
inAnyFeat, appOf, configTemplate.
Sheriff transpiles and evals
sheriff.config.ts, so this package must be a built package innode_modules(npm registry or a workspace link with apreparebuild). Relative imports insheriff.config.tsdo not work.
Tests
vitest run — unit (preset factories produce valid configs), generators
(devkit Tree), and e2e (a scaffolded workspace where sheriff verify + eslint
run over the full chain).
