@skspwork/config-doc 2.0.4 → 2.0.5

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.
Files changed (78) hide show
  1. package/package.json +2 -2
  2. package/packages/web/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  3. package/packages/web/.next/standalone/.next/server/app/_not-found.html +1 -1
  4. package/packages/web/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  5. package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  6. package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  7. package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  8. package/packages/web/.next/standalone/.next/server/app/api/config/save/route.js +1 -1
  9. package/packages/web/.next/standalone/.next/server/app/api/config/save/route.js.nft.json +1 -1
  10. package/packages/web/.next/standalone/.next/server/app/api/export/route.js +3 -3
  11. package/packages/web/.next/standalone/.next/server/app/api/export/route.js.nft.json +1 -1
  12. package/packages/web/.next/standalone/.next/server/app/index.html +1 -1
  13. package/packages/web/.next/standalone/.next/server/app/index.rsc +3 -3
  14. package/packages/web/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  15. package/packages/web/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  16. package/packages/web/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  17. package/packages/web/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  18. package/packages/web/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  19. package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__40e87302._.js +3 -0
  20. package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__93da9fce._.js +1 -1
  21. package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__c9655ac8._.js +3 -0
  22. package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__e19366f6._.js +1 -1
  23. package/packages/web/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_d09de205.js +345 -27
  24. package/packages/web/.next/standalone/.next/server/chunks/ssr/app_page_tsx_55b2e5ee._.js +1 -1
  25. package/packages/web/.next/standalone/.next/server/pages/404.html +1 -1
  26. package/packages/web/.next/standalone/.next/static/chunks/02de70e4c30afe2f.js +1 -0
  27. package/packages/web/.next/standalone/.next/static/chunks/862e384b52cfebf3.css +3 -0
  28. package/packages/web/.next/standalone/app/api/config/metadata/route.ts +5 -3
  29. package/packages/web/.next/standalone/playwright-report/index.html +1 -1
  30. package/packages/web/.next/static/chunks/02de70e4c30afe2f.js +1 -0
  31. package/packages/web/.next/static/chunks/862e384b52cfebf3.css +3 -0
  32. package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__1a68b1f3._.js +0 -3
  33. package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__2c94dfea._.js +0 -3
  34. package/packages/web/.next/standalone/.next/static/chunks/9726c2cde77e0916.js +0 -1
  35. package/packages/web/.next/standalone/.next/static/chunks/cd878566fda12635.css +0 -3
  36. package/packages/web/.next/standalone/app/api/config/load/route.ts +0 -57
  37. package/packages/web/.next/standalone/app/api/config/save/route.ts +0 -73
  38. package/packages/web/.next/standalone/app/api/export/route.ts +0 -75
  39. package/packages/web/.next/standalone/app/api/export/settings/route.ts +0 -144
  40. package/packages/web/.next/standalone/app/api/files/browse/route.ts +0 -46
  41. package/packages/web/.next/standalone/app/api/project/route.ts +0 -41
  42. package/packages/web/.next/standalone/app/globals.css +0 -26
  43. package/packages/web/.next/standalone/app/icon.svg +0 -41
  44. package/packages/web/.next/standalone/app/layout.tsx +0 -34
  45. package/packages/web/.next/standalone/app/page.tsx +0 -135
  46. package/packages/web/.next/standalone/components/ConfigFileTabs.tsx +0 -188
  47. package/packages/web/.next/standalone/components/ConfigTree.tsx +0 -176
  48. package/packages/web/.next/standalone/components/EditableList.tsx +0 -337
  49. package/packages/web/.next/standalone/components/ExportDialog.tsx +0 -234
  50. package/packages/web/.next/standalone/components/FieldsEditor.tsx +0 -92
  51. package/packages/web/.next/standalone/components/FileBrowser.tsx +0 -290
  52. package/packages/web/.next/standalone/components/Header.tsx +0 -37
  53. package/packages/web/.next/standalone/components/PropertyEditor.tsx +0 -102
  54. package/packages/web/.next/standalone/components/TagEditor.tsx +0 -86
  55. package/packages/web/.next/standalone/components/Toast.tsx +0 -91
  56. package/packages/web/.next/standalone/eslint.config.mjs +0 -18
  57. package/packages/web/.next/standalone/hooks/useConfigManager.ts +0 -653
  58. package/packages/web/.next/standalone/lib/configManagerUtils.ts +0 -84
  59. package/packages/web/.next/standalone/lib/configParser.ts +0 -155
  60. package/packages/web/.next/standalone/lib/fileSystem.ts +0 -186
  61. package/packages/web/.next/standalone/lib/getRootPath.ts +0 -45
  62. package/packages/web/.next/standalone/lib/htmlGenerator.ts +0 -865
  63. package/packages/web/.next/standalone/lib/jsonUtils.ts +0 -26
  64. package/packages/web/.next/standalone/lib/markdownGenerator.ts +0 -110
  65. package/packages/web/.next/standalone/lib/markdownTableGenerator.ts +0 -103
  66. package/packages/web/.next/standalone/lib/storage.ts +0 -104
  67. package/packages/web/.next/standalone/lib/utils.ts +0 -89
  68. package/packages/web/.next/standalone/next.config.ts +0 -10
  69. package/packages/web/.next/standalone/package-lock.json +0 -8216
  70. package/packages/web/.next/standalone/playwright.config.ts +0 -27
  71. package/packages/web/.next/standalone/postcss.config.mjs +0 -7
  72. package/packages/web/.next/standalone/test-results/.last-run.json +0 -4
  73. package/packages/web/.next/standalone/tsconfig.json +0 -34
  74. package/packages/web/.next/standalone/tsconfig.tsbuildinfo +0 -1
  75. package/packages/web/.next/standalone/types/index.ts +0 -74
  76. package/packages/web/.next/standalone/vitest.config.ts +0 -14
  77. package/packages/web/.next/static/chunks/9726c2cde77e0916.js +0 -1
  78. package/packages/web/.next/static/chunks/cd878566fda12635.css +0 -3
