create-specment 0.2.8 → 0.3.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/bin/commands/create.d.ts +0 -1
- package/bin/constants/languages.d.ts +0 -1
- package/bin/core/interactive-setup.d.ts +0 -1
- package/bin/core/interactive-setup.js +17 -10
- package/bin/core/interactive-setup.js.map +1 -1
- package/bin/core/interactive-setup.test.d.ts +0 -1
- package/bin/core/interactive-setup.test.js +7 -7
- package/bin/core/interactive-setup.test.js.map +1 -1
- package/bin/core/project-generator.d.ts +0 -1
- package/bin/core/project-generator.js +5 -8
- package/bin/core/project-generator.js.map +1 -1
- package/bin/features/index.d.ts +0 -1
- package/bin/features/index.js +15 -13
- package/bin/features/index.js.map +1 -1
- package/bin/generators/docusaurus-config.d.ts +0 -1
- package/bin/generators/docusaurus-config.js +211 -264
- package/bin/generators/docusaurus-config.js.map +1 -1
- package/bin/generators/package-json.d.ts +0 -1
- package/bin/generators/package-json.js +45 -91
- package/bin/generators/package-json.js.map +1 -1
- package/bin/generators/template-files.d.ts +0 -1
- package/bin/generators/template-files.js +625 -229
- package/bin/generators/template-files.js.map +1 -1
- package/bin/index.d.ts +0 -1
- package/bin/index.js.map +1 -1
- package/bin/templates/index.d.ts +0 -1
- package/bin/templates/index.js +36 -24
- package/bin/templates/index.js.map +1 -1
- package/bin/tests/integration.test.d.ts +0 -1
- package/bin/tests/integration.test.js +34 -34
- package/bin/tests/integration.test.js.map +1 -1
- package/bin/types/index.d.ts +1 -21
- package/bin/utils/config-merger.d.ts +0 -1
- package/bin/utils/config-merger.js +0 -1
- package/bin/utils/config-merger.js.map +1 -1
- package/bin/utils/errors.d.ts +0 -1
- package/bin/utils/install.d.ts +0 -1
- package/bin/utils/install.js +3 -3
- package/bin/utils/install.js.map +1 -1
- package/bin/utils/message-formatter.d.ts +0 -1
- package/bin/utils/template-processor.d.ts +0 -1
- package/bin/utils/template-processor.js +2 -3
- package/bin/utils/template-processor.js.map +1 -1
- package/bin/utils/template-processor.test.d.ts +0 -1
- package/bin/utils/template-processor.test.js +22 -22
- package/bin/utils/template-processor.test.js.map +1 -1
- package/bin/utils/version.d.ts +0 -1
- package/bin/utils/version.js +3 -3
- package/bin/utils/version.js.map +1 -1
- package/package.json +2 -7
- package/templates/docs/01-overview/_assumptions-constraints.mdx +19 -0
- package/templates/docs/01-overview/_business-context.mdx +18 -0
- package/templates/docs/01-overview/_firm-proposal.mdx +52 -0
- package/templates/docs/01-overview/_gap-analysis.mdx +18 -0
- package/templates/docs/01-overview/_project/342/200/221charter.mdx +23 -0
- package/templates/docs/01-overview/_requirements-specification.mdx +73 -0
- package/templates/docs/01-overview/_risks.mdx +16 -0
- package/templates/docs/01-overview/_scope.mdx +24 -0
- package/templates/docs/01-overview/_stakeholders.mdx +24 -0
- package/templates/docs/01-overview/as-is.mdx +64 -0
- package/templates/docs/01-overview/glossary.mdx +41 -0
- package/templates/docs/01-overview/index.mdx +41 -0
- package/templates/docs/01-overview/odsc.mdx +72 -0
- package/templates/docs/01-overview/roadmap.mdx +27 -0
- package/templates/docs/01-overview/system-context.mdx +22 -0
- package/templates/docs/01-overview/to-be.mdx +102 -0
- package/templates/docs/02-requirements/_category_.yaml +2 -0
- package/templates/docs/02-requirements/functional/_category_.json +8 -0
- package/templates/docs/02-requirements/functional/_req-template.mdx +46 -0
- package/templates/docs/02-requirements/functional/req-001.mdx +52 -0
- package/templates/docs/02-requirements/index.mdx +14 -0
- package/templates/docs/02-requirements/non-functional/_category_.json +8 -0
- package/templates/docs/02-requirements/non-functional/_nfr-template.mdx +42 -0
- package/templates/docs/02-requirements/non-functional/nfr-001.mdx +57 -0
- package/templates/docs/02-requirements/non-functional/nfr-002.mdx +57 -0
- package/templates/docs/03-external/business-model.mdx +14 -0
- package/templates/docs/03-external/img/business-model-by-claude.xml +107 -0
- package/templates/docs/03-external/img/business-model.xml +84 -0
- package/templates/docs/03-external/img/docsVersionDropdown.png +0 -0
- package/templates/docs/03-external/img/gantt.xml +1 -0
- package/templates/docs/03-external/img/localeDropdown.png +0 -0
- package/templates/docs/03-external/index.mdx +46 -0
- package/templates/docs/04-internal/batches/_category_.yaml +2 -0
- package/templates/docs/04-internal/batches/import-products.mdx +64 -0
- package/templates/docs/04-internal/batches/index.mdx +25 -0
- package/templates/docs/04-internal/index.mdx +32 -0
- package/templates/docs/04-internal/policies/_category_.yaml +2 -0
- package/templates/docs/04-internal/policies/branch-naming-rules.mdx +110 -0
- package/templates/docs/04-internal/policies/github.mdx +100 -0
- package/templates/docs/04-internal/policies/pull-request-operation-flow.mdx +118 -0
- package/templates/docs/04-internal/rules/_category_.yaml +2 -0
- package/templates/docs/04-internal/rules/database.mdx +139 -0
- package/templates/docs/04-internal/rules/document-creation-rules.mdx +39 -0
- package/templates/docs/04-internal/rules/index.mdx +10 -0
- package/templates/docs/04-internal/rules/markdown.mdx +148 -0
- package/templates/docs/04-internal/rules/review-process.mdx +32 -0
- package/templates/docs/04-internal/screens/_category_.yaml +2 -0
- package/templates/docs/04-internal/screens/dashboard.mdx +17 -0
- package/templates/docs/04-internal/screens/index.mdx +20 -0
- package/templates/docs/04-internal/screens/login.mdx +18 -0
- package/templates/docs/04-internal/screens/menu.mdx +17 -0
- package/templates/docs/04-internal/tables/_category_.yaml +2 -0
- package/templates/docs/04-internal/tables/customer_details.mdx +35 -0
- package/templates/docs/04-internal/tables/customers.mdx +35 -0
- package/templates/docs/04-internal/tables/index.mdx +11 -0
- package/templates/docs/index.module.css +96 -0
- package/templates/docs/index.tsx +48 -0
- package/templates/docs/intro.md +47 -0
- package/templates/docs/introduction/document-editing/_category_.yml +2 -0
- package/templates/docs/introduction/document-editing/how-to.mdx +31 -0
- package/templates/docs/introduction/index.mdx +35 -0
- package/templates/docs/introduction/operational-policies/_category_.yaml +2 -0
- package/templates/docs/introduction/operational-policies/github.mdx +33 -0
- package/templates/docs/introduction/operational-policies/img/branch-naming-rules.svg +73 -0
- package/templates/docs/introduction/operational-policies/sharepoint.mdx +28 -0
- package/templates/package.json.template +46 -0
- package/templates/src/components/Highlight/index.tsx +68 -0
- package/templates/src/components/PriorityMatrix/index.tsx +97 -0
- package/templates/src/components/TBD/index.tsx +16 -0
- package/templates/src/css/custom.css +81 -0
- package/templates/src/types/requirements.ts +19 -0
- package/templates/static/img/business-model.drawio.svg +4 -0
- package/templates/static/img/gantt.drawio.svg +1152 -0
- package/templates/static/img/logo.svg +21 -0
- package/bin/commands/create.d.ts.map +0 -1
- package/bin/constants/languages.d.ts.map +0 -1
- package/bin/core/interactive-setup.d.ts.map +0 -1
- package/bin/core/interactive-setup.test.d.ts.map +0 -1
- package/bin/core/project-generator.d.ts.map +0 -1
- package/bin/features/index.d.ts.map +0 -1
- package/bin/generators/docusaurus-config.d.ts.map +0 -1
- package/bin/generators/package-json.d.ts.map +0 -1
- package/bin/generators/template-files.d.ts.map +0 -1
- package/bin/index.d.ts.map +0 -1
- package/bin/plugins/i18n-integration.d.ts +0 -25
- package/bin/plugins/i18n-integration.d.ts.map +0 -1
- package/bin/plugins/i18n-integration.js +0 -310
- package/bin/plugins/i18n-integration.js.map +0 -1
- package/bin/plugins/plantuml-integration.d.ts +0 -17
- package/bin/plugins/plantuml-integration.d.ts.map +0 -1
- package/bin/plugins/plantuml-integration.js +0 -112
- package/bin/plugins/plantuml-integration.js.map +0 -1
- package/bin/plugins/redoc-integration.d.ts +0 -25
- package/bin/plugins/redoc-integration.d.ts.map +0 -1
- package/bin/plugins/redoc-integration.js +0 -373
- package/bin/plugins/redoc-integration.js.map +0 -1
- package/bin/plugins/search-integration.d.ts +0 -20
- package/bin/plugins/search-integration.d.ts.map +0 -1
- package/bin/plugins/search-integration.js +0 -169
- package/bin/plugins/search-integration.js.map +0 -1
- package/bin/templates/index.d.ts.map +0 -1
- package/bin/templates/template-definitions.d.ts +0 -10
- package/bin/templates/template-definitions.d.ts.map +0 -1
- package/bin/templates/template-definitions.js +0 -517
- package/bin/templates/template-definitions.js.map +0 -1
- package/bin/tests/integration.test.d.ts.map +0 -1
- package/bin/types/index.d.ts.map +0 -1
- package/bin/utils/config-merger.d.ts.map +0 -1
- package/bin/utils/errors.d.ts.map +0 -1
- package/bin/utils/install.d.ts.map +0 -1
- package/bin/utils/message-formatter.d.ts.map +0 -1
- package/bin/utils/template-processor.d.ts.map +0 -1
- package/bin/utils/template-processor.test.d.ts.map +0 -1
- package/bin/utils/version.d.ts.map +0 -1
- package/templates/classic-spec/docusaurus.config.js.template +0 -106
- package/templates/classic-spec/package.json.template +0 -36
- package/templates/external-design/docusaurus.config.js.template +0 -123
- package/templates/external-design/package.json.template +0 -36
- package/templates/internal-design/docusaurus.config.js.template +0 -123
- package/templates/internal-design/package.json.template +0 -36
- package/templates/project-analysis/docusaurus.config.js.template +0 -113
- package/templates/project-analysis/package.json.template +0 -36
- package/templates/requirements/docusaurus.config.js.template +0 -119
- package/templates/requirements/package.json.template +0 -36
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { mkdir, writeFile, access } from '
|
|
2
|
-
import { join, resolve } from '
|
|
3
|
-
import { existsSync, constants } from '
|
|
1
|
+
import { mkdir, writeFile, access, cp } from 'fs/promises';
|
|
2
|
+
import { join, resolve, dirname } from 'path';
|
|
3
|
+
import { existsSync, constants } from 'fs';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
4
5
|
import { createTemplateProcessor } from '../utils/template-processor.js';
|
|
5
|
-
|
|
6
|
+
// プロジェクト内のテンプレートディレクトリのパス
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
const TEMPLATE_DOCS_PATH = resolve(__dirname, '../../templates/docs');
|
|
6
10
|
export async function copyTemplateFiles(selections, projectPath) {
|
|
7
11
|
const { templates, projectName } = selections;
|
|
8
12
|
// プロジェクトパスの検証
|
|
@@ -13,56 +17,44 @@ export async function copyTemplateFiles(selections, projectPath) {
|
|
|
13
17
|
templateName: primaryTemplate.name,
|
|
14
18
|
templateDisplayName: primaryTemplate.displayName,
|
|
15
19
|
});
|
|
16
|
-
// 全テンプレートのディレクトリ構造を統合
|
|
17
|
-
const combinedStructure = combineTemplateStructures(templates);
|
|
18
20
|
// ディレクトリ構造を作成
|
|
19
|
-
await createDirectoryStructure(projectPath
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
await createDirectoryStructure(projectPath);
|
|
22
|
+
// API機能が有効な場合はOpenAPIファイルとディレクトリを生成
|
|
23
|
+
const hasApiFeature = selections.features.some(f => f.enabled && f.name === 'redoc');
|
|
24
|
+
if (hasApiFeature) {
|
|
25
|
+
await generateOpenAPIFiles(projectPath);
|
|
26
|
+
}
|
|
27
|
+
// 基本ファイルを生成(選択されたテンプレート配列を渡す)
|
|
28
|
+
await generateSidebarsConfig(projectPath, templates, processor);
|
|
29
|
+
// 参考リポジトリから基本ファイルをコピー
|
|
30
|
+
await copyFromReferenceRepo(projectPath, ['introduction']);
|
|
31
|
+
// ルートページファイルをコピー
|
|
32
|
+
await copyRootPageFiles(projectPath);
|
|
33
|
+
// intro.mdもコピー
|
|
34
|
+
const introSourcePath = join(TEMPLATE_DOCS_PATH, 'intro.md');
|
|
35
|
+
const introTargetPath = join(projectPath, 'docs', 'intro.md');
|
|
36
|
+
if (existsSync(introSourcePath)) {
|
|
37
|
+
try {
|
|
38
|
+
await cp(introSourcePath, introTargetPath);
|
|
39
|
+
console.log('Copied intro.md from template');
|
|
26
40
|
}
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.warn(`Failed to copy intro.md: ${error}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// 各テンプレートに対応するディレクトリをコピー
|
|
46
|
+
for (const template of templates) {
|
|
47
|
+
await copyTemplateDirectory(projectPath, template.name);
|
|
29
48
|
}
|
|
30
|
-
// 基本ファイルを生成(最初のテンプレートベース)
|
|
31
|
-
await generateSidebarsConfig(projectPath, primaryTemplate.name, processor);
|
|
32
49
|
await generateCustomCSS(projectPath);
|
|
33
50
|
await generateStaticFiles(projectPath, processor);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
for (const template of templates) {
|
|
42
|
-
const templateDef = getTemplateDefinition(template.name);
|
|
43
|
-
if (templateDef?.directoryStructure) {
|
|
44
|
-
if (templateDef.directoryStructure.docs) {
|
|
45
|
-
for (const dir of templateDef.directoryStructure.docs) {
|
|
46
|
-
combined.docs.add(dir);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (templateDef.directoryStructure.static) {
|
|
50
|
-
for (const dir of templateDef.directoryStructure.static) {
|
|
51
|
-
combined.static.add(dir);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (templateDef.directoryStructure.src) {
|
|
55
|
-
for (const dir of templateDef.directoryStructure.src) {
|
|
56
|
-
combined.src.add(dir);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
51
|
+
await copyStaticAssets(projectPath);
|
|
52
|
+
await generateTBDComponent(projectPath);
|
|
53
|
+
// 要件定義テンプレートが選択されている場合はPriorityMatrixコンポーネントをコピー
|
|
54
|
+
const hasRequirementsTemplate = templates.some(template => template.name === 'requirements');
|
|
55
|
+
if (hasRequirementsTemplate) {
|
|
56
|
+
await generatePriorityMatrixComponent(projectPath);
|
|
60
57
|
}
|
|
61
|
-
return {
|
|
62
|
-
docs: Array.from(combined.docs),
|
|
63
|
-
static: Array.from(combined.static),
|
|
64
|
-
src: Array.from(combined.src),
|
|
65
|
-
};
|
|
66
58
|
}
|
|
67
59
|
async function validateProjectPath(projectPath) {
|
|
68
60
|
const resolvedPath = resolve(projectPath);
|
|
@@ -78,201 +70,49 @@ async function validateProjectPath(projectPath) {
|
|
|
78
70
|
throw new Error(`No write permission for directory: ${resolvedPath}`);
|
|
79
71
|
}
|
|
80
72
|
}
|
|
81
|
-
async function createDirectoryStructure(projectPath
|
|
73
|
+
async function createDirectoryStructure(projectPath) {
|
|
82
74
|
// 基本ディレクトリを作成
|
|
83
75
|
const baseDirectories = ['docs', 'src/css', 'src/components', 'static/img'];
|
|
84
76
|
for (const dir of baseDirectories) {
|
|
85
77
|
const dirPath = join(projectPath, dir);
|
|
86
78
|
await mkdir(dirPath, { recursive: true });
|
|
87
79
|
}
|
|
88
|
-
// テンプレート固有のディレクトリを作成
|
|
89
|
-
if (structure.docs) {
|
|
90
|
-
for (const docDir of structure.docs) {
|
|
91
|
-
const dirPath = join(projectPath, 'docs', docDir);
|
|
92
|
-
await mkdir(dirPath, { recursive: true });
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (structure.static) {
|
|
96
|
-
for (const staticDir of structure.static) {
|
|
97
|
-
const dirPath = join(projectPath, 'static', staticDir);
|
|
98
|
-
await mkdir(dirPath, { recursive: true });
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (structure.src) {
|
|
102
|
-
for (const srcDir of structure.src) {
|
|
103
|
-
const dirPath = join(projectPath, 'src', srcDir);
|
|
104
|
-
await mkdir(dirPath, { recursive: true });
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
async function _generateTemplateFiles(projectPath, templateName, processor) {
|
|
109
|
-
const templateDir = join(process.cwd(), 'templates', templateName);
|
|
110
|
-
try {
|
|
111
|
-
// package.json.templateを処理
|
|
112
|
-
const packageJsonTemplate = join(templateDir, 'package.json.template');
|
|
113
|
-
const processedPackageJson = await processor.processTemplateFile(packageJsonTemplate);
|
|
114
|
-
await writeFile(join(projectPath, 'package.json'), processedPackageJson);
|
|
115
|
-
// docusaurus.config.js.templateを処理
|
|
116
|
-
const configTemplate = join(templateDir, 'docusaurus.config.js.template');
|
|
117
|
-
const processedConfig = await processor.processTemplateFile(configTemplate);
|
|
118
|
-
await writeFile(join(projectPath, 'docusaurus.config.js'), processedConfig);
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
console.error(`Error generating template files for ${templateName}:`, error);
|
|
122
|
-
throw error;
|
|
123
|
-
}
|
|
124
80
|
}
|
|
125
|
-
async function
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
81
|
+
async function generateSidebarsConfig(projectPath, selectedTemplates, processor) {
|
|
82
|
+
const sidebarSections = [];
|
|
83
|
+
// 常に含まれるセクション
|
|
84
|
+
sidebarSections.push('introduction: [{ type: \'autogenerated\', dirName: \'introduction\' }]');
|
|
85
|
+
// 選択されたテンプレートに応じてセクションを追加
|
|
86
|
+
for (const template of selectedTemplates) {
|
|
87
|
+
switch (template.name) {
|
|
88
|
+
case 'project-analysis':
|
|
89
|
+
sidebarSections.push('overview: [{ type: \'autogenerated\', dirName: \'overview\' }]');
|
|
90
|
+
break;
|
|
91
|
+
case 'requirements':
|
|
92
|
+
sidebarSections.push('requirements: [{ type: \'autogenerated\', dirName: \'requirements\' }]');
|
|
93
|
+
break;
|
|
94
|
+
case 'external-design':
|
|
95
|
+
sidebarSections.push('external: [{ type: \'autogenerated\', dirName: \'external\' }]');
|
|
96
|
+
break;
|
|
97
|
+
case 'internal-design':
|
|
98
|
+
sidebarSections.push('internal: [{ type: \'autogenerated\', dirName: \'internal\' }]');
|
|
99
|
+
break;
|
|
100
|
+
case 'api-spec':
|
|
101
|
+
// APIテンプレートの場合は特別なセクションは追加しない(Redocで表示)
|
|
102
|
+
break;
|
|
147
103
|
}
|
|
148
104
|
}
|
|
149
|
-
}
|
|
150
|
-
async function generateSidebarsConfig(projectPath, templateName, processor) {
|
|
151
|
-
const sidebarConfigs = {
|
|
152
|
-
'classic-spec': `// @ts-check
|
|
153
|
-
|
|
154
|
-
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
155
|
-
const sidebars = {
|
|
156
|
-
tutorialSidebar: [
|
|
157
|
-
'intro',
|
|
158
|
-
{
|
|
159
|
-
type: 'category',
|
|
160
|
-
label: 'Documentation',
|
|
161
|
-
items: ['getting-started', 'configuration']
|
|
162
|
-
}
|
|
163
|
-
]
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
module.exports = sidebars;`,
|
|
167
|
-
'project-analysis': `// @ts-check
|
|
168
|
-
|
|
169
|
-
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
170
|
-
const sidebars = {
|
|
171
|
-
analysisSidebar: [
|
|
172
|
-
{
|
|
173
|
-
type: 'category',
|
|
174
|
-
label: 'プロジェクト分析',
|
|
175
|
-
items: ['analysis/intro']
|
|
176
|
-
}
|
|
177
|
-
],
|
|
178
|
-
overviewSidebar: [
|
|
179
|
-
{
|
|
180
|
-
type: 'category',
|
|
181
|
-
label: 'プロジェクト概要',
|
|
182
|
-
items: ['overview/intro']
|
|
183
|
-
}
|
|
184
|
-
]
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
module.exports = sidebars;`,
|
|
188
|
-
requirements: `// @ts-check
|
|
189
|
-
|
|
190
|
-
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
191
|
-
const sidebars = {
|
|
192
|
-
requirementsSidebar: [
|
|
193
|
-
{
|
|
194
|
-
type: 'category',
|
|
195
|
-
label: '機能要件',
|
|
196
|
-
items: ['functional/intro']
|
|
197
|
-
}
|
|
198
|
-
],
|
|
199
|
-
functionalSidebar: [
|
|
200
|
-
{
|
|
201
|
-
type: 'category',
|
|
202
|
-
label: '機能要件詳細',
|
|
203
|
-
items: ['functional/intro']
|
|
204
|
-
}
|
|
205
|
-
],
|
|
206
|
-
nonFunctionalSidebar: [
|
|
207
|
-
{
|
|
208
|
-
type: 'category',
|
|
209
|
-
label: '非機能要件',
|
|
210
|
-
items: ['non-functional/intro']
|
|
211
|
-
}
|
|
212
|
-
]
|
|
213
|
-
};
|
|
105
|
+
const sidebarContent = `import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
|
|
214
106
|
|
|
215
|
-
|
|
216
|
-
'external-design': `// @ts-check
|
|
107
|
+
// https://docusaurus.io/docs/sidebar
|
|
217
108
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
architectureSidebar: [
|
|
221
|
-
{
|
|
222
|
-
type: 'category',
|
|
223
|
-
label: 'システムアーキテクチャ',
|
|
224
|
-
items: ['architecture/intro']
|
|
225
|
-
}
|
|
226
|
-
],
|
|
227
|
-
apiSidebar: [
|
|
228
|
-
{
|
|
229
|
-
type: 'category',
|
|
230
|
-
label: 'API設計',
|
|
231
|
-
items: ['api/intro']
|
|
232
|
-
}
|
|
233
|
-
],
|
|
234
|
-
uiSidebar: [
|
|
235
|
-
{
|
|
236
|
-
type: 'category',
|
|
237
|
-
label: 'UI/UX設計',
|
|
238
|
-
items: ['ui/intro']
|
|
239
|
-
}
|
|
240
|
-
]
|
|
109
|
+
const sidebars: SidebarsConfig = {
|
|
110
|
+
${sidebarSections.join(',\n ')},
|
|
241
111
|
};
|
|
242
112
|
|
|
243
|
-
|
|
244
|
-
'internal-design': `// @ts-check
|
|
245
|
-
|
|
246
|
-
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
247
|
-
const sidebars = {
|
|
248
|
-
implementationSidebar: [
|
|
249
|
-
{
|
|
250
|
-
type: 'category',
|
|
251
|
-
label: '実装詳細',
|
|
252
|
-
items: ['implementation/intro']
|
|
253
|
-
}
|
|
254
|
-
],
|
|
255
|
-
databaseSidebar: [
|
|
256
|
-
{
|
|
257
|
-
type: 'category',
|
|
258
|
-
label: 'データベース設計',
|
|
259
|
-
items: ['database/intro']
|
|
260
|
-
}
|
|
261
|
-
],
|
|
262
|
-
algorithmSidebar: [
|
|
263
|
-
{
|
|
264
|
-
type: 'category',
|
|
265
|
-
label: 'アルゴリズム',
|
|
266
|
-
items: ['algorithms/intro']
|
|
267
|
-
}
|
|
268
|
-
]
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
module.exports = sidebars;`,
|
|
272
|
-
};
|
|
273
|
-
const sidebarContent = sidebarConfigs[templateName] || sidebarConfigs['classic-spec'];
|
|
113
|
+
export default sidebars;`;
|
|
274
114
|
const processedContent = processor.processTemplate(sidebarContent);
|
|
275
|
-
await writeFile(join(projectPath, 'sidebars.
|
|
115
|
+
await writeFile(join(projectPath, 'sidebars.ts'), processedContent);
|
|
276
116
|
}
|
|
277
117
|
async function generateCustomCSS(projectPath) {
|
|
278
118
|
const cssContent = `/**
|
|
@@ -370,4 +210,560 @@ yarn-error.log*
|
|
|
370
210
|
`;
|
|
371
211
|
await writeFile(join(projectPath, '.gitignore'), gitignoreContent, 'utf8');
|
|
372
212
|
}
|
|
213
|
+
// ルートページファイルをコピー
|
|
214
|
+
async function copyRootPageFiles(projectPath) {
|
|
215
|
+
const srcPagesDir = join(projectPath, 'src', 'pages');
|
|
216
|
+
await mkdir(srcPagesDir, { recursive: true });
|
|
217
|
+
// index.tsxファイルをコピー(ユーザーが編集済み)
|
|
218
|
+
const indexSourcePath = join(TEMPLATE_DOCS_PATH, 'index.tsx');
|
|
219
|
+
const indexTargetPath = join(srcPagesDir, 'index.tsx');
|
|
220
|
+
if (existsSync(indexSourcePath)) {
|
|
221
|
+
try {
|
|
222
|
+
await cp(indexSourcePath, indexTargetPath);
|
|
223
|
+
console.log('Copied index.tsx to src/pages');
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
console.warn(`Failed to copy index.tsx: ${error}`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// index.module.cssファイルをコピー(参考リポジトリからコピー済み)
|
|
230
|
+
const cssSourcePath = join(TEMPLATE_DOCS_PATH, 'index.module.css');
|
|
231
|
+
const cssTargetPath = join(srcPagesDir, 'index.module.css');
|
|
232
|
+
if (existsSync(cssSourcePath)) {
|
|
233
|
+
try {
|
|
234
|
+
await cp(cssSourcePath, cssTargetPath);
|
|
235
|
+
console.log('Copied index.module.css to src/pages');
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
console.warn(`Failed to copy index.module.css: ${error}`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// プロジェクト内のテンプレートから基本ディレクトリをコピー
|
|
243
|
+
async function copyFromReferenceRepo(projectPath, directories) {
|
|
244
|
+
const docsPath = join(projectPath, 'docs');
|
|
245
|
+
for (const dir of directories) {
|
|
246
|
+
const sourcePath = join(TEMPLATE_DOCS_PATH, dir);
|
|
247
|
+
const targetPath = join(docsPath, dir);
|
|
248
|
+
if (existsSync(sourcePath)) {
|
|
249
|
+
try {
|
|
250
|
+
await cp(sourcePath, targetPath, { recursive: true });
|
|
251
|
+
console.log(`Copied ${dir} from template`);
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
254
|
+
console.warn(`Failed to copy ${dir}: ${error}`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
console.warn(`Template directory not found: ${sourcePath}`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// テンプレートに対応するディレクトリをコピー
|
|
263
|
+
async function copyTemplateDirectory(projectPath, templateName) {
|
|
264
|
+
const templateDirMap = {
|
|
265
|
+
'classic-spec': { source: 'introduction', target: 'introduction' },
|
|
266
|
+
'project-analysis': { source: '01-overview', target: 'overview' },
|
|
267
|
+
'requirements': { source: '02-requirements', target: 'requirements' },
|
|
268
|
+
'external-design': { source: '03-external', target: 'external' },
|
|
269
|
+
'internal-design': { source: '04-internal', target: 'internal' },
|
|
270
|
+
'technical-spec': { source: '04-internal', target: 'internal' }, // 技術仕様書は内部設計と同じディレクトリを使用
|
|
271
|
+
};
|
|
272
|
+
const dirMapping = templateDirMap[templateName];
|
|
273
|
+
if (!dirMapping) {
|
|
274
|
+
console.warn(`No directory mapping found for template: ${templateName}`);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const sourcePath = join(TEMPLATE_DOCS_PATH, dirMapping.source);
|
|
278
|
+
const targetPath = join(projectPath, 'docs', dirMapping.target);
|
|
279
|
+
if (existsSync(sourcePath)) {
|
|
280
|
+
try {
|
|
281
|
+
await cp(sourcePath, targetPath, { recursive: true });
|
|
282
|
+
console.log(`Copied ${dirMapping.source} directory for template: ${templateName}`);
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
console.warn(`Failed to copy ${dirMapping.source}: ${error}`);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
console.warn(`Template directory not found: ${sourcePath}`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
// OpenAPIファイルとディレクトリを生成
|
|
293
|
+
async function generateOpenAPIFiles(projectPath) {
|
|
294
|
+
// openapiディレクトリを作成
|
|
295
|
+
const openapiDir = join(projectPath, 'openapi');
|
|
296
|
+
await mkdir(openapiDir, { recursive: true });
|
|
297
|
+
// 参考リポジトリのOpenAPIファイルをコピー
|
|
298
|
+
const referenceOpenAPIPath = '/home/ohbayashi/projects/specment/openapi/openapi-single.yaml';
|
|
299
|
+
const targetOpenAPIPath = join(openapiDir, 'openapi-single.yaml');
|
|
300
|
+
if (existsSync(referenceOpenAPIPath)) {
|
|
301
|
+
try {
|
|
302
|
+
await cp(referenceOpenAPIPath, targetOpenAPIPath);
|
|
303
|
+
console.log('Copied OpenAPI specification from reference repository');
|
|
304
|
+
}
|
|
305
|
+
catch (error) {
|
|
306
|
+
console.warn(`Failed to copy OpenAPI file: ${error}`);
|
|
307
|
+
// フォールバック: サンプルOpenAPIファイルを生成
|
|
308
|
+
await generateSampleOpenAPIFile(targetOpenAPIPath);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
// 参考ファイルが見つからない場合はサンプルを生成
|
|
313
|
+
await generateSampleOpenAPIFile(targetOpenAPIPath);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// サンプルOpenAPIファイルを生成
|
|
317
|
+
async function generateSampleOpenAPIFile(filePath) {
|
|
318
|
+
const sampleOpenAPI = `openapi: 3.0.3
|
|
319
|
+
servers:
|
|
320
|
+
- url: //api.example.com/v1
|
|
321
|
+
description: プロダクションサーバー
|
|
322
|
+
- url: //staging-api.example.com/v1
|
|
323
|
+
description: ステージングサーバー
|
|
324
|
+
info:
|
|
325
|
+
description: |
|
|
326
|
+
これはサンプルAPIの仕様書です。
|
|
327
|
+
|
|
328
|
+
# はじめに
|
|
329
|
+
このAPIは **OpenAPI形式** でドキュメント化されており、RESTful APIの設計原則に従っています。
|
|
330
|
+
|
|
331
|
+
# 認証
|
|
332
|
+
このAPIはJWT(JSON Web Token)を使用したBearer認証を採用しています。
|
|
333
|
+
|
|
334
|
+
# レスポンス形式
|
|
335
|
+
すべてのAPIレスポンスはJSON形式で返されます。
|
|
336
|
+
|
|
337
|
+
version: 1.0.0
|
|
338
|
+
title: Sample API
|
|
339
|
+
contact:
|
|
340
|
+
name: APIサポート
|
|
341
|
+
email: support@example.com
|
|
342
|
+
license:
|
|
343
|
+
name: MIT
|
|
344
|
+
url: 'https://opensource.org/licenses/MIT'
|
|
345
|
+
tags:
|
|
346
|
+
- name: users
|
|
347
|
+
description: ユーザー管理
|
|
348
|
+
- name: auth
|
|
349
|
+
description: 認証・認可
|
|
350
|
+
paths:
|
|
351
|
+
/users:
|
|
352
|
+
get:
|
|
353
|
+
tags:
|
|
354
|
+
- users
|
|
355
|
+
summary: ユーザー一覧を取得
|
|
356
|
+
description: システムに登録されているユーザーの一覧を取得します
|
|
357
|
+
parameters:
|
|
358
|
+
- name: limit
|
|
359
|
+
in: query
|
|
360
|
+
description: 取得する件数の上限
|
|
361
|
+
required: false
|
|
362
|
+
schema:
|
|
363
|
+
type: integer
|
|
364
|
+
minimum: 1
|
|
365
|
+
maximum: 100
|
|
366
|
+
default: 20
|
|
367
|
+
- name: offset
|
|
368
|
+
in: query
|
|
369
|
+
description: 取得開始位置
|
|
370
|
+
required: false
|
|
371
|
+
schema:
|
|
372
|
+
type: integer
|
|
373
|
+
minimum: 0
|
|
374
|
+
default: 0
|
|
375
|
+
responses:
|
|
376
|
+
'200':
|
|
377
|
+
description: ユーザー一覧の取得に成功
|
|
378
|
+
content:
|
|
379
|
+
application/json:
|
|
380
|
+
schema:
|
|
381
|
+
type: object
|
|
382
|
+
properties:
|
|
383
|
+
users:
|
|
384
|
+
type: array
|
|
385
|
+
items:
|
|
386
|
+
$ref: '#/components/schemas/User'
|
|
387
|
+
total:
|
|
388
|
+
type: integer
|
|
389
|
+
description: 総件数
|
|
390
|
+
limit:
|
|
391
|
+
type: integer
|
|
392
|
+
description: 取得件数の上限
|
|
393
|
+
offset:
|
|
394
|
+
type: integer
|
|
395
|
+
description: 取得開始位置
|
|
396
|
+
'400':
|
|
397
|
+
description: リクエストパラメータが不正
|
|
398
|
+
content:
|
|
399
|
+
application/json:
|
|
400
|
+
schema:
|
|
401
|
+
$ref: '#/components/schemas/Error'
|
|
402
|
+
'500':
|
|
403
|
+
description: サーバーエラー
|
|
404
|
+
content:
|
|
405
|
+
application/json:
|
|
406
|
+
schema:
|
|
407
|
+
$ref: '#/components/schemas/Error'
|
|
408
|
+
security:
|
|
409
|
+
- BearerAuth: []
|
|
410
|
+
post:
|
|
411
|
+
tags:
|
|
412
|
+
- users
|
|
413
|
+
summary: 新しいユーザーを作成
|
|
414
|
+
description: 新しいユーザーをシステムに登録します
|
|
415
|
+
requestBody:
|
|
416
|
+
required: true
|
|
417
|
+
content:
|
|
418
|
+
application/json:
|
|
419
|
+
schema:
|
|
420
|
+
$ref: '#/components/schemas/CreateUserRequest'
|
|
421
|
+
responses:
|
|
422
|
+
'201':
|
|
423
|
+
description: ユーザーの作成に成功
|
|
424
|
+
content:
|
|
425
|
+
application/json:
|
|
426
|
+
schema:
|
|
427
|
+
$ref: '#/components/schemas/User'
|
|
428
|
+
'400':
|
|
429
|
+
description: リクエストボディが不正
|
|
430
|
+
content:
|
|
431
|
+
application/json:
|
|
432
|
+
schema:
|
|
433
|
+
$ref: '#/components/schemas/Error'
|
|
434
|
+
'409':
|
|
435
|
+
description: ユーザーが既に存在
|
|
436
|
+
content:
|
|
437
|
+
application/json:
|
|
438
|
+
schema:
|
|
439
|
+
$ref: '#/components/schemas/Error'
|
|
440
|
+
'500':
|
|
441
|
+
description: サーバーエラー
|
|
442
|
+
content:
|
|
443
|
+
application/json:
|
|
444
|
+
schema:
|
|
445
|
+
$ref: '#/components/schemas/Error'
|
|
446
|
+
security:
|
|
447
|
+
- BearerAuth: []
|
|
448
|
+
|
|
449
|
+
/users/{userId}:
|
|
450
|
+
get:
|
|
451
|
+
tags:
|
|
452
|
+
- users
|
|
453
|
+
summary: ユーザー詳細を取得
|
|
454
|
+
description: 指定されたIDのユーザー詳細情報を取得します
|
|
455
|
+
parameters:
|
|
456
|
+
- name: userId
|
|
457
|
+
in: path
|
|
458
|
+
required: true
|
|
459
|
+
description: ユーザーID
|
|
460
|
+
schema:
|
|
461
|
+
type: string
|
|
462
|
+
format: uuid
|
|
463
|
+
responses:
|
|
464
|
+
'200':
|
|
465
|
+
description: ユーザー詳細の取得に成功
|
|
466
|
+
content:
|
|
467
|
+
application/json:
|
|
468
|
+
schema:
|
|
469
|
+
$ref: '#/components/schemas/User'
|
|
470
|
+
'404':
|
|
471
|
+
description: ユーザーが見つからない
|
|
472
|
+
content:
|
|
473
|
+
application/json:
|
|
474
|
+
schema:
|
|
475
|
+
$ref: '#/components/schemas/Error'
|
|
476
|
+
'500':
|
|
477
|
+
description: サーバーエラー
|
|
478
|
+
content:
|
|
479
|
+
application/json:
|
|
480
|
+
schema:
|
|
481
|
+
$ref: '#/components/schemas/Error'
|
|
482
|
+
security:
|
|
483
|
+
- BearerAuth: []
|
|
484
|
+
|
|
485
|
+
/auth/login:
|
|
486
|
+
post:
|
|
487
|
+
tags:
|
|
488
|
+
- auth
|
|
489
|
+
summary: ユーザーログイン
|
|
490
|
+
description: ユーザー認証を行い、JWTトークンを発行します
|
|
491
|
+
requestBody:
|
|
492
|
+
required: true
|
|
493
|
+
content:
|
|
494
|
+
application/json:
|
|
495
|
+
schema:
|
|
496
|
+
type: object
|
|
497
|
+
required:
|
|
498
|
+
- email
|
|
499
|
+
- password
|
|
500
|
+
properties:
|
|
501
|
+
email:
|
|
502
|
+
type: string
|
|
503
|
+
format: email
|
|
504
|
+
description: メールアドレス
|
|
505
|
+
example: "user@example.com"
|
|
506
|
+
password:
|
|
507
|
+
type: string
|
|
508
|
+
description: パスワード
|
|
509
|
+
example: "password123"
|
|
510
|
+
responses:
|
|
511
|
+
'200':
|
|
512
|
+
description: ログイン成功
|
|
513
|
+
content:
|
|
514
|
+
application/json:
|
|
515
|
+
schema:
|
|
516
|
+
type: object
|
|
517
|
+
properties:
|
|
518
|
+
token:
|
|
519
|
+
type: string
|
|
520
|
+
description: JWTトークン
|
|
521
|
+
user:
|
|
522
|
+
$ref: '#/components/schemas/User'
|
|
523
|
+
'401':
|
|
524
|
+
description: 認証失敗
|
|
525
|
+
content:
|
|
526
|
+
application/json:
|
|
527
|
+
schema:
|
|
528
|
+
$ref: '#/components/schemas/Error'
|
|
529
|
+
'500':
|
|
530
|
+
description: サーバーエラー
|
|
531
|
+
content:
|
|
532
|
+
application/json:
|
|
533
|
+
schema:
|
|
534
|
+
$ref: '#/components/schemas/Error'
|
|
535
|
+
|
|
536
|
+
components:
|
|
537
|
+
schemas:
|
|
538
|
+
User:
|
|
539
|
+
type: object
|
|
540
|
+
required:
|
|
541
|
+
- id
|
|
542
|
+
- name
|
|
543
|
+
- email
|
|
544
|
+
- createdAt
|
|
545
|
+
properties:
|
|
546
|
+
id:
|
|
547
|
+
type: string
|
|
548
|
+
format: uuid
|
|
549
|
+
description: ユーザーID
|
|
550
|
+
example: "123e4567-e89b-12d3-a456-426614174000"
|
|
551
|
+
name:
|
|
552
|
+
type: string
|
|
553
|
+
description: ユーザー名
|
|
554
|
+
minLength: 1
|
|
555
|
+
maxLength: 100
|
|
556
|
+
example: "田中太郎"
|
|
557
|
+
email:
|
|
558
|
+
type: string
|
|
559
|
+
format: email
|
|
560
|
+
description: メールアドレス
|
|
561
|
+
example: "tanaka@example.com"
|
|
562
|
+
age:
|
|
563
|
+
type: integer
|
|
564
|
+
description: 年齢
|
|
565
|
+
minimum: 0
|
|
566
|
+
maximum: 150
|
|
567
|
+
example: 30
|
|
568
|
+
createdAt:
|
|
569
|
+
type: string
|
|
570
|
+
format: date-time
|
|
571
|
+
description: 作成日時
|
|
572
|
+
example: "2023-01-01T00:00:00Z"
|
|
573
|
+
updatedAt:
|
|
574
|
+
type: string
|
|
575
|
+
format: date-time
|
|
576
|
+
description: 更新日時
|
|
577
|
+
example: "2023-01-01T00:00:00Z"
|
|
578
|
+
|
|
579
|
+
CreateUserRequest:
|
|
580
|
+
type: object
|
|
581
|
+
required:
|
|
582
|
+
- name
|
|
583
|
+
- email
|
|
584
|
+
- password
|
|
585
|
+
properties:
|
|
586
|
+
name:
|
|
587
|
+
type: string
|
|
588
|
+
description: ユーザー名
|
|
589
|
+
minLength: 1
|
|
590
|
+
maxLength: 100
|
|
591
|
+
example: "田中太郎"
|
|
592
|
+
email:
|
|
593
|
+
type: string
|
|
594
|
+
format: email
|
|
595
|
+
description: メールアドレス
|
|
596
|
+
example: "tanaka@example.com"
|
|
597
|
+
age:
|
|
598
|
+
type: integer
|
|
599
|
+
description: 年齢
|
|
600
|
+
minimum: 0
|
|
601
|
+
maximum: 150
|
|
602
|
+
example: 30
|
|
603
|
+
password:
|
|
604
|
+
type: string
|
|
605
|
+
description: パスワード
|
|
606
|
+
minLength: 8
|
|
607
|
+
example: "password123"
|
|
608
|
+
|
|
609
|
+
Error:
|
|
610
|
+
type: object
|
|
611
|
+
required:
|
|
612
|
+
- code
|
|
613
|
+
- message
|
|
614
|
+
properties:
|
|
615
|
+
code:
|
|
616
|
+
type: string
|
|
617
|
+
description: エラーコード
|
|
618
|
+
example: "INVALID_REQUEST"
|
|
619
|
+
message:
|
|
620
|
+
type: string
|
|
621
|
+
description: エラーメッセージ
|
|
622
|
+
example: "リクエストパラメータが不正です"
|
|
623
|
+
details:
|
|
624
|
+
type: object
|
|
625
|
+
description: エラーの詳細情報
|
|
626
|
+
additionalProperties: true
|
|
627
|
+
|
|
628
|
+
securitySchemes:
|
|
629
|
+
BearerAuth:
|
|
630
|
+
type: http
|
|
631
|
+
scheme: bearer
|
|
632
|
+
bearerFormat: JWT
|
|
633
|
+
|
|
634
|
+
security:
|
|
635
|
+
- BearerAuth: []
|
|
636
|
+
`;
|
|
637
|
+
await writeFile(filePath, sampleOpenAPI, 'utf8');
|
|
638
|
+
console.log('Generated sample OpenAPI specification');
|
|
639
|
+
}
|
|
640
|
+
// 静的アセット(画像など)をコピー
|
|
641
|
+
async function copyStaticAssets(projectPath) {
|
|
642
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
643
|
+
const __dirname = dirname(__filename);
|
|
644
|
+
const TEMPLATE_STATIC_PATH = resolve(__dirname, '../../templates/static');
|
|
645
|
+
const staticTargetPath = join(projectPath, 'static');
|
|
646
|
+
if (existsSync(TEMPLATE_STATIC_PATH)) {
|
|
647
|
+
try {
|
|
648
|
+
await cp(TEMPLATE_STATIC_PATH, staticTargetPath, { recursive: true });
|
|
649
|
+
console.log('Copied static assets from templates/static');
|
|
650
|
+
}
|
|
651
|
+
catch (error) {
|
|
652
|
+
console.warn(`Failed to copy static assets: ${error}`);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
else {
|
|
656
|
+
console.warn(`Template static directory not found: ${TEMPLATE_STATIC_PATH}`);
|
|
657
|
+
// フォールバック: 個別にファイルをコピー
|
|
658
|
+
const staticImgDir = join(projectPath, 'static', 'img');
|
|
659
|
+
await mkdir(staticImgDir, { recursive: true });
|
|
660
|
+
// logo.svgファイルをコピー
|
|
661
|
+
const logoSourcePath = join(TEMPLATE_DOCS_PATH, 'logo.svg');
|
|
662
|
+
const logoTargetPath = join(staticImgDir, 'logo.svg');
|
|
663
|
+
if (existsSync(logoSourcePath)) {
|
|
664
|
+
try {
|
|
665
|
+
await cp(logoSourcePath, logoTargetPath);
|
|
666
|
+
console.log('Copied logo.svg to static/img');
|
|
667
|
+
}
|
|
668
|
+
catch (error) {
|
|
669
|
+
console.warn(`Failed to copy logo.svg: ${error}`);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
// PriorityMatrixコンポーネントをコピー(要件定義テンプレート用)
|
|
675
|
+
async function generatePriorityMatrixComponent(projectPath) {
|
|
676
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
677
|
+
const __dirname = dirname(__filename);
|
|
678
|
+
const TEMPLATE_SRC_PATH = resolve(__dirname, '../../templates/src');
|
|
679
|
+
// PriorityMatrixコンポーネントをコピー
|
|
680
|
+
const priorityMatrixSourcePath = join(TEMPLATE_SRC_PATH, 'components', 'PriorityMatrix');
|
|
681
|
+
const priorityMatrixTargetPath = join(projectPath, 'src', 'components', 'PriorityMatrix');
|
|
682
|
+
if (existsSync(priorityMatrixSourcePath)) {
|
|
683
|
+
try {
|
|
684
|
+
await cp(priorityMatrixSourcePath, priorityMatrixTargetPath, { recursive: true });
|
|
685
|
+
console.log('Generated PriorityMatrix component');
|
|
686
|
+
}
|
|
687
|
+
catch (error) {
|
|
688
|
+
console.warn(`Failed to copy PriorityMatrix component: ${error}`);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
console.warn(`PriorityMatrix component template not found: ${priorityMatrixSourcePath}`);
|
|
693
|
+
}
|
|
694
|
+
// 型定義ファイルをコピー(存在する場合)
|
|
695
|
+
const typesSourcePath = join(TEMPLATE_SRC_PATH, 'types');
|
|
696
|
+
const typesTargetPath = join(projectPath, 'src', 'types');
|
|
697
|
+
if (existsSync(typesSourcePath)) {
|
|
698
|
+
try {
|
|
699
|
+
await cp(typesSourcePath, typesTargetPath, { recursive: true });
|
|
700
|
+
console.log('Generated types directory');
|
|
701
|
+
}
|
|
702
|
+
catch (error) {
|
|
703
|
+
console.warn(`Failed to copy types directory: ${error}`);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
else {
|
|
707
|
+
// 型定義ファイルが存在しない場合は作成
|
|
708
|
+
await mkdir(typesTargetPath, { recursive: true });
|
|
709
|
+
const requirementsTypeContent = `/**
|
|
710
|
+
* Requirements related type definitions
|
|
711
|
+
*/
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Priority scale from 1 to 9
|
|
715
|
+
* 1-3: Low priority
|
|
716
|
+
* 4-6: Medium priority
|
|
717
|
+
* 7-9: High priority
|
|
718
|
+
*/
|
|
719
|
+
export type PriorityScale = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Requirement priority matrix
|
|
723
|
+
*/
|
|
724
|
+
export interface RequirementPriority {
|
|
725
|
+
importance: PriorityScale;
|
|
726
|
+
urgency: PriorityScale;
|
|
727
|
+
}
|
|
728
|
+
`;
|
|
729
|
+
await writeFile(join(typesTargetPath, 'requirements.ts'), requirementsTypeContent, 'utf8');
|
|
730
|
+
console.log('Generated requirements.ts type definitions');
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
// TBDコンポーネントとその依存関係をコピー
|
|
734
|
+
async function generateTBDComponent(projectPath) {
|
|
735
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
736
|
+
const __dirname = dirname(__filename);
|
|
737
|
+
const TEMPLATE_SRC_PATH = resolve(__dirname, '../../templates/src');
|
|
738
|
+
// TBDコンポーネントをコピー
|
|
739
|
+
const tbdSourcePath = join(TEMPLATE_SRC_PATH, 'components', 'TBD');
|
|
740
|
+
const tbdTargetPath = join(projectPath, 'src', 'components', 'TBD');
|
|
741
|
+
if (existsSync(tbdSourcePath)) {
|
|
742
|
+
try {
|
|
743
|
+
await cp(tbdSourcePath, tbdTargetPath, { recursive: true });
|
|
744
|
+
console.log('Generated TBD component');
|
|
745
|
+
}
|
|
746
|
+
catch (error) {
|
|
747
|
+
console.warn(`Failed to copy TBD component: ${error}`);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
else {
|
|
751
|
+
console.warn(`TBD component template not found: ${tbdSourcePath}`);
|
|
752
|
+
}
|
|
753
|
+
// Highlightコンポーネントもコピー(TBDが依存しているため)
|
|
754
|
+
const highlightSourcePath = join(TEMPLATE_SRC_PATH, 'components', 'Highlight');
|
|
755
|
+
const highlightTargetPath = join(projectPath, 'src', 'components', 'Highlight');
|
|
756
|
+
if (existsSync(highlightSourcePath)) {
|
|
757
|
+
try {
|
|
758
|
+
await cp(highlightSourcePath, highlightTargetPath, { recursive: true });
|
|
759
|
+
console.log('Generated Highlight component');
|
|
760
|
+
}
|
|
761
|
+
catch (error) {
|
|
762
|
+
console.warn(`Failed to copy Highlight component: ${error}`);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
else {
|
|
766
|
+
console.warn(`Highlight component template not found: ${highlightSourcePath}`);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
373
769
|
//# sourceMappingURL=template-files.js.map
|