Structuring a repository
Axle uses the same files as your package manager, so a monorepo that works with pnpm, npm, Yarn, Bun, nub or aube already works with Axle.
A common layout
Section titled “A common layout”my-monorepo/├── apps/│ ├── web/package.json│ └── docs/package.json├── packages/│ └── ui/package.json├── package.json└── pnpm-workspace.yamlThe root
Section titled “The root”Starting from the folder you run Axle in and walking up, the root is the first folder that has an aube-workspace.yaml or a pnpm-workspace.yaml, or a package.json with a workspaces field. If there is none, the nearest folder with a package.json is a repository with a single package, and every command works there too. A repository without JavaScript, whose projects come from plugins or projects, needs no package.json: the outermost folder with an axle.toml, up to the top of the Git repository, is its root, and it wins over a package.json in a folder below it.
Which folders are packages
Section titled “Which folders are packages”The workspace patterns say where packages live:
- pnpm: the
packageslist inpnpm-workspace.yaml. - aube: the
packageslist inaube-workspace.yaml, or inpnpm-workspace.yaml. - npm, Yarn and Bun: the
workspacesfield of the rootpackage.json, either a list or an object with apackageslist. - nub: whichever of these the repository already has.
A folder is a package when it matches a pattern and contains a package.json. The glob patterns page explains *, ** and !.
Axle skips node_modules, .git and everything listed in .gitignore. Other hidden folders, such as .config, are searched like any other folder.
The package manager
Section titled “The package manager”Axle uses the first of these that it finds in the root package.json or folder:
- the
devEngines.packageManagerfield, for example{ "name": "pnpm", "version": "^12.0.0" }, or a list of them; - the
packageManagerfield, for example"pnpm@12.26.0"; - a lockfile:
aube-lock.yaml, thennub.lock, thenpnpm-lock.yaml, thenbun.lockorbun.lockb, thenyarn.lock, thenpackage-lock.json; - otherwise aube for an
aube-workspace.yaml, pnpm for apnpm-workspace.yaml, and npm for apackage.jsonworkspace.
Keep only the lockfile of the package manager you use; Axle warns when it finds more than one.
nub and aube can keep the lockfile of the package manager a repository used before, so name them in packageManager or devEngines.packageManager, for example "aube@2.11.3": Axle then runs scripts with nub run or aube run and reads whichever lockfile is there. They write nub.lock and aube-lock.yaml, which have the shape of pnpm-lock.yaml, only in a repository that has no lockfile yet.