@@ -1,26 +0,0 @@
1
- import { parse } from 'jsonc-parser';
2
-
3
- /**
4
- * BOM(Byte Order Mark)を除去してJSONをパースする
5
- * UTF-8 BOM (0xFEFF) が含まれているJSONファイルをパースする際に使用
6
- * JSONC形式(コメント、末尾カンマ)にも対応
7
- */
8
- export function parseJSON<T = unknown>(content: string): T {
9
- // UTF-8 BOM (EF BB BF) を除去
10
- const cleanContent = content.charCodeAt(0) === 0xFEFF
11
- ? content.slice(1)
12
- : content;
13
-
14
- return parse(cleanContent) as T;
15
- }
16
-
17
- /**
18
- * BOM(Byte Order Mark)を除去する
19
- * UTF-8 BOM (0xFEFF) が含まれている文字列をクリーンアップ
20
- */
21
- export function removeBOM(content: string): string {
22
- if (content.charCodeAt(0) === 0xFEFF) {
23
- return content.slice(1);
24
- }
25
- return content;
26
- }
@@ -1,110 +0,0 @@
1
- import { FileSystemService } from './fileSystem';
2
- import { StorageService } from './storage';
3
- import { ConfigParser } from './configParser';
4
- import { sortTagsByOrder } from './configManagerUtils';
5
- import { getPropertyByPath } from './utils';
6
-
7
- export class MarkdownGenerator {
8
- private rootPath: string;
9
-
10
- constructor(rootPath: string) {
11
- this.rootPath = rootPath;
12
- }
13
-
14
- async generateMarkdown(): Promise<string> {
15
- const fsService = new FileSystemService(this.rootPath);
16
- const storageService = new StorageService(fsService);
17
-
18
- // プロジェクト設定を読み込む
19
- const settings = await fsService.loadProjectSettings();
20
- if (!settings || settings.configFiles.length === 0) {
21
- return '# 設定ファイルドキュメント\n\nドキュメント化された設定ファイルがありません。\n';
22
- }
23
-
24
- // フィールドの順序を取得
25
- const fieldKeys = settings.fields ? Object.keys(settings.fields) : [];
26
-
27
- // タグの順序を取得
28
- const availableTags = settings.availableTags || [];
29
-
30
- let markdown = '# 設定ファイルドキュメント\n\n';
31
- markdown += `プロジェクト: **${settings.projectName}**\n\n`;
32
- markdown += `最終更新: ${new Date().toLocaleString('ja-JP')}\n\n`;
33
- markdown += '---\n\n';
34
-
35
- // 各設定ファイルのドキュメントを生成
36
- for (const filePath of settings.configFiles) {
37
- const fileName = filePath.split(/[/\\]/).pop() || 'config.json';
38
- const docs = await storageService.loadAllDocs(filePath);
39
- const configData = await fsService.loadConfigFile(filePath);
40
-
41
- markdown += `## ${fileName}\n\n`;
42
- markdown += `**ファイルパス:** \`${filePath}\`\n\n`;
43
-
44
- // 設定ファイルから全プロパティを取得(オブジェクト型も含む)
45
- // ツリー構造の順序を保持するためソートしない
46
- const allPropertyPaths = ConfigParser.getAllPropertyPaths(configData);
47
-
48
- if (allPropertyPaths.length === 0) {
49
- markdown += '*プロパティがありません。*\n\n';
50
- continue;
51
- }
52
-
53
- markdown += '### プロパティ一覧\n\n';
54
-
55
- for (const propertyPath of allPropertyPaths) {
56
- const doc = docs.properties[propertyPath];
57
- const value = getPropertyByPath(configData, propertyPath);
58
-
59
- markdown += `#### \`${propertyPath}\`\n\n`;
60
-
61
- // 値を表示(プリミティブ値とプリミティブ配列)
62
- if (value !== undefined && value !== null) {
63
- const valueType = typeof value;
64
- const isArray = Array.isArray(value);
65
- const isObject = valueType === 'object' && !isArray;
66
-
67
- if (isArray) {
68
- // 配列の場合:要素がプリミティブならば表示
69
- const hasPrimitiveElements = value.length > 0 && value.every((item: any) =>
70
- typeof item !== 'object' || item === null
71
- );
72
- if (hasPrimitiveElements) {
73
- markdown += `**値:** \`${JSON.stringify(value)}\`\n\n`;
74
- }
75
- } else if (!isObject) {
76
- // プリミティブ値を表示
77
- markdown += `**値:** \`${String(value)}\`\n\n`;
78
- }
79
- }
80
-
81
- // ドキュメントがある場合
82
- if (doc) {
83
- if (doc.tags && doc.tags.length > 0) {
84
- const sortedTags = sortTagsByOrder(doc.tags, availableTags);
85
- markdown += `**タグ:** ${sortedTags.map(tag => `\`${tag}\``).join(', ')}\n\n`;
86
- }
87
-
88
- // フィールドをprojectFieldsの順序で表示
89
- if (doc.fields) {
90
- for (const fieldKey of fieldKeys) {
91
- const fieldValue = doc.fields[fieldKey];
92
- if (fieldValue) {
93
- markdown += `**${fieldKey}:**\n\n${fieldValue}\n\n`;
94
- }
95
- }
96
- }
97
- } else {
98
- // ドキュメントがない場合
99
- markdown += '*ドキュメントなし*\n\n';
100
- }
101
-
102
- markdown += '---\n\n';
103
- }
104
- }
105
-
106
- markdown += `\n*このドキュメントは ConfigDoc により自動生成されました。*\n`;
107
-
108
- return markdown;
109
- }
110
- }
@@ -1,103 +0,0 @@
1
- import { FileSystemService } from './fileSystem';
2
- import { StorageService } from './storage';
3
- import { escapeTableCell, getPropertyByPath, formatValue } from './utils';
4
- import { ConfigParser } from './configParser';
5
- import { sortTagsByOrder } from './configManagerUtils';
6
-
7
- export class MarkdownTableGenerator {
8
- private rootPath: string;
9
-
10
- constructor(rootPath: string) {
11
- this.rootPath = rootPath;
12
- }
13
-
14
- async generateMarkdownTable(): Promise<string> {
15
- const fsService = new FileSystemService(this.rootPath);
16
- const storageService = new StorageService(fsService);
17
-
18
- // プロジェクト設定を読み込む
19
- const settings = await fsService.loadProjectSettings();
20
- if (!settings || settings.configFiles.length === 0) {
21
- return '# 設定ファイルドキュメント\n\nドキュメント化された設定ファイルがありません。\n';
22
- }
23
-
24
- // フィールドの順序を取得(すべてのフィールドをテーブルの列として使用)
25
- const fieldKeys = settings.fields ? Object.keys(settings.fields) : [];
26
-
27
- // タグの順序を取得
28
- const availableTags = settings.availableTags || [];
29
-
30
- let markdown = '# 設定ファイルドキュメント\n\n';
31
- markdown += `プロジェクト: **${settings.projectName}**\n\n`;
32
- markdown += `最終更新: ${new Date().toLocaleString('ja-JP')}\n\n`;
33
- markdown += '---\n\n';
34
-
35
- // 各設定ファイルのドキュメントを生成
36
- for (const filePath of settings.configFiles) {
37
- const fileName = filePath.split(/[/\\]/).pop() || 'config.json';
38
- const docs = await storageService.loadAllDocs(filePath);
39
- const configData = await fsService.loadConfigFile(filePath);
40
-
41
- markdown += `## ${fileName}\n\n`;
42
- markdown += `**ファイルパス:** \`${filePath}\`\n\n`;
43
-
44
- // 設定ファイルから全プロパティを取得(オブジェクト型も含む)
45
- // ツリー構造の順序を保持するためソートしない
46
- const allPropertyPaths = ConfigParser.getAllPropertyPaths(configData);
47
-
48
- if (allPropertyPaths.length === 0) {
49
- markdown += '*プロパティがありません。*\n\n';
50
- continue;
51
- }
52
-
53
- // テーブルヘッダー(projectFieldsの順序で表示)
54
- markdown += '| プロパティ名 | タグ | 値 |';
55
- fieldKeys.forEach(label => {
56
- markdown += ` ${label} |`;
57
- });
58
- markdown += '\n';
59
-
60
- markdown += '|-------------|------|-----|';
61
- fieldKeys.forEach(() => {
62
- markdown += '------|';
63
- });
64
- markdown += '\n';
65
-
66
- // 各プロパティの行を追加
67
- for (const propertyPath of allPropertyPaths) {
68
- const doc = docs.properties[propertyPath];
69
- const propertyName = escapeTableCell(propertyPath);
70
- const sortedTags = doc && doc.tags && doc.tags.length > 0
71
- ? sortTagsByOrder(doc.tags, availableTags)
72
- : [];
73
- const tags = sortedTags.length > 0
74
- ? escapeTableCell(sortedTags.map(tag => `\`${tag}\``).join(', '))
75
- : '-';
76
-
77
- const value = this.getPropertyValue(configData, propertyPath);
78
- const valueStr = escapeTableCell(value);
79
-
80
- markdown += `| ${propertyName} | ${tags} | ${valueStr} |`;
81
-
82
- // フィールドの値をprojectFieldsの順序で追加
83
- fieldKeys.forEach(label => {
84
- const fieldValue = (doc && doc.fields && doc.fields[label]) || '-';
85
- markdown += ` ${escapeTableCell(fieldValue)} |`;
86
- });
87
-
88
- markdown += '\n';
89
- }
90
-
91
- markdown += '\n';
92
- }
93
-
94
- markdown += `\n*このドキュメントは ConfigDoc により自動生成されました。*\n`;
95
-
96
- return markdown;
97
- }
98
-
99
- private getPropertyValue(configData: unknown, propertyPath: string): string {
100
- const value = getPropertyByPath(configData, propertyPath);
101
- return formatValue(value);
102
- }
103
- }
@@ -1,104 +0,0 @@
1
- import { FileSystemService } from './fileSystem';
2
- import { ConfigDocs, PropertyDoc } from '@/types';
3
- import path from 'path';
4
-
5
- export class StorageService {
6
- constructor(private fs: FileSystemService) {}
7
-
8
- async savePropertyDoc(
9
- configFilePath: string,
10
- propertyPath: string,
11
- propertyDoc: PropertyDoc
12
- ): Promise<void> {
13
- const docsFileName = this.getDocsFileName(configFilePath);
14
-
15
- // 絶対パスを相対パスに変換
16
- const relativeConfigPath = this.toRelativePath(configFilePath);
17
-
18
- let docs = await this.fs.loadConfigDocs(docsFileName);
19
- if (!docs) {
20
- docs = {
21
- configFilePath: relativeConfigPath,
22
- lastModified: new Date().toISOString(),
23
- properties: {}
24
- };
25
- }
26
-
27
- docs.properties[propertyPath] = propertyDoc;
28
- docs.lastModified = new Date().toISOString();
29
- docs.configFilePath = relativeConfigPath; // 常に相対パスを保存
30
-
31
- await this.fs.saveConfigDocs(docsFileName, docs);
32
- }
33
-
34
- async updateAllProperties(
35
- configFilePath: string,
36
- properties: Record<string, PropertyDoc>
37
- ): Promise<void> {
38
- const docsFileName = this.getDocsFileName(configFilePath);
39
-
40
- // 絶対パスを相対パスに変換
41
- const relativeConfigPath = this.toRelativePath(configFilePath);
42
-
43
- let docs = await this.fs.loadConfigDocs(docsFileName);
44
- if (!docs) {
45
- docs = {
46
- configFilePath: relativeConfigPath,
47
- lastModified: new Date().toISOString(),
48
- properties: {}
49
- };
50
- }
51
-
52
- docs.properties = properties;
53
- docs.lastModified = new Date().toISOString();
54
- docs.configFilePath = relativeConfigPath;
55
-
56
- await this.fs.saveConfigDocs(docsFileName, docs);
57
- }
58
-
59
- async loadAllDocs(configFilePath: string): Promise<ConfigDocs> {
60
- const docsFileName = this.getDocsFileName(configFilePath);
61
- const docs = await this.fs.loadConfigDocs(docsFileName);
62
-
63
- // 絶対パスを相対パスに変換
64
- const relativeConfigPath = this.toRelativePath(configFilePath);
65
-
66
- return docs || {
67
- configFilePath: relativeConfigPath,
68
- lastModified: new Date().toISOString(),
69
- properties: {}
70
- };
71
- }
72
-
73
- // 公開メソッド: docsファイル名を取得
74
- public getDocsFileName(configFilePath: string): string {
75
- // 相対パスに変換してから処理
76
- const relativePath = this.toRelativePath(configFilePath);
77
-
78
- // パスの深さが1以下(ルート直下のファイル)の場合は、シンプルなファイル名
79
- const pathParts = relativePath.split(/[/\\]/).filter(p => p && p !== '.');
80
-
81
- if (pathParts.length <= 1) {
82
- // ルート直下のファイル: components.json → components.docs.json
83
- const fileName = pathParts[0] || 'config.json';
84
- return fileName.replace('.json', '.docs.json');
85
- } else {
86
- // サブディレクトリのファイル: 相対パスを含めて一意にする
87
- // 例: ../SimMoney/components.json → __SimMoney_components.docs.json
88
- // 例: sample/appsettings.json → sample_appsettings.docs.json
89
- const normalized = relativePath
90
- .replace(/\.\./g, '__') // .. を __ に変換
91
- .replace(/[/\\]/g, '_') // / と \ を _ に変換
92
- .replace(/:/g, ''); // : を削除
93
- return normalized.replace('.json', '.docs.json');
94
- }
95
- }
96
-
97
- private toRelativePath(filePath: string): string {
98
- // 絶対パスの場合は相対パスに変換
99
- if (path.isAbsolute(filePath)) {
100
- return path.relative(this.fs['rootPath'], filePath);
101
- }
102
- return filePath;
103
- }
104
- }
@@ -1,89 +0,0 @@
1
- /**
2
- * 共通ユーティリティ関数
3
- */
4
-
5
- /**
6
- * Markdownテーブルのセル内で特殊文字をエスケープ
7
- */
8
- export function escapeTableCell(text: string): string {
9
- return text
10
- .replace(/\|/g, '\\|') // パイプをエスケープ
11
- .replace(/\n/g, '<br>') // 改行をHTMLのbrタグに変換
12
- .replace(/\r/g, ''); // キャリッジリターンを削除
13
- }
14
-
15
- /**
16
- * HTMLの特殊文字をエスケープ
17
- */
18
- export function escapeHtml(text: string): string {
19
- return text
20
- .replace(/&/g, '&amp;')
21
- .replace(/</g, '&lt;')
22
- .replace(/>/g, '&gt;')
23
- .replace(/"/g, '&quot;')
24
- .replace(/'/g, '&#039;');
25
- }
26
-
27
- /**
28
- * ネストしたオブジェクトからプロパティパスで値を取得
29
- * @param obj 対象オブジェクト
30
- * @param propertyPath コロン区切りのプロパティパス(例: "Database:ConnectionString" または "Servers[0]:Name")
31
- * @returns 見つかった値、または undefined
32
- */
33
- export function getPropertyByPath(obj: unknown, propertyPath: string): unknown {
34
- // "Servers[0]:Name" -> ["Servers", "[0]", "Name"]
35
- const keys = propertyPath.split(/(?=\[)|:/);
36
- let value: unknown = obj;
37
-
38
- for (const key of keys) {
39
- if (value === undefined || value === null) return undefined;
40
-
41
- if (key.startsWith('[') && key.endsWith(']')) {
42
- // 配列インデックス
43
- const index = parseInt(key.slice(1, -1), 10);
44
- if (Array.isArray(value)) {
45
- value = value[index];
46
- } else {
47
- return undefined;
48
- }
49
- } else if (key && typeof value === 'object' && key in value) {
50
- value = (value as Record<string, unknown>)[key];
51
- } else if (key) {
52
- return undefined;
53
- }
54
- }
55
-
56
- return value;
57
- }
58
-
59
- /**
60
- * 値を表示用の文字列に変換
61
- * プリミティブ値とプリミティブ配列のみ表示し、オブジェクトとオブジェクト配列は'-'を返す
62
- */
63
- export function formatValue(value: unknown): string {
64
- if (value === null || value === undefined) {
65
- return '-';
66
- }
67
-
68
- const valueType = typeof value;
69
- const isArray = Array.isArray(value);
70
- const isObject = valueType === 'object' && !isArray;
71
-
72
- if (isArray) {
73
- // 配列の場合:要素がプリミティブならば表示
74
- const hasPrimitiveElements = value.length > 0 && value.every((item: any) =>
75
- typeof item !== 'object' || item === null
76
- );
77
- if (hasPrimitiveElements) {
78
- return JSON.stringify(value);
79
- }
80
- // オブジェクト配列の場合は表示しない
81
- return '-';
82
- } else if (isObject) {
83
- // オブジェクトの場合は表示しない
84
- return '-';
85
- }
86
-
87
- // プリミティブ値を表示
88
- return String(value);
89
- }
@@ -1,10 +0,0 @@
1
- import type { NextConfig } from "next";
2
-
3
- const nextConfig: NextConfig = {
4
- output: 'standalone',
5
- generateBuildId: async () => {
6
- return 'config-doc-build'
7
- }
8
- };
9
-
10
- export default nextConfig;