Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
70 changes: 0 additions & 70 deletions .github/README.md

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI

on:
pull_request:
branches: [develop, prod]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- run: npm ci

- run: npm run lint

- run: npm run build
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy to ic-gr.net

on:
push:
branches: [prod]
workflow_dispatch:

permissions:
id-token: write
contents: read

concurrency:
group: deploy-prod
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- run: npm ci

- run: npm run build

- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::058264181659:role/github-actions-ic-gr-deploy
aws-region: ap-northeast-1

- name: Sync to S3
run: aws s3 sync out/ s3://ic-gr.com/ --delete

- name: Invalidate CloudFront cache (ic-gr.net)
run: |
aws cloudfront create-invalidation \
--distribution-id EHFD30ZL5XZ0U \
--paths "/*"
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
# testing
/coverage

# production
/build
# next.js
/.next/
/out/

# typescript
*.tsbuildinfo
next-env.d.ts

# misc
.DS_Store
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
135 changes: 80 additions & 55 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,92 +1,117 @@
# neko — Ic-Growth コーポレートサイト
# ic-gr-website — Ic-Growth コーポレートサイト

Create React App 製の SPA。本番は AWS S3 + CloudFront で `https://www.ic-gr.net/` に公開。
Next.js 15 (App Router) + React 19 + TypeScript + Tailwind CSS v4 製の静的サイト。`https://www.ic-gr.net/` で公開。

> 旧称 `neko`。リポジトリ名は `ic-gr-website` にリネーム済み(GitHub の自動リダイレクトで旧 URL も一定期間有効)。

## 開発コマンド

```bash
nvm use # .nvmrc に従って Node 20 を選択
npm install
npm start # http://localhost:3000
npm run build # build/ に成果物を出力
npm test
npm run dev # http://localhost:3000
npm run build # next build (static export → out/)
npm run lint
```

## デプロイ(本番: ic-gr.net)
## デプロイ

`prod` ブランチへの push で GitHub Actions が自動デプロイする(手動操作は不要)。

```
develop ← 機能ブランチからの PR を集約
prod ← push されると本番デプロイ
```

参考記事: https://qiita.com/ushi_osushi/items/a32d7b710567c2313faa (S3+CloudFront+Route53+ACM の手動構築ガイド。CI/CDは無く手動デプロイ)
ステージング環境は存在しない。`develop` で動作確認後にそのまま `prod` へ進める。

AWS プロファイル: `ic-gr`(アカウント `058264181659`)
ワークフロー:
- `.github/workflows/ci.yml` — PR 時に `npm run lint` + `npm run build` を実行
- `.github/workflows/deploy.yml` — `prod` push をトリガに `next build` → `aws s3 sync out/` → CloudFront invalidation

```bash
# 1. ビルド(相対パスで出すため PUBLIC_URL を上書き)
PUBLIC_URL=. npm run build
GitHub Actions は OIDC で IAM Role `arn:aws:iam::058264181659:role/github-actions-ic-gr-deploy` を assume するため、リポジトリに AWS シークレットは持たない。

# 2. S3 同期(バケットは ap-northeast-1 / 非公開・OAC経由)
aws --profile ic-gr s3 sync build/ s3://ic-gr.com/ --delete
### 緊急時の手動デプロイ(フォールバック)

# 3. CloudFront キャッシュ無効化(ic-gr.net 用)
ローカルから `aws --profile ic-gr` で同じことを実行できる。

```bash
npm ci
npm run build
aws --profile ic-gr s3 sync out/ s3://ic-gr.com/ --delete
aws --profile ic-gr cloudfront create-invalidation \
--distribution-id EHFD30ZL5XZ0U --paths "/*"
```

### インフラ構成(AWS 上の実体)
## インフラ構成(AWS 上の実体)

| リソース | 値 |
|---|---|
| S3 バケット | `ic-gr.com`(ap-northeast-1、非公開、OAC からのみ `s3:GetObject` 許可) |
| AWS アカウント | `058264181659`(CLI プロファイル `ic-gr`) |
| S3 バケット | `ic-gr.com`(ap-northeast-1、非公開、CloudFront OAC 経由のみ `s3:GetObject` 許可) |
| CloudFront(本番) | `EHFD30ZL5XZ0U` / `d2sot6ky3ie96o.cloudfront.net` — alias: `ic-gr.net`, `www.ic-gr.net`, `*.ic-gr.net` |
| CloudFront(旧/併設) | `E3CUYP7CXV3V06` / `d16tpwwtsnlv00.cloudfront.net` — alias: `ic-gr.com`, `www.ic-gr.com`, `*.ic-gr.com` |
| CloudFront(旧 `.com` 系) | `E3CUYP7CXV3V06` / `d16tpwwtsnlv00.cloudfront.net` — alias: `ic-gr.com`, `www.ic-gr.com`, `*.ic-gr.com`(同じ S3 を origin) |
| Route53 ホストゾーン | `ic-gr.net.`(A レコードで CloudFront にエイリアス、ワイルドカードあり) |
| デプロイ用 IAM Role | `github-actions-ic-gr-deploy`(GitHub OIDC で `repo:angurodon/ic-gr-website:ref:refs/heads/prod` のみ信頼) |
| Default Root Object | `index.html` |

`.com` ドメインの CloudFront も同じ S3 バケットを向いているので、`s3 sync` 後は両方の invalidation を打つかどうか判断する。

### `package.json` の `homepage` に注意

`homepage` が `https://angurodon.github.io/neko` のままになっている(旧 GitHub Pages 配信の名残)。
そのままビルドすると CRA がアセットを `/neko/static/...` 配下に出力し、ic-gr.net では 404 になる。
**AWS デプロイ時は必ず `PUBLIC_URL=.` か `homepage: "."` で上書きしてビルドする**こと。
S3 上の `index.html` は実際に相対パス(`./static/js/...`)でビルドされている。

