create-specment 0.2.9 → 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 +563 -168
- 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/_requirements-specification.mdx +1 -5
- package/templates/docs/01-overview/as-is.mdx +1 -1
- package/templates/docs/01-overview/glossary.mdx +6 -6
- package/templates/docs/01-overview/odsc.mdx +1 -1
- package/templates/docs/01-overview/to-be.mdx +6 -6
- package/templates/docs/02-requirements/functional/_req-template.mdx +0 -3
- package/templates/docs/02-requirements/functional/req-001.mdx +0 -4
- package/templates/docs/02-requirements/non-functional/_nfr-template.mdx +0 -3
- package/templates/docs/02-requirements/non-functional/nfr-001.mdx +0 -3
- package/templates/docs/02-requirements/non-functional/nfr-002.mdx +0 -3
- package/templates/docs/03-external/business-model.mdx +1 -1
- package/templates/docs/03-external/index.mdx +1 -1
- package/templates/docs/04-internal/batches/import-products.mdx +2 -6
- package/templates/docs/04-internal/policies/github.mdx +1 -1
- package/templates/docs/04-internal/rules/database.mdx +1 -1
- package/templates/docs/04-internal/screens/dashboard.mdx +1 -1
- package/templates/docs/04-internal/screens/index.mdx +1 -1
- package/templates/docs/04-internal/screens/login.mdx +1 -1
- package/templates/docs/04-internal/screens/menu.mdx +1 -1
- package/templates/docs/index.module.css +96 -0
- package/templates/docs/index.tsx +48 -0
- package/templates/docs/introduction/index.mdx +1 -1
- package/templates/docs/introduction/operational-policies/sharepoint.mdx +1 -1
- 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/docs/example.drawio.svg +0 -57
- 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,98 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { join, resolve, dirname } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = dirname(__filename);
|
|
6
|
+
const TEMPLATE_PATH = resolve(__dirname, '../../templates');
|
|
5
7
|
export function generatePackageJson(selections) {
|
|
6
8
|
const { projectName, features } = selections;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
9
|
+
// テンプレートファイルを読み込み
|
|
10
|
+
const templatePath = join(TEMPLATE_PATH, 'package.json.template');
|
|
11
|
+
let packageJsonContent = readFileSync(templatePath, 'utf8');
|
|
12
|
+
// 機能フラグを設定
|
|
62
13
|
const enabledFeatures = features.filter((f) => f.enabled);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
14
|
+
const hasPlantUML = enabledFeatures.some((f) => f.name === 'plantuml');
|
|
15
|
+
const hasMermaid = enabledFeatures.some((f) => f.name === 'mermaid');
|
|
16
|
+
const hasRedoc = enabledFeatures.some((f) => f.name === 'redoc');
|
|
17
|
+
// プロジェクト名を置換
|
|
18
|
+
packageJsonContent = packageJsonContent.replace(/\{\{projectName\}\}/g, projectName);
|
|
19
|
+
// 条件付きセクションを処理
|
|
20
|
+
packageJsonContent = processConditionalSections(packageJsonContent, {
|
|
21
|
+
hasPlantUML,
|
|
22
|
+
hasMermaid,
|
|
23
|
+
hasRedoc,
|
|
24
|
+
});
|
|
25
|
+
// JSONとしてパース
|
|
26
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
27
|
+
return packageJson;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 条件付きセクションを処理する
|
|
31
|
+
* {{#condition}}...{{/condition}} の形式で条件分岐を処理
|
|
32
|
+
*/
|
|
33
|
+
function processConditionalSections(content, conditions) {
|
|
34
|
+
let result = content;
|
|
35
|
+
// 各条件について処理
|
|
36
|
+
for (const [conditionName, isEnabled] of Object.entries(conditions)) {
|
|
37
|
+
const startTag = `{{#${conditionName}}}`;
|
|
38
|
+
const endTag = `{{/${conditionName}}}`;
|
|
39
|
+
// 条件付きセクションを検索
|
|
40
|
+
const regex = new RegExp(`\\{\\{#${conditionName}\\}\\}([\\s\\S]*?)\\{\\{\\/${conditionName}\\}\\}`, 'g');
|
|
41
|
+
if (isEnabled) {
|
|
42
|
+
// 条件が真の場合、タグを削除してコンテンツを残す
|
|
43
|
+
result = result.replace(regex, '$1');
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
// 条件が偽の場合、セクション全体を削除
|
|
47
|
+
result = result.replace(regex, '');
|
|
83
48
|
}
|
|
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
49
|
}
|
|
96
|
-
return
|
|
50
|
+
return result;
|
|
97
51
|
}
|
|
98
52
|
//# sourceMappingURL=package-json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-json.js","sourceRoot":"","sources":["../../src/generators/package-json.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"package-json.js","sourceRoot":"","sources":["../../src/generators/package-json.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,aAAa,GAAG,OAA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