Skip to content

feat: ドキュメントルート直下のindexファイルをプロジェクトタイプで出し分ける#879

Merged
teppei-d merged 3 commits intodevfrom
feat/876-index-file-by-project-type
Mar 5, 2026
Merged

feat: ドキュメントルート直下のindexファイルをプロジェクトタイプで出し分ける#879
teppei-d merged 3 commits intodevfrom
feat/876-index-file-by-project-type

Conversation

@yusasa16
Copy link
Copy Markdown
Collaborator

@yusasa16 yusasa16 commented Feb 27, 2026

概要

Issue #876 の対応。

変更内容

@d-zero/scaffold

  • __assets/htdocs/index.pug のリダイレクト処理(meta http-equiv="refresh")を除去し、純粋なトップページ用テンプレートに変更
  • __assets/htdocs/index.json を追加し、home.pug レイアウトとタイトルを指定

@d-zero/create-frontend

  • static 以外のプロジェクトタイプでは index.pug / index.json を生成しないよう除外
  • baserCMS プロジェクトの kamado.config.tsdevServer.startPath: '__tmpl/' を自動設定(magicast による AST ベースの変換)
  • トランスフォーム後の TS / JS / JSON ファイルに Prettier フォーマットを適用
  • 依存関係に magicastprettier@d-zero/prettier-config を追加

技術的メモ

  • kamado.config.ts の変換には文字列置換の代わりに magicast を採用し、構造的な変更を安全に行う
  • Prettier の設定は @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.ts and 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.pug is no longer a redirect page and adds a new __assets/htdocs/index.json to define the home layout/title.

Adjusts @d-zero/create-frontend generation rules to include or exclude the document-root index.pug/index.json depending on project type, and for baserCMS types automatically patches kamado.config.ts to set devServer.startPath = '__tmpl/' using magicast. 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 and startPath behavior.

Written by Cursor Bugbot for commit f04bcbb. This will update automatically on new commits. Configure here.

Yusaku Sato added 2 commits February 27, 2026 17:30
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
@yusasa16 yusasa16 self-assigned this Feb 27, 2026
@yusasa16 yusasa16 requested a review from teppei-d February 27, 2026 08:39
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

@teppei-d teppei-d merged commit 5975eef into dev Mar 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create-frontend: ドキュメントルート直下のindexファイルを出し分ける

3 participants