@c-time/frelio-cli 2.0.0 → 2.1.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/dist/core/doctor.js
CHANGED
|
@@ -66,7 +66,12 @@ export function runDoctor(projectDir) {
|
|
|
66
66
|
matchedFiles.push(path.relative(projectDir, file).split(path.sep).join('/'));
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
// absentFile が指定されている場合、そのファイルが存在するなら要件充足として finding にしない。
|
|
70
|
+
// (files/patterns は「移行済み=Workers 構成」判定に使い、欠落しているべきファイルの
|
|
71
|
+
// 有無だけを警告する用途。例: 404 テンプレ未整備)
|
|
72
|
+
const absentFile = migration.detection.absentFile;
|
|
73
|
+
const requirementSatisfied = absentFile !== undefined && fs.existsSync(path.join(projectDir, absentFile));
|
|
74
|
+
if (matchedFiles.length > 0 && !requirementSatisfied) {
|
|
70
75
|
matchedFiles.sort();
|
|
71
76
|
findings.push({ migration, matchedFiles });
|
|
72
77
|
}
|
|
@@ -14,5 +14,15 @@ import type { Migration } from './types.js';
|
|
|
14
14
|
export declare const legacyPagesArtifactsIssue184: Migration;
|
|
15
15
|
/** 旧 Pages 用 root wrangler.toml(pages_build_output_dir を持つ)。 */
|
|
16
16
|
export declare const legacyPagesWranglerIssue184: Migration;
|
|
17
|
+
/**
|
|
18
|
+
* #189 — Workers 移行済みだが 404 テンプレートが未整備。
|
|
19
|
+
*
|
|
20
|
+
* content Worker の wrangler.content.toml は `not_found_handling="404-page"` を持ち、
|
|
21
|
+
* 未マッチ URL に `public/404.html` を 404 で配信する。しかし `update` は
|
|
22
|
+
* frelio-data/(テンプレート)や recipe を触らないため、404 テンプレートを持たない
|
|
23
|
+
* 世代のリポジトリでは `public/404.html` が生成されず、404 が空ボディになる。
|
|
24
|
+
* デザイン依存のため自動生成はできないので、doctor で整備を促す。
|
|
25
|
+
*/
|
|
26
|
+
export declare const missing404TemplateIssue189: Migration;
|
|
17
27
|
/** #187 で廃止した admin/config.json の Cloudflare デプロイ管理フィールド。 */
|
|
18
28
|
export declare const deployMgmtConfigFieldsIssue187: Migration;
|
|
@@ -19,6 +19,10 @@ export const legacyPagesArtifactsIssue184 = {
|
|
|
19
19
|
severity: 'warning',
|
|
20
20
|
detection: {
|
|
21
21
|
// 存在すること自体が旧 Pages 資産。catch-all パターンで「存在=検出」とする。
|
|
22
|
+
// root だけでなくアセットディレクトリ(admin/・public/)配下も対象にする。
|
|
23
|
+
// 特に admin/_redirects(`/* /index.html 200`)は Workers の [assets] で
|
|
24
|
+
// "Infinite loop detected"(Cloudflare API code 100324)となり admin Worker の
|
|
25
|
+
// デプロイを止めるため、root と同様に撤去が必要(Issue #189)。
|
|
22
26
|
files: [
|
|
23
27
|
'_redirects',
|
|
24
28
|
'_routes.json',
|
|
@@ -26,12 +30,18 @@ export const legacyPagesArtifactsIssue184 = {
|
|
|
26
30
|
'functions/_middleware.js',
|
|
27
31
|
'functions/*',
|
|
28
32
|
'functions/api/*',
|
|
33
|
+
'admin/_redirects',
|
|
34
|
+
'admin/_routes.json',
|
|
35
|
+
'public/_redirects',
|
|
36
|
+
'public/_routes.json',
|
|
29
37
|
],
|
|
30
38
|
patterns: ['[\\s\\S]*'],
|
|
31
39
|
flags: 's',
|
|
32
40
|
},
|
|
33
41
|
remediation: '不要な旧 Pages 資産を削除してください: `git rm -r functions/` および ' +
|
|
34
|
-
'`git rm -f _redirects _routes.json`(存在するもののみ)。'
|
|
42
|
+
'`git rm -f _redirects _routes.json`(存在するもののみ)。' +
|
|
43
|
+
'アセットディレクトリ配下にも残ることがあります: ' +
|
|
44
|
+
'`git rm -f admin/_redirects admin/_routes.json public/_redirects public/_routes.json`(存在するもののみ)。',
|
|
35
45
|
referenceUrl: 'https://github.com/c-time/frelio-develop/issues/189',
|
|
36
46
|
};
|
|
37
47
|
/** 旧 Pages 用 root wrangler.toml(pages_build_output_dir を持つ)。 */
|
|
@@ -51,6 +61,34 @@ export const legacyPagesWranglerIssue184 = {
|
|
|
51
61
|
command: 'npx @c-time/frelio-cli update --templates-only',
|
|
52
62
|
referenceUrl: 'https://github.com/c-time/frelio-develop/issues/189',
|
|
53
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* #189 — Workers 移行済みだが 404 テンプレートが未整備。
|
|
66
|
+
*
|
|
67
|
+
* content Worker の wrangler.content.toml は `not_found_handling="404-page"` を持ち、
|
|
68
|
+
* 未マッチ URL に `public/404.html` を 404 で配信する。しかし `update` は
|
|
69
|
+
* frelio-data/(テンプレート)や recipe を触らないため、404 テンプレートを持たない
|
|
70
|
+
* 世代のリポジトリでは `public/404.html` が生成されず、404 が空ボディになる。
|
|
71
|
+
* デザイン依存のため自動生成はできないので、doctor で整備を促す。
|
|
72
|
+
*/
|
|
73
|
+
export const missing404TemplateIssue189 = {
|
|
74
|
+
id: 'missing-404-template-issue189',
|
|
75
|
+
title: '404 テンプレート(templates/404.html)の整備',
|
|
76
|
+
description: 'content Worker は not_found_handling="404-page" で未マッチ URL に public/404.html を配信しますが、' +
|
|
77
|
+
'frelio-data/site/templates/404.html が見つかりません。このままでは 404 が空ボディになります。',
|
|
78
|
+
severity: 'warning',
|
|
79
|
+
detection: {
|
|
80
|
+
// Workers 構成(wrangler.content.toml が 404-page 配信)であることを判定し、
|
|
81
|
+
files: ['wrangler.content.toml'],
|
|
82
|
+
patterns: ['not_found_handling\\s*=\\s*"404-page"'],
|
|
83
|
+
flags: 'm',
|
|
84
|
+
// 404 テンプレートが存在しないときだけ警告する。
|
|
85
|
+
absentFile: 'frelio-data/site/templates/404.html',
|
|
86
|
+
},
|
|
87
|
+
remediation: 'frelio-data/site/templates/404.html を追加し、build-data-recipe.json の staticPages に ' +
|
|
88
|
+
'{ "type": "static", "outputPath": "404.json", "templatePath": "404.html" } を加えて SSG を再ビルドしてください。' +
|
|
89
|
+
'テンプレートはサイトのデザイン(_parts / 共通スタイル)に合わせて作成します。',
|
|
90
|
+
referenceUrl: 'https://github.com/c-time/frelio-develop/issues/189',
|
|
91
|
+
};
|
|
54
92
|
/** #187 で廃止した admin/config.json の Cloudflare デプロイ管理フィールド。 */
|
|
55
93
|
export const deployMgmtConfigFieldsIssue187 = {
|
|
56
94
|
id: 'deploy-mgmt-config-fields-issue187',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { node20ToNode24 } from './node20-to-node24.js';
|
|
2
2
|
import { deployAdminSubdirIssue127 } from './deploy-admin-subdir-issue127.js';
|
|
3
|
-
import { legacyPagesArtifactsIssue184, legacyPagesWranglerIssue184, deployMgmtConfigFieldsIssue187, } from './pages-to-workers-issue184.js';
|
|
3
|
+
import { legacyPagesArtifactsIssue184, legacyPagesWranglerIssue184, missing404TemplateIssue189, deployMgmtConfigFieldsIssue187, } from './pages-to-workers-issue184.js';
|
|
4
4
|
/**
|
|
5
5
|
* 既知のマイグレーション一覧(実装順 = 登録順)。
|
|
6
6
|
* frelio doctor がこの一覧を走査して未適用を検出する。
|
|
@@ -10,6 +10,7 @@ export const MIGRATIONS = [
|
|
|
10
10
|
deployAdminSubdirIssue127,
|
|
11
11
|
legacyPagesArtifactsIssue184,
|
|
12
12
|
legacyPagesWranglerIssue184,
|
|
13
|
+
missing404TemplateIssue189,
|
|
13
14
|
deployMgmtConfigFieldsIssue187,
|
|
14
15
|
];
|
|
15
16
|
/**
|
|
@@ -21,6 +21,13 @@ export type DetectionPattern = {
|
|
|
21
21
|
patterns: string[];
|
|
22
22
|
/** 各正規表現に付与するフラグ(既定 'm') */
|
|
23
23
|
flags?: string;
|
|
24
|
+
/**
|
|
25
|
+
* 「あるべきファイルが欠けている」ことを条件に加える(任意)。
|
|
26
|
+
* 指定した相対パスのファイルが**存在する**場合は、検出がヒットしても finding にしない
|
|
27
|
+
* (=要件が満たされている)。files/patterns で「移行済み(Workers 構成)である」ことを
|
|
28
|
+
* 判定しつつ、absentFile の欠落だけを警告するために使う(例: 404 テンプレ未整備)。
|
|
29
|
+
*/
|
|
30
|
+
absentFile?: string;
|
|
24
31
|
};
|
|
25
32
|
/** 1件のマイグレーション(破壊的変更への追従単位) */
|
|
26
33
|
export type Migration = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c-time/frelio-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Frelio CMS setup CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"prepublishOnly": "npm run build"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@c-time/frelio-data-json": "^2.
|
|
27
|
-
"@c-time/frelio-gentl": "^2.
|
|
26
|
+
"@c-time/frelio-data-json": "^2.1.0",
|
|
27
|
+
"@c-time/frelio-gentl": "^2.1.0",
|
|
28
28
|
"commander": "^13.0.0",
|
|
29
29
|
"prompts": "^2.4.2",
|
|
30
30
|
"tar": "^7.0.0"
|