Skip to content
qino

Since 0.1.0

initQino

Initialize the instance that all definitions hang off.

Initializes a Qino instance bound to a content folder and a media folder. Every collection, tree, and item is defined through the returned instance.

qino/index.ts
import { initQino } from "@qino/cms";

const qino = initQino({
  contentFolder: "src/content",
  mediaFolder: "public",
});

Signature

@qino/cms
function initQino(config: {
  readonly contentFolder: string;
  readonly mediaFolder: string;
}): {
  defineCollection: typeof defineCollection;
  defineTree: typeof defineTree;
  defineItem: typeof defineItem;
};

Parameters

NameTypeRequiredDefaultDescription
contentFolderstringyesDirectory, relative to the working directory, that every directory and file path is joined onto
mediaFolderstringyesDirectory, relative to the working directory, for media files. Only its existence is checked

The config type is not exported; pass an object literal.

Returns

An instance with three methods:

The methods are closures, so destructuring them is fine:

qino/index.ts
export const { defineCollection, defineTree, defineItem } = initQino({
  contentFolder: "src/content",
  mediaFolder: "public",
});

Each instance carries a unique identity. Primitives from one instance cannot be related to primitives from another, and qino lint rejects a project that mixes instances.

Throws

Nothing. Folder existence is checked by the CLI, not at creation.

CLI expectations

The CLI loads qino/index.ts and requires the instance to be its default export. See Project structure.

See also