@c-time/frelio-data-json-recipe-to-dependency-map 1.3.14 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# @c-time/frelio-data-json-recipe-to-dependency-map
|
|
2
|
+
|
|
3
|
+
ビルドレシピ(`FrelioBuildDataRecipe`)から依存マップ(`FrelioDependencyMap`)を生成する変換ライブラリ。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 概要
|
|
8
|
+
|
|
9
|
+
ビルドレシピを解析し、各出力ファイルがどのソースファイルに依存しているかを自動算出する。これにより、コンテンツやテンプレートの変更時に差分ビルドが可能になる。
|
|
10
|
+
|
|
11
|
+
解析対象:
|
|
12
|
+
- コンテンツタイプの詳細ページ・一覧ページのテンプレート依存
|
|
13
|
+
- `expand` や `customFields` による関連コンテンツタイプへの依存
|
|
14
|
+
- リレーションフィールドのターゲットへの依存
|
|
15
|
+
- テンプレートインクルード(パーシャル)の依存伝播
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## インストール
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @c-time/frelio-data-json-recipe-to-dependency-map
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 使用例
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { convertRecipeToDependencyMap } from '@c-time/frelio-data-json-recipe-to-dependency-map'
|
|
31
|
+
import type { FrelioBuildDataRecipe } from '@c-time/frelio-data-json-recipe'
|
|
32
|
+
import type { ContentType } from '@c-time/frelio-types'
|
|
33
|
+
|
|
34
|
+
const recipe: FrelioBuildDataRecipe = {
|
|
35
|
+
contentTypes: { /* ... */ },
|
|
36
|
+
staticPages: [],
|
|
37
|
+
templateIncludes: {},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// コンテンツタイプ定義を渡すと、リレーションフィールドの依存も解析される
|
|
41
|
+
const contentTypeDefinitions = new Map<string, ContentType>([
|
|
42
|
+
['news', { id: 'news', fields: [/* ... */] }],
|
|
43
|
+
])
|
|
44
|
+
|
|
45
|
+
const dependencyMap = convertRecipeToDependencyMap(recipe, {
|
|
46
|
+
contentTypeDefinitions,
|
|
47
|
+
})
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## API
|
|
53
|
+
|
|
54
|
+
### `convertRecipeToDependencyMap(recipe, options?)`
|
|
55
|
+
|
|
56
|
+
ビルドレシピから依存マップを生成する。
|
|
57
|
+
|
|
58
|
+
| パラメータ | 型 | 説明 |
|
|
59
|
+
|-----------|-----|------|
|
|
60
|
+
| `recipe` | `FrelioBuildDataRecipe` | ビルドレシピ |
|
|
61
|
+
| `options.contentTypeDefinitions` | `Map<string, ContentType>` | コンテンツタイプ定義(任意) |
|
|
62
|
+
|
|
63
|
+
**戻り値**: `FrelioDependencyMap`
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 依存パッケージ
|
|
68
|
+
|
|
69
|
+
- `@c-time/frelio-data-json-recipe` — レシピの型定義
|
|
70
|
+
- `@c-time/frelio-dependency-map` — 依存マップの型定義とユーティリティ
|
|
71
|
+
- `@c-time/frelio-types` — コンテンツタイプの型定義
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## ライセンス
|
|
76
|
+
|
|
77
|
+
MIT
|