feat: ドキュメントルート直下のindexファイルをプロジェクトタイプで出し分ける#879
Conversation
Remove the meta http-equiv="refresh" redirect from index.pug and change it to a pure top page template using the home layout. Add index.json to specify the layout and title for the page compiler. Made-with: Cursor
…enerated files - Exclude index.pug and index.json from non-static (CMS) project types - Add startPath: '__tmpl/' to devServer in kamado.config.ts for baserCMS projects via AST-based modification using magicast - Apply prettier formatting after transform for TS/JS/JSON files using @d-zero/prettier-config/base to ensure correct output style - Add magicast, prettier, @d-zero/prettier-config as dependencies Note: string replace was considered as an alternative to magicast for kamado.config.ts, but AST-based modification was chosen to avoid fragile text matching. The full prettier config was not used to avoid loading @prettier/plugin-pug, which is unnecessary since pug files are not transformed in ways that require re-formatting. Made-with: Cursor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Free Tier Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| '.js': 'babel', | ||
| '.mjs': 'babel', | ||
| '.cjs': 'babel', | ||
| '.json': 'json', |
There was a problem hiding this comment.
Prettier json parser fails on JSONC files with comments
High Severity
The parserMap maps .json to Prettier's 'json' parser, which is strict and rejects comments. However, scaffold files cspell.json (has // Libraries) and tsconfig.json (has // Instead to use Vite,) contain JSONC-style comments. prettierFormat will throw a SyntaxError when processing these files, breaking scaffold generation for all project types. The parser for .json files needs to be 'jsonc' instead.


概要
Issue #876 の対応。
変更内容
@d-zero/scaffold__assets/htdocs/index.pugのリダイレクト処理(meta http-equiv="refresh")を除去し、純粋なトップページ用テンプレートに変更__assets/htdocs/index.jsonを追加し、home.pugレイアウトとタイトルを指定@d-zero/create-frontendstatic以外のプロジェクトタイプではindex.pug/index.jsonを生成しないよう除外kamado.config.tsにdevServer.startPath: '__tmpl/'を自動設定(magicast による AST ベースの変換)magicast、prettier、@d-zero/prettier-configを追加技術的メモ
kamado.config.tsの変換には文字列置換の代わりにmagicastを採用し、構造的な変更を安全に行う@d-zero/prettier-config/baseを使用(@prettier/plugin-pugは pug ファイルの再フォーマットが不要なため含めない)Closes #876
Made with Cursor
Note
Medium Risk
Changes the scaffolding output and post-processing for generated projects (including AST-based edits to
kamado.config.tsand automatic Prettier formatting), which could affect generated file contents across project types if edge cases slip through.Overview
Updates the scaffold so the document-root
__assets/htdocs/index.pugis no longer a redirect page and adds a new__assets/htdocs/index.jsonto define the home layout/title.Adjusts
@d-zero/create-frontendgeneration rules to include or exclude the document-rootindex.pug/index.jsondepending on project type, and for baserCMS types automatically patcheskamado.config.tsto setdevServer.startPath = '__tmpl/'usingmagicast. The generator now runs Prettier (with@d-zero/prettier-config) on generated TS/JS/JSON, updates dependencies accordingly, and extends tests to assert the new file list andstartPathbehavior.Written by Cursor Bugbot for commit f04bcbb. This will update automatically on new commits. Configure here.