Documentation Index
Fetch the complete documentation index at: https://docs.notcms.com/llms.txt
Use this file to discover all available pages before exploring further.
pullコマンドは、NotionデータベースからTypeScriptスキーマを生成または更新します。
実行内容
- データベースの構造とプロパティを取得
- TypeScript型を生成
- スキーマファイルを更新
オプション
| オプション | 説明 | デフォルト |
|---|
--env | 環境ファイルのパス | [".env", ".env.local", ".dev.vars"] |
基本的なプル
環境ファイルパスの指定
npx notcms-kit pull --env .env.development
生成されるスキーマ
このコマンドは完全に型付けされたスキーマを生成します:
import { Schema } from 'notcms';
export const schema = {
// 例
blog: {
id: "abc123...",
properties: {
title: "title",
content: "rich_text",
published: "checkbox",
publishDate: "date",
author: "relation",
tags: "multi_select"
}
}
} satisfies Schema;
スキーマの更新
Notionデータベースを更新すると、pullコマンドがスキーマを更新します。
{
"scripts": {
"schema:pull": "notcms-kit pull",
}
}