create-ampless 1.0.0-alpha.41 → 1.0.0-alpha.44

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/README.ja.md CHANGED
@@ -15,7 +15,7 @@ npx create-ampless@alpha
15
15
 
16
16
  1. プロジェクト名
17
17
  2. サイト名(デフォルトの `<title>` および OGP `siteName` として使用)
18
- 3. テーマ — v0.1 では `blog`
18
+ 3. テーマ — 同梱テーマから選択(例: `blog`)
19
19
  4. プラグイン — `seo`、`rss`、`webhook`
20
20
 
21
21
  出力は AWS Amplify Gen 2 バックエンド定義を含む Next.js 16(App Router)プロジェクトです。`/admin` に管理パネル、`/` にパブリックブログが設置され、選択したプラグインが `cms.config.ts` にあらかじめ設定されます。また運用メモ用の `RUNBOOK.md` も生成されます。
package/README.md CHANGED
@@ -15,7 +15,7 @@ The wizard walks you through:
15
15
 
16
16
  1. Project name
17
17
  2. Site name (used as the default `<title>` and OGP `siteName`)
18
- 3. Theme — `blog` for v0.1
18
+ 3. Theme — pick from the bundled themes (e.g. `blog`)
19
19
  4. Plugins — `seo`, `rss`, `webhook`
20
20
 
21
21
  Output is a Next.js 16 (App Router) project with the AWS Amplify Gen 2 backend definitions, an admin panel at `/admin`, public blog at `/`, the chosen plugins pre-wired in `cms.config.ts`, and a `RUNBOOK.md` for operations notes.
package/dist/index.js CHANGED
@@ -1747,6 +1747,11 @@ var AMPLESS_MANAGED_APP_PATHS = [
1747
1747
  "app/login",
1748
1748
  "app/site"
1749
1749
  ];
