@c-time/frelio-data-json-recipe-to-dependency-map
v2.2.1
Published
Convert FrelioBuildDataRecipe to FrelioDependencyMap
Readme
@c-time/frelio-data-json-recipe-to-dependency-map
ビルドレシピ(FrelioBuildDataRecipe)から依存マップ(FrelioDependencyMap)を生成する変換ライブラリ。
概要
ビルドレシピを解析し、各出力ファイルがどのソースファイルに依存しているかを自動算出する。これにより、コンテンツやテンプレートの変更時に差分ビルドが可能になる。
解析対象:
- コンテンツタイプの詳細ページ・一覧ページのテンプレート依存
expandやcustomFieldsによる関連コンテンツタイプへの依存- リレーションフィールドのターゲットへの依存
- テンプレートインクルード(パーシャル)の依存伝播
インストール
npm install @c-time/frelio-data-json-recipe-to-dependency-map使用例
import { convertRecipeToDependencyMap } from '@c-time/frelio-data-json-recipe-to-dependency-map'
import type { FrelioBuildDataRecipe } from '@c-time/frelio-data-json-recipe'
import type { ContentType } from '@c-time/frelio-types'
const recipe: FrelioBuildDataRecipe = {
contentTypes: { /* ... */ },
staticPages: [],
templateIncludes: {},
}
// コンテンツタイプ定義を渡すと、リレーションフィールドの依存も解析される
const contentTypeDefinitions = new Map<string, ContentType>([
['news', { id: 'news', fields: [/* ... */] }],
])
const dependencyMap = convertRecipeToDependencyMap(recipe, {
contentTypeDefinitions,
})API
convertRecipeToDependencyMap(recipe, options?)
ビルドレシピから依存マップを生成する。
| パラメータ | 型 | 説明 |
|-----------|-----|------|
| recipe | FrelioBuildDataRecipe | ビルドレシピ |
| options.contentTypeDefinitions | Map<string, ContentType> | コンテンツタイプ定義(任意) |
戻り値: FrelioDependencyMap
依存パッケージ
@c-time/frelio-data-json-recipe— レシピの型定義@c-time/frelio-dependency-map— 依存マップの型定義とユーティリティ@c-time/frelio-types— コンテンツタイプの型定義
ライセンス
MIT
