0.1.0 • Published 2d agoCLI
@latellu/atlas-cli
Licence
MIT
Version
0.1.0
Deps
0
Size
9 kB
Vulns
0
Weekly
71
@latellu/atlas-cli
Generate TypeScript types from an Atlas CMS workspace schema.
The CLI calls GET /api/v1/public/schema on your Atlas backend (the workspace is
derived from the API key) and writes an atlas.types.ts file with:
- one
interfaceper content type (PascalCase name from the slug), selectfields as string-literal unions,- a
Localeunion from the workspace's configured locales, - an
AtlasContentTypesregistry mapping each slug to its interface.
Usage
npx @latellu/atlas-cli generate --api-key=atlas_live_xxx --output=./src/typesOptions
| Flag | Env | Default | Description |
|---|---|---|---|
--api-key |
ATLAS_API_KEY |
— (required) | Workspace API key |
--url |
ATLAS_API_URL |
http://localhost:8080 |
Atlas backend base URL |
--output |
ATLAS_OUTPUT |
./src/atlas.types.ts |
Output file, or directory (writes atlas.types.ts inside) |
Example output
// Generated by @latellu/atlas-cli — DO NOT EDIT BY HAND.
// Workspace: museum-kyoto
export type Locale = "en" | "ja";
/** Article (content type: "article") */
export interface Article {
title: string; // localizable
category?: "News" | "Event";
}
/** Maps each content-type slug to its entry interface. */
export interface AtlasContentTypes {
"article": Article;
}Localizable fields are typed as their base value in this release; a per-locale representation is planned alongside
@latellu/atlas-sdk.