1750
+ var AMPLESS_RETIRED_PATHS = [
1751
+ // Retired alongside the in-deploy multi-site drop.
1752
+ "lib/admin-site.ts",
1753
+ "lib/admin-site-client.ts"
1754
+ ];
1750
1755
  var AMPLESS_PACKAGES = /* @__PURE__ */ new Set([
1751
1756
  "ampless",
1752
1757
  "@ampless/admin",
@@ -1898,7 +1903,7 @@ async function pruneEmptyDirs(root) {
1898
1903
  await rm2(root, { recursive: true, force: true });
1899
1904
  }
1900
1905
  }
1901
- async function findObsoleteAppFiles(destDir, sharedDir) {
1906
+ async function findObsoleteFiles(destDir, sharedDir) {
1902
1907
  const obsolete = [];
1903
1908
  for (const managedPath of AMPLESS_MANAGED_APP_PATHS) {
1904
1909
  const userPath = join3(destDir, managedPath);
@@ -1912,9 +1917,15 @@ async function findObsoleteAppFiles(destDir, sharedDir) {
1912
1917
  }
1913
1918
  }
1914
1919
  }
1920
+ for (const retiredPath of AMPLESS_RETIRED_PATHS) {
1921
+ const userFile = join3(destDir, retiredPath);
1922
+ if (existsSync5(userFile)) {
1923
+ obsolete.push(retiredPath);
1924
+ }
1925
+ }
1915
1926
  return obsolete;
1916
1927
  }
1917
- async function removeObsoleteAppFiles(destDir, paths) {
1928
+ async function removeObsoleteFiles(destDir, paths) {
1918
1929
  for (const rel of paths) {
1919
1930
  const abs = join3(destDir, rel);
1920
1931
  if (existsSync5(abs)) {
@@ -1978,7 +1989,7 @@ async function runUpgradeIn(destDir, sharedDir, opts = {}) {
1978
1989
  const shippedThemes = themeSyncEnabled ? await listShippedThemes(templatesRoot) : [];
1979
1990
  const existingThemes = themeSyncEnabled ? await discoverInstalledThemes(destDir) : [];
1980
1991
  const preservedThemes = existingThemes.filter((t) => !shippedThemes.includes(t));
1981
- const obsoleteFiles = await findObsoleteAppFiles(destDir, sharedDir);
1992
+ const obsoleteFiles = await findObsoleteFiles(destDir, sharedDir);
1982
1993
  log3.info(
1983
1994
  `replace: ${pc3.green(`${replaceNew.length} added`)} / ${pc3.yellow(`${replaceUpdate.length} updated`)}`
1984
1995
  );
@@ -2020,7 +2031,7 @@ async function runUpgradeIn(destDir, sharedDir, opts = {}) {
2020
2031
  await copyWithSubstitution(src, dst, vars);
2021
2032
  }
2022
2033
  const themeResult = themeSyncEnabled ? await syncThemes(destDir, templatesRoot) : { synced: [], preserved: [] };
2023
- await removeObsoleteAppFiles(destDir, obsoleteFiles);
2034
+ await removeObsoleteFiles(destDir, obsoleteFiles);
2024
2035
  const templatePkgRaw = await readFile3(join3(sharedDir, "package.json"), "utf-8");
2025
2036
  const templatePkg = JSON.parse(templatePkgRaw);
2026
2037
  const indent = detectIndent(projectPkgRaw);
@@ -93,7 +93,7 @@ UI / テーマを変更した場合、型チェックだけを根拠にタスク
93
93
  ## 既知の制約
94
94
 
95
95
  - **サンドボックスのデータは揮発性。** スキーマに影響する変更は API とテーブルの再構築を引き起こす可能性がある。サンドボックスのコンテンツは使い捨てとして扱うこと。本番データは永続する。
96
- - **1 Amplify デプロイ = 1 サイト。** 複数サイトを別ドメインで配信したい場合は、サイトごとに Amplify 環境を分けてデプロイする。スキーマの `siteId` カラムは常に `"default"` 固定(前方互換のため残してある)。
96
+ - **1 Amplify デプロイ = 1 サイト。** 複数サイトを別ドメインで配信したい場合は、サイトごとに Amplify 環境を分けてデプロイする。
97
97
  - **AppSync 公開 API キーは `amplify_outputs.json` に含まれ、サイト訪問者から見える。** 低信頼の認証情報として扱うこと — このキーの権限は公開済み投稿の読み取りのみ。`api-key-renewer` Lambda が毎月自動ローテーションするため、手動ローテーションは不要。
98
98
  - **最初に登録したユーザーが管理者になる。** 以降のロール変更は Cognito コンソールで行う(RUNBOOK 参照)。
99
99
 
@@ -93,7 +93,7 @@ Do not report a task complete based solely on type checks if a UI/theme was modi
93
93
  ## Known constraints
94
94
 
95
95
  - **Sandbox data is ephemeral.** Schema-affecting changes can rebuild the API and tables; treat sandbox content as throw-away. Production data is durable.
96
- - **One Amplify deployment = one site.** To serve multiple sites on different domains, deploy separate Amplify environments. The schema's `siteId` column is always the literal `"default"` (retained for forward-compat).
96
+ - **One Amplify deployment = one site.** To serve multiple sites on different domains, deploy separate Amplify environments.
97
97
  - **The AppSync public API key is shipped in `amplify_outputs.json` and visible to any site visitor.** Treat it as a low-trust credential — its only privilege is reading published posts. Auto-rotated monthly by the `api-key-renewer` Lambda; no manual rotation needed.
98
98
  - **The first registered user becomes admin.** Subsequent role changes go through the Cognito console (see RUNBOOK).
99
99
 
@@ -10,9 +10,9 @@
10
10
 
11
11
  ## 必要なもの
12
12
 
13
- - **Node.js 20+** と **npm**
14
- - **AWS アカウント**と CLI 認証情報(`aws configure`)— sandbox / 本番ともに実 AWS リソースをデプロイします
15
- - 本番ホスティング(AWS Amplify Hosting)用の **GitHub アカウント**
13
+ - **Node.js 20+** と **npm**。
14
+ - **AWS アカウント.** [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) をインストールしてから `aws configure` で認証情報とデフォルトリージョンを設定します。sandbox / 本番ともに実 AWS リソースをデプロイします。
15
+ - **GitHub アカウント** — AWS Amplify Hosting 経由の本番デプロイで必要。下記の [CLI デプロイフロー](#方法-1-cli-ワンショット推奨) を使う場合は [`gh` CLI](https://cli.github.com/) を `gh auth login` で認証する(または `repo` スコープ付きの `GITHUB_TOKEN` 環境変数を設定する)必要があります。コンソール経由の手動フローには `gh` は不要です。
16
16
 
17
17
  ## コマンド
18
18
 
@@ -122,6 +122,43 @@ export default defineConfig({
122
122
 
123
123
  同梱の [`amplify.yml`](./amplify.yml) が、connect したブランチへの push のたびに `npx ampx pipeline-deploy`(Amplify バックエンド) + `npm run build`(Next.js)を実行します。
124
124
 
125
+ ### 方法 1: CLI ワンショット(推奨)
126
+
127
+ このプロジェクトディレクトリ内で:
128
+
129
+ ```bash
130
+ npx create-ampless@latest --mount \
131
+ --github-owner <your-user-or-org> \
132
+ --aws-region <region> \
133
+ --create-iam-role # 初回のみ。次回以降は `--iam-service-role <arn>` で使い回し
134
+ ```
135
+
136
+ CLI が以下を一気に実行します:
137
+
138
+ 1. GitHub repo を作成(認証済みの `gh` CLI、`GITHUB_TOKEN` 環境変数、または `--github-token` フラグを利用)
139
+ 2. プロジェクトを repo に push
140
+ 3. Amplify Hosting アプリ + ブランチ作成、GitHub 連携登録、`amplify.yml` ビルド spec 配置
141
+ 4. 初回デプロイ起動
142
+
143
+ 便利な追加フラグ:
144
+
145
+ - `--github-private` — private repo を作成(デフォルト: public)
146
+ - `--domain <name>` `--subdomain <prefix>` — 同じ流れの中でカスタムドメインをバインド
147
+ - `--skip-confirm` — 非対話モード(CI / 再実行向け)
148
+ - `--aws-profile <name>` — 複数 AWS profile がある場合に明示
149
+
150
+ 全フラグは `npx create-ampless@latest --help` を参照。
151
+
152
+ **このフロー固有の事前準備([トップの必要なもの](#必要なもの) に加えて):**
153
+
154
+ | | 用途 | 準備方法 |
155
+ |---|---|---|
156
+ | `aws` CLI 認証済み | Amplify Hosting アプリ + サービスロールの provision | [インストール](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) して `aws configure` を実行(または `aws sso login`)。`aws sts get-caller-identity` で確認。 |
157
+ | `gh` CLI 認証済み **または** `GITHUB_TOKEN` env | GitHub repo を作成して初回コミットを push | [`gh` をインストール](https://cli.github.com/) して `gh auth login` を実行、**または** `repo` スコープ付きの [personal access token](https://github.com/settings/tokens) を `GITHUB_TOKEN` として export。`--github-token <token>` を直接渡す場合は不要。 |
158
+ | Amplify Hosting 用 IAM service role | Amplify が代理で backend リソースをデプロイするのに必要 | `--create-iam-role` を渡せば CLI が `AmplifyDeployBackend`(idempotent)を provision。または `--iam-service-role <arn>` で既存ロールを再利用。ロールは `amplify.amazonaws.com` を trust し、`AdministratorAccess-Amplify` を attach している必要があります。 |
159
+
160
+ ### 方法 2: コンソール(手動)
161
+
125
162
  1. **GitHub(または Amplify Hosting が対応する git ホスト)にこのプロジェクトを push**:
126
163
  ```bash
127
164
  git init && git add . && git commit -m "init"
@@ -10,9 +10,9 @@ If you use an AI coding agent (Claude Code, Cursor, Codex, etc.) on this project
10
10
 
11
11
  ## Requirements
12
12
 
13
- - **Node.js 20+** and **npm**
14
- - **AWS account** with CLI credentials (`aws configure`) the sandbox + production both deploy real AWS resources
15
- - **GitHub account** for production hosting via AWS Amplify Hosting
13
+ - **Node.js 20+** and **npm**.
14
+ - **AWS account.** Install the [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), then `aws configure` to set credentials + default region. The sandbox + production both deploy real AWS resources.
15
+ - **GitHub account** for production hosting via AWS Amplify Hosting. The CLI deploy flow ([below](#option-1-cli-one-shot-recommended)) also needs the [`gh` CLI](https://cli.github.com/) authenticated via `gh auth login` (or a `GITHUB_TOKEN` env var with `repo` scope). The manual console flow doesn't need `gh`.
16
16
 
17
17
  ## Commands
18
18
 
@@ -122,6 +122,43 @@ A redeploy is required for plugin changes (the plugin code ships in the Lambda b
122
122
 
123
123
  The shipped [`amplify.yml`](./amplify.yml) runs `npx ampx pipeline-deploy` (Amplify backend) + `npm run build` (Next.js) on every push to the branch you connect.
124
124
 
125
+ ### Option 1: CLI one-shot (recommended)
126
+
127
+ From inside this project directory:
128
+
129
+ ```bash
130
+ npx create-ampless@latest --mount \
131
+ --github-owner <your-user-or-org> \
132
+ --aws-region <region> \
133
+ --create-iam-role # first time only; reuse `--iam-service-role <arn>` on later mounts
134
+ ```
135
+
136
+ The CLI:
137
+
138
+ 1. Creates a GitHub repo (uses your authenticated `gh` CLI, the `GITHUB_TOKEN` env var, or the `--github-token` flag).
139
+ 2. Pushes this project to that repo.
140
+ 3. Provisions an Amplify Hosting app + branch, registers the GitHub connection, writes the `amplify.yml` build spec.
141
+ 4. Kicks off the first deploy.
142
+
143
+ Useful extra flags:
144
+
145
+ - `--github-private` — private repo (default: public)
146
+ - `--domain <name>` `--subdomain <prefix>` — bind a custom domain in the same pass
147
+ - `--skip-confirm` — non-interactive (good for CI / re-runs)
148
+ - `--aws-profile <name>` — explicit AWS profile when you have multiple
149
+
150
+ See `npx create-ampless@latest --help` for the full list.
151
+
152
+ **Prerequisites for this flow (in addition to the [top-level Requirements](#requirements)):**
153
+
154
+ | | Why | How |
155
+ |---|---|---|
156
+ | `aws` CLI authenticated | Provisions the Amplify Hosting app + service role | [Install](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) and run `aws configure` (or `aws sso login`). Verify with `aws sts get-caller-identity`. |
157
+ | `gh` CLI authenticated **or** `GITHUB_TOKEN` env | Creates the GitHub repo and pushes the initial commit | [Install `gh`](https://cli.github.com/) and `gh auth login`, **or** export a [personal access token](https://github.com/settings/tokens) with `repo` scope as `GITHUB_TOKEN`. Skip if you pass `--github-token <token>` directly. |
158
+ | IAM service role for Amplify Hosting | Lets Amplify deploy backend resources on your behalf | Either pass `--create-iam-role` to have the CLI provision one named `AmplifyDeployBackend` (idempotent), or pass `--iam-service-role <arn>` to reuse an existing role. The role must trust `amplify.amazonaws.com` and have `AdministratorAccess-Amplify` attached. |
159
+
160
+ ### Option 2: Console (manual)
161
+
125
162
  1. **Push this project to GitHub** (or another git host Amplify Hosting supports):
126
163
  ```bash
127
164
  git init && git add . && git commit -m "init"
@@ -24,7 +24,7 @@ ampless で構築したサイトで、ときどき必要になる運用作業の
24
24
 
25
25
  ### なぜ API キーなのか(Identity Pool ゲストロールではなく)?
26
26
 
27
- Amplify Gen 2 の `a.handler.custom` リゾルバーは `allow.guest()` や `allow.authenticated('identityPool')` をサポートしておらず、apiKey / userPool / lambda / group / owner のみが使用可能です。v0.1 では簡潔さを優先して API キーを選択しました。パブリック読み取りを Lambda 関数データソース(`a.handler.function`)に移行することは v0.2 の候補です。
27
+ Amplify Gen 2 の `a.handler.custom` リゾルバーは `allow.guest()` や `allow.authenticated('identityPool')` をサポートしておらず、apiKey / userPool / lambda / group / owner のみが使用可能です。ampless では簡潔さを優先して API キーを選択しています。パブリック読み取りを Lambda 関数データソース(`a.handler.function`)に移行することは将来の選択肢です。
28
28
 
29
29
  ### 自動更新 — ローテーション手順は不要
30
30
 
@@ -87,11 +87,11 @@ aws cognito-idp admin-set-user-password \
87
87
 
88
88
  ### Post テーブルのバックアップからの復元
89
89
 
90
- DynamoDB のポイントインタイムリカバリ(PITR)は v0.1 の `defineData` では有効になっていません。AWS コンソール → DynamoDB → Tables → `<投稿テーブル名>` → Backups → Edit PITR から手動で有効化してください。有効化後は `aws dynamodb restore-table-to-point-in-time` で新しいテーブルに復元し、その後アイテムをライブテーブルに移行する作業が必要です。
90
+ DynamoDB のポイントインタイムリカバリ(PITR)は `defineData` では有効になっていません。AWS コンソール → DynamoDB → Tables → `<投稿テーブル名>` → Backups → Edit PITR から手動で有効化してください。有効化後は `aws dynamodb restore-table-to-point-in-time` で新しいテーブルに復元し、その後アイテムをライブテーブルに移行する作業が必要です。
91
91
 
92
92
  ### 失敗したプラグインイベントの確認
93
93
 
94
- 処理に失敗したプロセッサー呼び出しは、`amplify/backend.ts` で作成された共有イベント DLQ(`EventsDlq`)に送られます。SQS コンソールまたは `aws sqs receive-message --queue-url <dlq-url> --max-number-of-messages 10` でメッセージを確認してください。v0.1 には自動アラームがないため、定期的な手動確認を推奨します。あるいは `ApproximateNumberOfMessagesVisible` に CloudWatch アラームを設定してください。
94
+ 処理に失敗したプロセッサー呼び出しは、`amplify/backend.ts` で作成された共有イベント DLQ(`EventsDlq`)に送られます。SQS コンソールまたは `aws sqs receive-message --queue-url <dlq-url> --max-number-of-messages 10` でメッセージを確認してください。ampless にはデフォルトの自動アラームがないため、定期的な手動確認を推奨します。あるいは `ApproximateNumberOfMessagesVisible` に CloudWatch アラームを設定してください。
95
95
 
96
96
  ## カスタムドメイン
97
97
 
@@ -31,9 +31,9 @@ return rows where `status === 'published'`.
31
31
 
32
32
  Amplify Gen 2 `a.handler.custom` resolvers don't support `allow.guest()`
33
33
  or `allow.authenticated('identityPool')` — only apiKey / userPool /
34
- lambda / group / owner. v0.1 chose API key for simplicity; switching
35
- the public reads to a Lambda function data source (`a.handler.function`)
36
- is a v0.2 candidate.
34
+ lambda / group / owner. ampless uses the API key for simplicity;
35
+ moving the public reads to a Lambda function data source
36
+ (`a.handler.function`) is a future option.
37
37
 
38
38
  ### Auto-renewal — no rotation runbook required
39
39
 
@@ -101,8 +101,8 @@ The `/login` page also has a self-service "Forgot password?" flow.
101
101
 
102
102
  ### Restore from a Post-table backup
103
103
 
104
- DynamoDB Point-in-Time Recovery is **not** enabled by `defineData` in
105
- v0.1; turn it on manually via AWS Console → DynamoDB → Tables →
104
+ DynamoDB Point-in-Time Recovery is **not** enabled by `defineData`;
105
+ turn it on manually via AWS Console → DynamoDB → Tables →
106
106
  `<your post table>` → Backups → Edit PITR. Once enabled, restoration
107
107
  takes the form `aws dynamodb restore-table-to-point-in-time` to a new
108
108
  table; you'll need to migrate items back to the live table afterwards.
@@ -112,8 +112,9 @@ table; you'll need to migrate items back to the live table afterwards.
112
112
  Failed processor invocations land in the shared events DLQ created in
113
113
  `amplify/backend.ts` (`EventsDlq`). View messages via the SQS console
114
114
  or `aws sqs receive-message --queue-url <dlq-url> --max-number-of-messages 10`.
115
- There's no automated alarm in v0.1 — periodic manual checks recommended,
116
- or wire up a CloudWatch alarm on `ApproximateNumberOfMessagesVisible`.
115
+ ampless doesn't ship an automated alarm out of the box — periodic
116
+ manual checks are recommended, or wire up a CloudWatch alarm on
117
+ `ApproximateNumberOfMessagesVisible`.
117
118
 
118
119
  ## Custom domains
119
120
 
@@ -1,7 +1,8 @@
1
- // Back-compat shim. KvStore provider installation moved to
2
- // `@ampless/admin` (L2 extraction). The install runs automatically
3
- // inside the admin's <AdminProviders> bootstrap, so a side-effect
4
- // `import '@/lib/kv-provider'` is no longer required kept as a
5
- // safe no-op for legacy callers.
1
+ // Back-compat shim. KvStore provider installation lives in
2
+ // `@ampless/admin` and runs automatically inside the admin's
3
+ // <AdminProviders> bootstrap, so a side-effect
4
+ // `import '@/lib/kv-provider'` is not required. Kept as a safe
5
+ // no-op so existing user code that still imports this path keeps
6
+ // working.
6
7
 
7
8
  export {}
@@ -1,7 +1,8 @@
1
- // Back-compat shim. Admin Posts provider installation moved to
2
- // `@ampless/admin` (L2 extraction). The install runs automatically
3
- // inside the admin's <AdminProviders> bootstrap, so a side-effect
4
- // `import '@/lib/posts-provider'` is no longer required kept as a
5
- // safe no-op for legacy callers.
1
+ // Back-compat shim. Admin Posts provider installation lives in
2
+ // `@ampless/admin` and runs automatically inside the admin's
3
+ // <AdminProviders> bootstrap, so a side-effect
4
+ // `import '@/lib/posts-provider'` is not required. Kept as a safe
5
+ // no-op so existing user code that still imports this path keeps
6
+ // working.
6
7
 
7
8
  export {}
@@ -22,15 +22,15 @@
22
22
  "@tiptap/pm": "^3.23.4",
23
23
  "@tiptap/react": "^3.23.4",
24
24
  "@tiptap/starter-kit": "^3.23.4",
25
- "@ampless/plugin-og-image": "^0.2.0-alpha.10",
26
- "@ampless/plugin-rss": "^0.2.0-alpha.10",
27
- "@ampless/plugin-seo": "^0.2.0-alpha.10",
28
- "@ampless/plugin-webhook": "^0.2.0-alpha.10",
29
- "@ampless/admin": "^1.0.0-alpha.27",
30
- "@ampless/backend": "^1.0.0-alpha.20",
31
- "@ampless/runtime": "^1.0.0-alpha.14",
25
+ "@ampless/plugin-og-image": "^0.2.0-alpha.11",
26
+ "@ampless/plugin-rss": "^0.2.0-alpha.11",
27
+ "@ampless/plugin-seo": "^0.2.0-alpha.11",
28
+ "@ampless/plugin-webhook": "^0.2.0-alpha.11",
29
+ "@ampless/admin": "^1.0.0-alpha.28",
30
+ "@ampless/backend": "^1.0.0-alpha.21",
31
+ "@ampless/runtime": "^1.0.0-alpha.15",
32
32
  "@digital-go-jp/tailwind-theme-plugin": "^0.3.4",
33
- "ampless": "^1.0.0-alpha.10",
33
+ "ampless": "^1.0.0-alpha.11",
34
34
  "aws-amplify": "^6.10.0",
35
35
  "class-variance-authority": "^0.7.1",
36
36
  "clsx": "^2.1.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ampless",
3
- "version": "1.0.0-alpha.41",
3
+ "version": "1.0.0-alpha.44",
4
4
  "description": "Create a new ampless project",
5
5
  "license": "MIT",
6
6
  "type": "module",