### `npm run deploy` は AWS 用ではない

`package.json` の `deploy` スクリプトは `gh-pages -d build`(GitHub Pages 用)。AWS デプロイには使わない。
`.com` ドメイン側の CloudFront には今回のデプロイでは invalidation を打っていないため、`*.ic-gr.com` でも即時反映したい場合は手動で `--distribution-id E3CUYP7CXV3V06` の invalidation を実行する。

## ルーティング上の既知の制約
### SPA 直リンク問題は解消済み

- `App.js` は `react-router-dom` の `BrowserRouter` を使用。ルート: `/`, `/neko`, `/overview`, `/company`, `/privacy`。
- CloudFront のカスタムエラーレスポンス未設定。`/overview` 等の**直リンク(リロード)は S3 から 403/404 が返る**。現状はヘッダのリンク経由でのみ遷移可能。
- 直リンクを動かすには CloudFront に `403/404 → /index.html (200)` の Custom Error Response を追加する必要がある。
旧 CRA では CloudFront に Custom Error Response 未設定だったため `/overview` などのリロードで 403 を返していたが、Next.js の static export + `trailingSlash: true` で各ルートが `out/overview/index.html` として生成されるため、ハードリロードでも 200 が返る。

## ディレクトリ構成

```
src/
├── App.js # ルーティング
├── index.js / index.css # エントリ
├── ScrollToTop.js # ルート遷移時のスクロール初期化
├── assets/ # 画像(ロゴ、サービス紹介画像)
├── components/
│ ├── HeaderComponents/ # ヘッダ(ハンバーガーメニュー、外部 Google フォームへのリンク)
│ ├── FooterComponents/
│ ├── HomepageComponents/ # `/` と `/neko` の本体。SectionComponent1 + Backup + Consult を組み合わせる
│ ├── SectionComponent1/ # トップのヒーロー部
│ ├── BackupComponents/ # サービス: バックアップ系
│ ├── ConsultComponents/ # サービス: コンサル系
│ ├── OverviewComponents/ # /overview 事業概要
│ ├── CompanyComponents/ # /company 会社概要
│ └── PrivacyComponents/ # /privacy
└── Gabage/ # 旧コンポーネント(typo: Garbage ではなく Gabage)。SystemSupport / BusinessSupport / MAS。App.js でコメントアウト中。削除可否を確認してから消すこと
ic-gr-website/
├── app/
│ ├── layout.tsx # ルートレイアウト(Header + Footer + ScrollToTop + metadata)
│ ├── page.tsx # / (SectionComponent1 + Backup + Consult)
│ ├── overview/page.tsx # /overview (事業概要 + 3 セクション)
│ ├── company/page.tsx # /company (会社概要テーブル)
│ ├── privacy/page.tsx # /privacy (個人情報保護方針)
│ ├── sitemap.ts # ビルド時に sitemap.xml を生成
│ ├── robots.ts # ビルド時に robots.txt を生成
│ ├── globals.css # Tailwind v4 + CSS 変数(ブランドカラー / フォント)
│ └── components/
│ ├── Header.tsx # 'use client' (ハンバーガー開閉)
│ ├── Footer.tsx
│ ├── ScrollToTop.tsx # 'use client' (usePathname でスクロールリセット)
│ ├── SectionComponent1.tsx
│ ├── Backup.tsx # トップの3カード(/overview#... に遷移)
│ └── Consult.tsx # 電話相談バナー
├── public/
│ ├── favicon.ico # ※ Ic-Growth ブランドの ico に差し替え予定
│ ├── apple-touch-icon.png # ※ ブランド資産入手後に追加
│ ├── logo192.png / logo512.png
│ ├── manifest.webmanifest
│ └── images/ # next/image で参照する画像群
├── next.config.ts # output: 'export', trailingSlash: true, images.unoptimized: true
├── tsconfig.json
├── postcss.config.mjs # @tailwindcss/postcss
├── .nvmrc # 20
└── .github/workflows/
├── ci.yml
└── deploy.yml
```

問い合わせは外部 Google Form(Header.jsx 内に URL ハードコード)。
問い合わせは外部 Google Form(`Header.tsx` / `Footer.tsx` 内に URL ハードコード)。

## 未使用の依存関係
## ブランド資産(未確定)

`i18next` 系・`react-i18next` 系・`react-scroll` 系が `package.json` にあるがコード側で `import` されていない。多言語対応や smooth scroll を再導入する予定が無いなら、`npm uninstall` で整理して構わない。
旧 CRA 版から失われたタイトル `Ic-Growth` と独自 favicon は、ユーザーから素材を受領後に以下を差し替える:
- `public/favicon.ico`(マルチサイズ ICO 推奨: 16/32/48)
- `public/apple-touch-icon.png` (180×180)
- `public/logo192.png` (192×192)
- `public/logo512.png` (512×512)
タイトルとメタ description は `app/layout.tsx` で定義済み。

## ブランチ運用

- 本流: `main`
- 機能別ブランチ(`form`, `phone`, `footer`, `route`, `sumaho`, `fix-1` 等)を切って PR → squash/merge する流れ。
- `gh-pages` ブランチは旧 GitHub Pages 配信の成果物ブランチ。AWS 配信に移行済みのため通常触らない。
- `develop` (デフォルト): 機能ブランチからの PR を集約
- `prod`: push されると本番デプロイ
- 旧 `main` / `gh-pages` ブランチは過去の遺物。ステージングは持たない運用に変更したため `main` は使わない
- 機能ブランチは `feature/<topic>` 命名で `develop` から切る
Loading
Loading