Skip to content

scaffold ​

The files alta new writes, as data: a valid start for each genre.

Example ​

example.mjs
js
// The files `alta new` writes, without writing them: a valid start for each genre.
import { GENRES, scaffold, validate } from "@altasystem/sdk";

console.log(GENRES.join(", "));
for (const f of scaffold("quest-pack", { id: "my-pack" })) {
  const doc = JSON.parse(f.content);
  console.log(f.path, doc.schema, validate(doc).ok);
}

examples/sdk/scaffold.mjs

Run it from a folder where the package is installed: node example.mjs.

Output
text
chart, quest-pack, onboarding, cinematics, universe, mission, signin
quests.json alta.quests/0.3 true

Functions ​

scaffold ​

ts
function scaffold(genre: Genre, opts: ScaffoldOptions): ScaffoldFile[]

The files of a new piece of content. Throws on an unknown genre or a malformed id.

resolveGenre ​

ts
function resolveGenre(name: string): Genre | undefined

See also ​

Alta OS is open source (MIT).