create-specment 0.2.2
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/LICENSE +21 -0
- package/README.md +314 -0
- package/bin/commands/create.d.ts +3 -0
- package/bin/commands/create.d.ts.map +1 -0
- package/bin/commands/create.js +30 -0
- package/bin/commands/create.js.map +1 -0
- package/bin/constants/languages.d.ts +15 -0
- package/bin/constants/languages.d.ts.map +1 -0
- package/bin/constants/languages.js +14 -0
- package/bin/constants/languages.js.map +1 -0
- package/bin/core/interactive-setup.d.ts +15 -0
- package/bin/core/interactive-setup.d.ts.map +1 -0
- package/bin/core/interactive-setup.js +171 -0
- package/bin/core/interactive-setup.js.map +1 -0
- package/bin/core/interactive-setup.test.d.ts +2 -0
- package/bin/core/interactive-setup.test.d.ts.map +1 -0
- package/bin/core/interactive-setup.test.js +97 -0
- package/bin/core/interactive-setup.test.js.map +1 -0
- package/bin/core/project-generator.d.ts +12 -0
- package/bin/core/project-generator.d.ts.map +1 -0
- package/bin/core/project-generator.js +83 -0
- package/bin/core/project-generator.js.map +1 -0
- package/bin/features/index.d.ts +3 -0
- package/bin/features/index.d.ts.map +1 -0
- package/bin/features/index.js +47 -0
- package/bin/features/index.js.map +1 -0
- package/bin/generators/docusaurus-config.d.ts +3 -0
- package/bin/generators/docusaurus-config.d.ts.map +1 -0
- package/bin/generators/docusaurus-config.js +285 -0
- package/bin/generators/docusaurus-config.js.map +1 -0
- package/bin/generators/package-json.d.ts +3 -0
- package/bin/generators/package-json.d.ts.map +1 -0
- package/bin/generators/package-json.js +98 -0
- package/bin/generators/package-json.js.map +1 -0
- package/bin/generators/template-files.d.ts +3 -0
- package/bin/generators/template-files.d.ts.map +1 -0
- package/bin/generators/template-files.js +370 -0
- package/bin/generators/template-files.js.map +1 -0
- package/bin/index.d.ts +5 -0
- package/bin/index.d.ts.map +1 -0
- package/bin/index.js +37 -0
- package/bin/index.js.map +1 -0
- package/bin/plugins/i18n-integration.d.ts +25 -0
- package/bin/plugins/i18n-integration.d.ts.map +1 -0
- package/bin/plugins/i18n-integration.js +309 -0
- package/bin/plugins/i18n-integration.js.map +1 -0
- package/bin/plugins/plantuml-integration.d.ts +17 -0
- package/bin/plugins/plantuml-integration.d.ts.map +1 -0
- package/bin/plugins/plantuml-integration.js +111 -0
- package/bin/plugins/plantuml-integration.js.map +1 -0
- package/bin/plugins/redoc-integration.d.ts +25 -0
- package/bin/plugins/redoc-integration.d.ts.map +1 -0
- package/bin/plugins/redoc-integration.js +372 -0
- package/bin/plugins/redoc-integration.js.map +1 -0
- package/bin/plugins/search-integration.d.ts +20 -0
- package/bin/plugins/search-integration.d.ts.map +1 -0
- package/bin/plugins/search-integration.js +165 -0
- package/bin/plugins/search-integration.js.map +1 -0
- package/bin/templates/index.d.ts +4 -0
- package/bin/templates/index.d.ts.map +1 -0
- package/bin/templates/index.js +60 -0
- package/bin/templates/index.js.map +1 -0
- package/bin/templates/template-definitions.d.ts +10 -0
- package/bin/templates/template-definitions.d.ts.map +1 -0
- package/bin/templates/template-definitions.js +296 -0
- package/bin/templates/template-definitions.js.map +1 -0
- package/bin/tests/integration.test.d.ts +2 -0
- package/bin/tests/integration.test.d.ts.map +1 -0
- package/bin/tests/integration.test.js +171 -0
- package/bin/tests/integration.test.js.map +1 -0
- package/bin/types/index.d.ts +44 -0
- package/bin/types/index.d.ts.map +1 -0
- package/bin/types/index.js +2 -0
- package/bin/types/index.js.map +1 -0
- package/bin/utils/config-merger.d.ts +32 -0
- package/bin/utils/config-merger.d.ts.map +1 -0
- package/bin/utils/config-merger.js +216 -0
- package/bin/utils/config-merger.js.map +1 -0
- package/bin/utils/errors.d.ts +9 -0
- package/bin/utils/errors.d.ts.map +1 -0
- package/bin/utils/errors.js +22 -0
- package/bin/utils/errors.js.map +1 -0
- package/bin/utils/install.d.ts +5 -0
- package/bin/utils/install.d.ts.map +1 -0
- package/bin/utils/install.js +38 -0
- package/bin/utils/install.js.map +1 -0
- package/bin/utils/message-formatter.d.ts +15 -0
- package/bin/utils/message-formatter.d.ts.map +1 -0
- package/bin/utils/message-formatter.js +85 -0
- package/bin/utils/message-formatter.js.map +1 -0
- package/bin/utils/template-processor.d.ts +54 -0
- package/bin/utils/template-processor.d.ts.map +1 -0
- package/bin/utils/template-processor.js +139 -0
- package/bin/utils/template-processor.js.map +1 -0
- package/bin/utils/template-processor.test.d.ts +2 -0
- package/bin/utils/template-processor.test.d.ts.map +1 -0
- package/bin/utils/template-processor.test.js +120 -0
- package/bin/utils/template-processor.test.js.map +1 -0
- package/bin/utils/version.d.ts +2 -0
- package/bin/utils/version.d.ts.map +1 -0
- package/bin/utils/version.js +10 -0
- package/bin/utils/version.js.map +1 -0
- package/package.json +67 -0
- package/templates/classic-spec/docusaurus.config.js.template +106 -0
- package/templates/classic-spec/package.json.template +36 -0
- package/templates/external-design/docusaurus.config.js.template +123 -0
- package/templates/external-design/package.json.template +36 -0
- package/templates/internal-design/docusaurus.config.js.template +123 -0
- package/templates/internal-design/package.json.template +36 -0
- package/templates/project-analysis/docusaurus.config.js.template +113 -0
- package/templates/project-analysis/package.json.template +36 -0
- package/templates/requirements/docusaurus.config.js.template +119 -0
- package/templates/requirements/package.json.template +36 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { PlantUMLIntegration } from '../plugins/plantuml-integration.js';
|
|
2
|
+
import { RedocIntegration } from '../plugins/redoc-integration.js';
|
|
3
|
+
import { SearchIntegration } from '../plugins/search-integration.js';
|
|
4
|
+
import { I18nIntegration } from '../plugins/i18n-integration.js';
|
|
5
|
+
export function generatePackageJson(selections) {
|
|
6
|
+
const { projectName, features } = selections;
|
|
7
|
+
const basePackageJson = {
|
|
8
|
+
name: projectName,
|
|
9
|
+
version: '0.0.0',
|
|
10
|
+
private: true,
|
|
11
|
+
scripts: {
|
|
12
|
+
// 標準的なDocusaurusコマンド
|
|
13
|
+
docusaurus: 'docusaurus',
|
|
14
|
+
start: 'docusaurus start',
|
|
15
|
+
build: 'docusaurus build',
|
|
16
|
+
swizzle: 'docusaurus swizzle',
|
|
17
|
+
deploy: 'docusaurus deploy',
|
|
18
|
+
clear: 'docusaurus clear',
|
|
19
|
+
serve: 'docusaurus serve',
|
|
20
|
+
'write-translations': 'docusaurus write-translations',
|
|
21
|
+
'write-heading-ids': 'docusaurus write-heading-ids',
|
|
22
|
+
// ni/nr対応のエイリアス(niコマンドで統一的に実行可能)
|
|
23
|
+
dev: 'docusaurus start',
|
|
24
|
+
preview: 'docusaurus serve',
|
|
25
|
+
// 開発・運用支援コマンド
|
|
26
|
+
typecheck: 'tsc --noEmit',
|
|
27
|
+
lint: 'eslint src --ext .ts,.tsx,.js,.jsx',
|
|
28
|
+
'lint:fix': 'eslint src --ext .ts,.tsx,.js,.jsx --fix',
|
|
29
|
+
format: 'prettier --write "src/**/*.{ts,tsx,js,jsx,md,mdx}"',
|
|
30
|
+
'format:check': 'prettier --check "src/**/*.{ts,tsx,js,jsx,md,mdx}"'
|
|
31
|
+
},
|
|
32
|
+
dependencies: {
|
|
33
|
+
'@docusaurus/core': '^3.0.0',
|
|
34
|
+
'@docusaurus/preset-classic': '^3.0.0',
|
|
35
|
+
'@mdx-js/react': '^3.0.0',
|
|
36
|
+
'clsx': '^2.0.0',
|
|
37
|
+
'prism-react-renderer': '^2.3.0',
|
|
38
|
+
'react': '^18.0.0',
|
|
39
|
+
'react-dom': '^18.0.0'
|
|
40
|
+
},
|
|
41
|
+
devDependencies: {
|
|
42
|
+
'@docusaurus/module-type-aliases': '^3.0.0',
|
|
43
|
+
'@docusaurus/types': '^3.0.0',
|
|
44
|
+
'@types/react': '^18.0.0',
|
|
45
|
+
'@types/react-dom': '^18.0.0',
|
|
46
|
+
'typescript': '^5.0.0',
|
|
47
|
+
'eslint': '^8.0.0',
|
|
48
|
+
'@typescript-eslint/eslint-plugin': '^6.0.0',
|
|
49
|
+
'@typescript-eslint/parser': '^6.0.0',
|
|
50
|
+
'prettier': '^3.0.0'
|
|
51
|
+
},
|
|
52
|
+
browserslist: {
|
|
53
|
+
production: ['>0.5%', 'not dead', 'not op_mini all'],
|
|
54
|
+
development: ['last 3 chrome version', 'last 3 firefox version', 'last 5 safari version']
|
|
55
|
+
},
|
|
56
|
+
engines: {
|
|
57
|
+
node: '>=20.0'
|
|
58
|
+
}
|
|
59
|
+
// packageManagerフィールドは削除 - niが自動検出するため
|
|
60
|
+
};
|
|
61
|
+
// Add feature-specific dependencies using dedicated integration classes
|
|
62
|
+
const enabledFeatures = features.filter(f => f.enabled);
|
|
63
|
+
for (const feature of enabledFeatures) {
|
|
64
|
+
let dependencies = {};
|
|
65
|
+
const devDependencies = {};
|
|
66
|
+
const scripts = {};
|
|
67
|
+
switch (feature.name) {
|
|
68
|
+
case 'plantuml':
|
|
69
|
+
dependencies = PlantUMLIntegration.getDependencies();
|
|
70
|
+
break;
|
|
71
|
+
case 'redoc':
|
|
72
|
+
dependencies = RedocIntegration.getDependencies();
|
|
73
|
+
break;
|
|
74
|
+
case 'search':
|
|
75
|
+
dependencies = SearchIntegration.getDependencies();
|
|
76
|
+
break;
|
|
77
|
+
case 'i18n':
|
|
78
|
+
dependencies = I18nIntegration.getDependencies();
|
|
79
|
+
// 多言語対応の場合、翻訳関連のスクリプトを追加
|
|
80
|
+
scripts['translate'] = 'docusaurus write-translations';
|
|
81
|
+
scripts['translate:update'] = 'docusaurus write-translations --update-translations';
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
// Merge dependencies into base package.json
|
|
85
|
+
Object.assign(basePackageJson.dependencies, dependencies);
|
|
86
|
+
Object.assign(basePackageJson.devDependencies, devDependencies);
|
|
87
|
+
Object.assign(basePackageJson.scripts, scripts);
|
|
88
|
+
}
|
|
89
|
+
// 機能に応じてスクリプトを調整
|
|
90
|
+
if (enabledFeatures.some(f => f.name === 'plantuml')) {
|
|
91
|
+
basePackageJson.scripts['plantuml:check'] = 'echo "PlantUML integration enabled"';
|
|
92
|
+
}
|
|
93
|
+
if (enabledFeatures.some(f => f.name === 'redoc')) {
|
|
94
|
+
basePackageJson.scripts['api:validate'] = 'echo "API specification validation"';
|
|
95
|
+
}
|
|
96
|
+
return basePackageJson;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=package-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-json.js","sourceRoot":"","sources":["../../src/generators/package-json.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,MAAM,UAAU,mBAAmB,CAAC,UAA0B;IAC5D,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;IAE7C,MAAM,eAAe,GAAQ;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE;YACP,qBAAqB;YACrB,UAAU,EAAE,YAAY;YACxB,KAAK,EAAE,kBAAkB;YACzB,KAAK,EAAE,kBAAkB;YACzB,OAAO,EAAE,oBAAoB;YAC7B,MAAM,EAAE,mBAAmB;YAC3B,KAAK,EAAE,kBAAkB;YACzB,KAAK,EAAE,kBAAkB;YACzB,oBAAoB,EAAE,+BAA+B;YACrD,mBAAmB,EAAE,8BAA8B;YAEnD,iCAAiC;YACjC,GAAG,EAAE,kBAAkB;YACvB,OAAO,EAAE,kBAAkB;YAE3B,cAAc;YACd,SAAS,EAAE,cAAc;YACzB,IAAI,EAAE,oCAAoC;YAC1C,UAAU,EAAE,0CAA0C;YACtD,MAAM,EAAE,oDAAoD;YAC5D,cAAc,EAAE,oDAAoD;SACrE;QACD,YAAY,EAAE;YACZ,kBAAkB,EAAE,QAAQ;YAC5B,4BAA4B,EAAE,QAAQ;YACtC,eA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e,EAAE,CAAC;gBACjD,yBAAyB;gBACzB,OAAO,CAAC,WAAW,CAAC,GAAG,+BAA+B,CAAC;gBACvD,OAAO,CAAC,kBAAkB,CAAC,GAAG,qDAAqD,CAAC;gBACpF,MAAM;QACV,CAAC;QAED,4CAA4C;QAC5C,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAC1D,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;QAChE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED,iBAAiB;IACjB,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,EAAE,CAAC;QACrD,eAAe,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,qCAAqC,CAAC;IACpF,CAAC;IAED,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,EAAE,CAAC;QAClD,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,qCAAqC,CAAC;IAClF,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-files.d.ts","sourceRoot":"","sources":["../../src/generators/template-files.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIxD,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCtG"}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { mkdir, writeFile, access } from 'fs/promises';
|
|
2
|
+
import { join, resolve } from 'path';
|
|
3
|
+
import { existsSync, constants } from 'fs';
|
|
4
|
+
import { createTemplateProcessor } from '../utils/template-processor.js';
|
|
5
|
+
import { getTemplateDefinition } from '../templates/template-definitions.js';
|
|
6
|
+
export async function copyTemplateFiles(selections, projectPath) {
|
|
7
|
+
const { templates, projectName } = selections;
|
|
8
|
+
// プロジェクトパスの検証
|
|
9
|
+
await validateProjectPath(projectPath);
|
|
10
|
+
// テンプレートプロセッサーを作成(最初のテンプレートをベースにする)
|
|
11
|
+
const primaryTemplate = templates[0];
|
|
12
|
+
const processor = await createTemplateProcessor(projectName, {
|
|
13
|
+
templateName: primaryTemplate.name,
|
|
14
|
+
templateDisplayName: primaryTemplate.displayName,
|
|
15
|
+
});
|
|
16
|
+
// 全テンプレートのディレクトリ構造を統合
|
|
17
|
+
const combinedStructure = combineTemplateStructures(templates);
|
|
18
|
+
// ディレクトリ構造を作成
|
|
19
|
+
await createDirectoryStructure(projectPath, combinedStructure);
|
|
20
|
+
// 各テンプレートのファイルを生成
|
|
21
|
+
for (const template of templates) {
|
|
22
|
+
const templateDef = getTemplateDefinition(template.name);
|
|
23
|
+
if (!templateDef) {
|
|
24
|
+
console.warn(`Template definition not found for: ${template.name}`);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
// サンプルコンテンツを生成
|
|
28
|
+
await generateSampleContent(projectPath, templateDef.sampleContent, processor);
|
|
29
|
+
}
|
|
30
|
+
// 基本ファイルを生成(最初のテンプレートベース)
|
|
31
|
+
await generateSidebarsConfig(projectPath, primaryTemplate.name, processor);
|
|
32
|
+
await generateCustomCSS(projectPath);
|
|
33
|
+
await generateStaticFiles(projectPath, processor);
|
|
34
|
+
}
|
|
35
|
+
function combineTemplateStructures(templates) {
|
|
36
|
+
const combined = {
|
|
37
|
+
docs: new Set(),
|
|
38
|
+
static: new Set(),
|
|
39
|
+
src: new Set()
|
|
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
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
docs: Array.from(combined.docs),
|
|
63
|
+
static: Array.from(combined.static),
|
|
64
|
+
src: Array.from(combined.src)
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
async function validateProjectPath(projectPath) {
|
|
68
|
+
const resolvedPath = resolve(projectPath);
|
|
69
|
+
// ディレクトリが存在することを確認
|
|
70
|
+
if (!existsSync(resolvedPath)) {
|
|
71
|
+
throw new Error(`Project directory does not exist: ${resolvedPath}`);
|
|
72
|
+
}
|
|
73
|
+
// 書き込み権限を確認
|
|
74
|
+
try {
|
|
75
|
+
await access(resolvedPath, constants.W_OK);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
throw new Error(`No write permission for directory: ${resolvedPath}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async function createDirectoryStructure(projectPath, structure) {
|
|
82
|
+
// 基本ディレクトリを作成
|
|
83
|
+
const baseDirectories = [
|
|
84
|
+
'docs',
|
|
85
|
+
'src/css',
|
|
86
|
+
'src/components',
|
|
87
|
+
'static/img'
|
|
88
|
+
];
|
|
89
|
+
for (const dir of baseDirectories) {
|
|
90
|
+
const dirPath = join(projectPath, dir);
|
|
91
|
+
await mkdir(dirPath, { recursive: true });
|
|
92
|
+
}
|
|
93
|
+
// テンプレート固有のディレクトリを作成
|
|
94
|
+
if (structure.docs) {
|
|
95
|
+
for (const docDir of structure.docs) {
|
|
96
|
+
const dirPath = join(projectPath, 'docs', docDir);
|
|
97
|
+
await mkdir(dirPath, { recursive: true });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (structure.static) {
|
|
101
|
+
for (const staticDir of structure.static) {
|
|
102
|
+
const dirPath = join(projectPath, 'static', staticDir);
|
|
103
|
+
await mkdir(dirPath, { recursive: true });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (structure.src) {
|
|
107
|
+
for (const srcDir of structure.src) {
|
|
108
|
+
const dirPath = join(projectPath, 'src', srcDir);
|
|
109
|
+
await mkdir(dirPath, { recursive: true });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async function generateTemplateFiles(projectPath, templateName, processor) {
|
|
114
|
+
const templateDir = join(process.cwd(), 'templates', templateName);
|
|
115
|
+
try {
|
|
116
|
+
// package.json.templateを処理
|
|
117
|
+
const packageJsonTemplate = join(templateDir, 'package.json.template');
|
|
118
|
+
const processedPackageJson = await processor.processTemplateFile(packageJsonTemplate);
|
|
119
|
+
await writeFile(join(projectPath, 'package.json'), processedPackageJson);
|
|
120
|
+
// docusaurus.config.js.templateを処理
|
|
121
|
+
const configTemplate = join(templateDir, 'docusaurus.config.js.template');
|
|
122
|
+
const processedConfig = await processor.processTemplateFile(configTemplate);
|
|
123
|
+
await writeFile(join(projectPath, 'docusaurus.config.js'), processedConfig);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.error(`Error generating template files for ${templateName}:`, error);
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
async function generateSampleContent(projectPath, sampleContent, processor) {
|
|
131
|
+
for (const content of sampleContent) {
|
|
132
|
+
const filePath = join(projectPath, content.path);
|
|
133
|
+
// ディレクトリが存在しない場合は作成
|
|
134
|
+
const dirPath = resolve(filePath, '..');
|
|
135
|
+
await mkdir(dirPath, { recursive: true });
|
|
136
|
+
if (content.template) {
|
|
137
|
+
// テンプレート変数を置換
|
|
138
|
+
const processedContent = processor.processTemplate(content.content);
|
|
139
|
+
await writeFile(filePath, processedContent, 'utf8');
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
// そのまま書き込み
|
|
143
|
+
await writeFile(filePath, content.content, 'utf8');
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
async function generateSidebarsConfig(projectPath, templateName, processor) {
|
|
148
|
+
const sidebarConfigs = {
|
|
149
|
+
'classic-spec': `// @ts-check
|
|
150
|
+
|
|
151
|
+
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
152
|
+
const sidebars = {
|
|
153
|
+
tutorialSidebar: [
|
|
154
|
+
'intro',
|
|
155
|
+
{
|
|
156
|
+
type: 'category',
|
|
157
|
+
label: 'Documentation',
|
|
158
|
+
items: ['getting-started', 'configuration']
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
module.exports = sidebars;`,
|
|
164
|
+
'project-analysis': `// @ts-check
|
|
165
|
+
|
|
166
|
+
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
167
|
+
const sidebars = {
|
|
168
|
+
analysisSidebar: [
|
|
169
|
+
{
|
|
170
|
+
type: 'category',
|
|
171
|
+
label: 'プロジェクト分析',
|
|
172
|
+
items: ['analysis/intro']
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
overviewSidebar: [
|
|
176
|
+
{
|
|
177
|
+
type: 'category',
|
|
178
|
+
label: 'プロジェクト概要',
|
|
179
|
+
items: ['overview/intro']
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
module.exports = sidebars;`,
|
|
185
|
+
'requirements': `// @ts-check
|
|
186
|
+
|
|
187
|
+
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
188
|
+
const sidebars = {
|
|
189
|
+
requirementsSidebar: [
|
|
190
|
+
{
|
|
191
|
+
type: 'category',
|
|
192
|
+
label: '機能要件',
|
|
193
|
+
items: ['functional/intro']
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
functionalSidebar: [
|
|
197
|
+
{
|
|
198
|
+
type: 'category',
|
|
199
|
+
label: '機能要件詳細',
|
|
200
|
+
items: ['functional/intro']
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
nonFunctionalSidebar: [
|
|
204
|
+
{
|
|
205
|
+
type: 'category',
|
|
206
|
+
label: '非機能要件',
|
|
207
|
+
items: ['non-functional/intro']
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
module.exports = sidebars;`,
|
|
213
|
+
'external-design': `// @ts-check
|
|
214
|
+
|
|
215
|
+
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
216
|
+
const sidebars = {
|
|
217
|
+
architectureSidebar: [
|
|
218
|
+
{
|
|
219
|
+
type: 'category',
|
|
220
|
+
label: 'システムアーキテクチャ',
|
|
221
|
+
items: ['architecture/intro']
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
apiSidebar: [
|
|
225
|
+
{
|
|
226
|
+
type: 'category',
|
|
227
|
+
label: 'API設計',
|
|
228
|
+
items: ['api/intro']
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
uiSidebar: [
|
|
232
|
+
{
|
|
233
|
+
type: 'category',
|
|
234
|
+
label: 'UI/UX設計',
|
|
235
|
+
items: ['ui/intro']
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
module.exports = sidebars;`,
|
|
241
|
+
'internal-design': `// @ts-check
|
|
242
|
+
|
|
243
|
+
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
244
|
+
const sidebars = {
|
|
245
|
+
implementationSidebar: [
|
|
246
|
+
{
|
|
247
|
+
type: 'category',
|
|
248
|
+
label: '実装詳細',
|
|
249
|
+
items: ['implementation/intro']
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
databaseSidebar: [
|
|
253
|
+
{
|
|
254
|
+
type: 'category',
|
|
255
|
+
label: 'データベース設計',
|
|
256
|
+
items: ['database/intro']
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
algorithmSidebar: [
|
|
260
|
+
{
|
|
261
|
+
type: 'category',
|
|
262
|
+
label: 'アルゴリズム',
|
|
263
|
+
items: ['algorithms/intro']
|
|
264
|
+
}
|
|
265
|
+
]
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
module.exports = sidebars;`
|
|
269
|
+
};
|
|
270
|
+
const sidebarContent = sidebarConfigs[templateName] || sidebarConfigs['classic-spec'];
|
|
271
|
+
const processedContent = processor.processTemplate(sidebarContent);
|
|
272
|
+
await writeFile(join(projectPath, 'sidebars.js'), processedContent);
|
|
273
|
+
}
|
|
274
|
+
async function generateCustomCSS(projectPath) {
|
|
275
|
+
const cssContent = `/**
|
|
276
|
+
* Any CSS included here will be global. The classic template
|
|
277
|
+
* bundles Infima by default. Infima is a CSS framework designed to
|
|
278
|
+
* work well for content-centric websites.
|
|
279
|
+
*/
|
|
280
|
+
|
|
281
|
+
/* You can override the default Infima variables here. */
|
|
282
|
+
:root {
|
|
283
|
+
--ifm-color-primary: #2e8555;
|
|
284
|
+
--ifm-color-primary-dark: #29784c;
|
|
285
|
+
--ifm-color-primary-darker: #277148;
|
|
286
|
+
--ifm-color-primary-darkest: #205d3b;
|
|
287
|
+
--ifm-color-primary-light: #33925d;
|
|
288
|
+
--ifm-color-primary-lighter: #359962;
|
|
289
|
+
--ifm-color-primary-lightest: #3cad6e;
|
|
290
|
+
--ifm-code-font-size: 95%;
|
|
291
|
+
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/* For readability concerns, you should choose a lighter palette in dark mode. */
|
|
295
|
+
[data-theme='dark'] {
|
|
296
|
+
--ifm-color-primary: #25c2a0;
|
|
297
|
+
--ifm-color-primary-dark: #21af90;
|
|
298
|
+
--ifm-color-primary-darker: #1fa588;
|
|
299
|
+
--ifm-color-primary-darkest: #1a8870;
|
|
300
|
+
--ifm-color-primary-light: #29d5b0;
|
|
301
|
+
--ifm-color-primary-lighter: #32d8b4;
|
|
302
|
+
--ifm-color-primary-lightest: #4fddbf;
|
|
303
|
+
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
|
|
304
|
+
}`;
|
|
305
|
+
await writeFile(join(projectPath, 'src', 'css', 'custom.css'), cssContent);
|
|
306
|
+
}
|
|
307
|
+
async function generateStaticFiles(projectPath, processor) {
|
|
308
|
+
// Create basic README with template variables
|
|
309
|
+
const readmeTemplate = `# {{projectName}}
|
|
310
|
+
|
|
311
|
+
This documentation site was created with [create-specment](https://github.com/plenarc/create-specment).
|
|
312
|
+
|
|
313
|
+
## Project Information
|
|
314
|
+
|
|
315
|
+
- **Project Name**: {{projectName}}
|
|
316
|
+
- **Created**: {{date}}
|
|
317
|
+
- **Author**: {{author}}
|
|
318
|
+
|
|
319
|
+
## Getting Started
|
|
320
|
+
|
|
321
|
+
\`\`\`bash
|
|
322
|
+
ni # 依存関係をインストール
|
|
323
|
+
nr dev # 開発サーバーを起動
|
|
324
|
+
\`\`\`
|
|
325
|
+
|
|
326
|
+
## Build
|
|
327
|
+
|
|
328
|
+
\`\`\`bash
|
|
329
|
+
nr build # プロダクションビルド
|
|
330
|
+
\`\`\`
|
|
331
|
+
|
|
332
|
+
## Deployment
|
|
333
|
+
|
|
334
|
+
\`\`\`bash
|
|
335
|
+
nr preview # ビルド結果をプレビュー
|
|
336
|
+
\`\`\`
|
|
337
|
+
|
|
338
|
+
## Documentation
|
|
339
|
+
|
|
340
|
+
This project uses Docusaurus for documentation. Learn more at [docusaurus.io](https://docusaurus.io/).
|
|
341
|
+
`;
|
|
342
|
+
const processedReadme = processor.processTemplate(readmeTemplate);
|
|
343
|
+
await writeFile(join(projectPath, 'README.md'), processedReadme, 'utf8');
|
|
344
|
+
// Create .gitignore file
|
|
345
|
+
const gitignoreContent = `# Dependencies
|
|
346
|
+
node_modules/
|
|
347
|
+
.pnp
|
|
348
|
+
.pnp.js
|
|
349
|
+
|
|
350
|
+
# Production
|
|
351
|
+
/build
|
|
352
|
+
|
|
353
|
+
# Generated files
|
|
354
|
+
.docusaurus
|
|
355
|
+
.cache
|
|
356
|
+
|
|
357
|
+
# Misc
|
|
358
|
+
.DS_Store
|
|
359
|
+
.env.local
|
|
360
|
+
.env.development.local
|
|
361
|
+
.env.test.local
|
|
362
|
+
.env.production.local
|
|
363
|
+
|
|
364
|
+
npm-debug.log*
|
|
365
|
+
yarn-debug.log*
|
|
366
|
+
yarn-error.log*
|
|
367
|
+
`;
|
|
368
|
+
await writeFile(join(projectPath, '.gitignore'), gitignoreContent, 'utf8');
|
|
369
|
+
}
|
|
370
|
+
//# sourceMappingURL=template-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-files.js","sourceRoot":"","sources":["../../src/generators/template-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAA0B,MAAM,gCAAgC,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,UAA0B,EAAE,WAAmB;IACrF,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC;IAE9C,cAAc;IACd,MAAM,mBAAmB,CAAC,WAAW,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;;;;;;;;;;;;EA6BnB,CAAC;IAED,MAAM,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,EAAE,UAAU,CAAC,CAAC;AAC7E,CAAC;AAED,KAAK,UAAU,mBAAmB,CAAC,WAAmB,EAAE,SAA4B;IAClF,8CAA8C;IAC9C,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCxB,CAAC;IAEA,MAAM,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAClE,MAAM,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;IAEzE,yBAAyB;IACzB,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsB1B,CAAC;IAEA,MAAM,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC"}
|
package/bin/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,QAAA,MAAM,OAAO,SAAgB,CAAC;AAmC9B,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { createSpecmentProject } from './commands/create.js';
|
|
4
|
+
import { version } from './utils/version.js';
|
|
5
|
+
import { UserCancelledError, CLIError } from './utils/errors.js';
|
|
6
|
+
const program = new Command();
|
|
7
|
+
program
|
|
8
|
+
.name('create-specment')
|
|
9
|
+
.description('Interactive CLI tool for creating Docusaurus-based specification documentation projects')
|
|
10
|
+
.version(version);
|
|
11
|
+
program
|
|
12
|
+
.argument('[project-name]', 'Name of the project to create')
|
|
13
|
+
.option('-t, --template <template>', 'Template to use (classic-spec, api-spec, technical-spec, enterprise-spec)')
|
|
14
|
+
.option('--skip-install', 'Skip package installation')
|
|
15
|
+
.option('--verbose', 'Enable verbose logging')
|
|
16
|
+
.action(async (projectName, options) => {
|
|
17
|
+
try {
|
|
18
|
+
await createSpecmentProject(projectName, options);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
if (error instanceof UserCancelledError) {
|
|
22
|
+
// Exit cleanly without error message
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (error instanceof CLIError) {
|
|
26
|
+
console.error(error.message);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
console.error('Error:', error instanceof Error ? error.message : 'Unknown error');
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (process.env.NODE_ENV !== 'test' && !process.env.VITEST) {
|
|
34
|
+
program.parse();
|
|
35
|
+
}
|
|
36
|
+
export { program };
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
package/bin/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEjE,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,iBAAiB,CAAC;KACvB,WAAW,CAAC,yFAAyF,CAAC;KACtG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,QAAQ,CAAC,gBAAgB,EAAE,+BAA+B,CAAC;KAC3D,MAAM,CAAC,2BAA2B,EAAE,2EAA2E,CAAC;KAChH,MAAM,CAAC,gBAAgB,EAAE,2BAA2B,CAAC;KACrD,MAAM,CAAC,WAAW,EAAE,wBAAwB,CAAC;KAC7C,MAAM,CAAC,KAAK,EAAE,WAA+B,EAAE,OAAO,EAAE,EAAE;IACzD,IAAI,CAAC;QACH,MAAM,qBAAqB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,kBAAkB,EAAE,CAAC;YACxC,qCAAqC;YACrC,OAAO;QACT,CAAC;QAED,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;YAC9B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC7B,OAAO;QACT,CAAC;QAED,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QAClF,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IAC3D,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FeatureSelection } from '../types/index.js';
|
|
2
|
+
export interface I18nConfig {
|
|
3
|
+
defaultLocale: string;
|
|
4
|
+
locales: string[];
|
|
5
|
+
localeConfigs?: Record<string, LocaleConfig>;
|
|
6
|
+
}
|
|
7
|
+
export interface LocaleConfig {
|
|
8
|
+
label: string;
|
|
9
|
+
direction: 'ltr' | 'rtl';
|
|
10
|
+
htmlLang: string;
|
|
11
|
+
calendar?: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class I18nIntegration {
|
|
15
|
+
static getDefaultConfig(): I18nConfig;
|
|
16
|
+
static generateDocusaurusConfig(feature: FeatureSelection): any;
|
|
17
|
+
static getDependencies(): Record<string, string>;
|
|
18
|
+
static generateI18nDocumentation(): string;
|
|
19
|
+
static generateLocaleFiles(): Record<string, string>;
|
|
20
|
+
static validateConfig(config: I18nConfig): {
|
|
21
|
+
valid: boolean;
|
|
22
|
+
message?: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=i18n-integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n-integration.d.ts","sourceRoot":"","sources":["../../src/plugins/i18n-integration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,eAAe;IAC1B,MAAM,CAAC,gBAAgB,IAAI,UAAU;IAmBrC,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,gBAAgB,GAAG,GAAG;IAsB/D,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAKhD,MAAM,CAAC,yBAAyB,IAAI,MAAM;IAoK1C,MAAM,CAAC,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAqEpD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;CAsChF"}
|