Skip to content
Ashlarv1.2.1

Give a library or a CLI its areas

Make each folder of a library or a CLI a service area, so another folder imports it only through its index.ts.

Name one web app whose main side is the source folder, with no renderer, and areas: ['*'].

ashlar.config.ts
import { defineConfig } from '@kurvball/ashlar';
export default defineConfig({
include: ['src'],
apps: [{ root: 'src', stack: 'web', main: ['.'], renderer: [], areas: ['*'] }],
});

Ashlar now counts each import that reaches past an area's index.ts.

Terminal
$ pnpm exec ashlar check
Ashlar checked 3 files in 0.1 s: 2 counts rose.
public-api-only in src/cli.ts: 1, up from 0
src/cli.ts:1:21
Import another feature or area through its `index.ts`. If you need something inside it, it belongs in its index or in `shared/`.
public-api-only in src/run/run.ts: 1, up from 0
src/run/run.ts:1:22
Import another feature or area through its `index.ts`. If you need something inside it, it belongs in its index or in `shared/`.

Without areas, the app's default areas match no folder, and ashlar check warns that public-api-only counts nothing there.

See every app key in the config reference.