create-ampless 0.2.0-alpha.0 → 0.2.0-alpha.2

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/dist/index.js CHANGED
@@ -16,7 +16,7 @@ async function runPrompts(argProjectName) {
16
16
  placeholder: "my-ampless-site",
17
17
  defaultValue: argProjectName ?? "my-ampless-site",
18
18
  validate: (v) => {
19
- if (!v.trim()) return "Project name is required";
19
+ if (!v || !v.trim()) return "Project name is required";
20
20
  if (!/^[a-z0-9-_]+$/.test(v)) return "Use lowercase letters, numbers, hyphens, underscores";
21
21
  }
22
22
  }),
@@ -1,8 +1,13 @@
1
- import { defineAmplessAuth } from '@ampless/backend'
1
+ import { defineAuth } from '@aws-amplify/backend'
2
+ import { amplessAuthConfig } from '@ampless/backend'
2
3
  import { postConfirmation } from './post-confirmation/resource.js'
3
4
 
4
5
  // Provisions a Cognito User Pool + Identity Pool with the three role
5
6
  // groups (ampless-admin, ampless-editor, ampless-reader) and wires in
6
7
  // the post-confirmation Lambda that promotes the first confirmed user
7
8
  // to ampless-admin.
8
- export const auth = defineAmplessAuth({ postConfirmation })
9
+ //
10
+ // `defineAuth` must be called from this file directly — Amplify Gen 2's
11
+ // import-path verifier requires it to live at amplify/auth/resource.ts.
12
+ // `amplessAuthConfig` just returns the props object.
13
+ export const auth = defineAuth(amplessAuthConfig({ postConfirmation }))
@@ -1,7 +1,12 @@
1
- import { defineAmplessStorage } from '@ampless/backend'
1
+ import { defineStorage } from '@aws-amplify/backend'
2
+ import { amplessStorageConfig } from '@ampless/backend'
2
3
 
3
4
  // Provisions the ampless media + plugins bucket with guest read on
4
5
  // `public/*` and admin/editor write on the matched prefixes. CORS and
5
6
  // the bucket-level public-access policy are applied by
6
7
  // defineAmplessBackend.
7
- export const storage = defineAmplessStorage()
8
+ //
9
+ // `defineStorage` must be called from this file directly — Amplify Gen 2's
10
+ // import-path verifier requires it to live at amplify/storage/resource.ts.
11
+ // `amplessStorageConfig` just returns the props object.
12
+ export const storage = defineStorage(amplessStorageConfig())
@@ -1,7 +1,15 @@
1
+ 'use client'
2
+
1
3
  // Back-compat shim. I18n provider + hooks moved to `@ampless/admin`
2
4
  // (L2 extraction). The component tree mounts the provider inside the
3
5
  // admin layout factory; the root layout in `app/layout.tsx` still
4
6
  // wraps the public site in this same provider to keep client-side
5
7
  // `useT()` calls working from theme-side components too.
8
+ //
9
+ // The `'use client'` directive is needed because the bundled
10
+ // @ampless/admin/components ESM strips per-file 'use client' (tsup
11
+ // default behaviour). This shim re-establishes a client boundary so
12
+ // Next.js doesn't try to evaluate the React hooks inside an RSC
13
+ // server context.
6
14
 
7
15
  export { I18nProvider, useT, useLocale } from '@ampless/admin/components'
@@ -4,5 +4,9 @@
4
4
 
5
5
  import { admin } from './admin'
6
6
 
7
- export const currentAdminSiteId = admin.currentAdminSiteId.bind(admin)
8
- export const adminSiteOptions = admin.adminSiteOptions.bind(admin)
7
+ // Arrow wrappers: defer `admin` resolution to call time (avoid TDZ in
8
+ // case of circular import chains touching admin shims).
9
+ export const currentAdminSiteId: typeof admin.currentAdminSiteId =
10
+ (...args) => admin.currentAdminSiteId(...args)
11
+ export const adminSiteOptions: typeof admin.adminSiteOptions =
12
+ (...args) => admin.adminSiteOptions(...args)
@@ -4,18 +4,24 @@
4
4
  //
5
5
  // L2 architectural change (admin extraction): admin UI now lives in
6
6
  // `@ampless/admin`. This module wires the project's
7
- // `amplify_outputs.json`, `cms.config`, and `ampless` runtime into a
8
- // single `Admin` instance.
7
+ // `amplify_outputs.json` and `cms.config` into a single `Admin`
8
+ // instance.
9
+ //
10
+ // NOTE: We intentionally do NOT pass an `ampless` instance to
11
+ // createAdmin. That would import `lib/ampless.ts`, which imports
12
+ // `themes-registry`, which (via theme pages → `lib/i18n.ts`) imports
13
+ // back to this file — a circular chain that crashes with a TDZ
14
+ // ReferenceError on `ampless` at module init. `createAdmin` builds
15
+ // its own internal Ampless when omitted, which is functionally
16
+ // equivalent for admin's needs.
9
17
 
10
18
  import outputs from '../amplify_outputs.json'
11
19
  import cmsConfig from '@/cms.config'
12
20
  import { createAdmin } from '@ampless/admin'
13
- import { ampless } from './ampless'
14
21
 
15
22
  export const admin = createAdmin({
16
23
  outputs,
17
24
  cmsConfig,
18
- ampless,
19
25
  locale: (cmsConfig as { locale?: string }).locale ?? 'en',
20
26
  })
21
27
 
@@ -6,6 +6,10 @@ import { admin } from './admin'
6
6
 
7
7
  export type { ServerSession } from '@ampless/admin'
8
8
 
9
- export const getServerSession = admin.getServerSession.bind(admin)
10
- export const isAdmin = admin.isAdmin.bind(admin)
11
- export const isEditor = admin.isEditor.bind(admin)
9
+ // Arrow wrappers: defer `admin` resolution to call time (avoid TDZ).
10
+ export const getServerSession: typeof admin.getServerSession =
11
+ (...args) => admin.getServerSession(...args)
12
+ export const isAdmin: typeof admin.isAdmin =
13
+ (...args) => admin.isAdmin(...args)
14
+ export const isEditor: typeof admin.isEditor =
15
+ (...args) => admin.isEditor(...args)
@@ -20,7 +20,11 @@ export function getDictionary(locale: Locale = admin.locale): Dictionary {
20
20
  return adminGetDictionary(locale)
21
21
  }
22
22
 
23
- export const t = admin.t
23
+ // Arrow wrapper: defer `admin` resolution to call time. If a future
24
+ // circular import chain triggers i18n.ts before admin.ts has finished
25
+ // initialising, eager `admin.t` would TDZ; calling the method through
26
+ // a wrapper avoids that.
27
+ export const t: typeof admin.t = (key, vars) => admin.t(key, vars)
24
28
 
25
29
  export function translate(
26
30
  _dict: Dictionary,
@@ -8,9 +8,17 @@
8
8
 
9
9
  import { ampless } from './ampless'
10
10
 
11
- export const listPublishedPosts = ampless.listPublishedPosts.bind(ampless)
12
- export const getPublishedPost = ampless.getPublishedPost.bind(ampless)
13
- export const listPostsByTag = ampless.listPostsByTag.bind(ampless)
11
+ // Arrow function wrappers (not `.bind(ampless)`) so the `ampless`
12
+ // binding is read at call time, not at module evaluation. Module
13
+ // evaluation can run while `lib/ampless.ts` is still in its TDZ
14
+ // because the themes-registry → theme → shim → ampless dependency
15
+ // chain is circular by construction.
16
+ export const listPublishedPosts: typeof ampless.listPublishedPosts =
17
+ (...args) => ampless.listPublishedPosts(...args)
18
+ export const getPublishedPost: typeof ampless.getPublishedPost =
19
+ (...args) => ampless.getPublishedPost(...args)
20
+ export const listPostsByTag: typeof ampless.listPostsByTag =
21
+ (...args) => ampless.listPostsByTag(...args)
14
22
 
15
23
  export type {
16
24
  ListPostsOptions,
@@ -4,5 +4,8 @@
4
4
 
5
5
  import { ampless } from './ampless'
6
6
 
7
- export const postMetadata = ampless.postMetadata.bind(ampless)
8
- export const siteMetadata = ampless.siteMetadata.bind(ampless)
7
+ // Arrow wrappers: defer `ampless` resolution to call time (avoid TDZ).
8
+ export const postMetadata: typeof ampless.postMetadata =
9
+ (...args) => ampless.postMetadata(...args)
10
+ export const siteMetadata: typeof ampless.siteMetadata =
11
+ (...args) => ampless.siteMetadata(...args)
@@ -3,6 +3,9 @@
3
3
 
4
4
  import { ampless } from './ampless'
5
5
 
6
- export const loadSiteSettings = ampless.loadSiteSettings.bind(ampless)
6
+ // Arrow wrapper: defer `ampless` resolution to call time (avoid TDZ in
7
+ // the themes-registry → theme → shim → ampless circular import chain).
8
+ export const loadSiteSettings: typeof ampless.loadSiteSettings =
9
+ (...args) => ampless.loadSiteSettings(...args)
7
10
 
8
11
  export type { EffectiveSiteSettings } from '@ampless/runtime'
@@ -3,5 +3,8 @@
3
3
 
4
4
  import { ampless } from './ampless'
5
5
 
6
- export const publicAssetUrl = ampless.publicAssetUrl.bind(ampless)
7
- export const isStorageConfigured = ampless.isStorageConfigured.bind(ampless)
6
+ // Arrow wrappers: defer `ampless` resolution to call time (avoid TDZ).
7
+ export const publicAssetUrl: typeof ampless.publicAssetUrl =
8
+ (...args) => ampless.publicAssetUrl(...args)
9
+ export const isStorageConfigured: typeof ampless.isStorageConfigured =
10
+ (...args) => ampless.isStorageConfigured(...args)
@@ -3,6 +3,8 @@
3
3
 
4
4
  import { ampless } from './ampless'
5
5
 
6
- export const resolveActiveTheme = ampless.resolveActiveTheme.bind(ampless)
6
+ // Arrow wrapper: defer `ampless` resolution to call time (avoid TDZ).
7
+ export const resolveActiveTheme: typeof ampless.resolveActiveTheme =
8
+ (...args) => ampless.resolveActiveTheme(...args)
7
9
 
8
10
  export type { ResolvedTheme } from '@ampless/runtime'
@@ -3,7 +3,9 @@
3
3
 
4
4
  import { ampless } from './ampless'
5
5
 
6
- export const loadThemeConfig = ampless.loadThemeConfig.bind(ampless)
6
+ // Arrow wrapper: defer `ampless` resolution to call time (avoid TDZ).
7
+ export const loadThemeConfig: typeof ampless.loadThemeConfig =
8
+ (...args) => ampless.loadThemeConfig(...args)
7
9
 
8
10
  export { renderThemeCss } from '@ampless/runtime'
9
11
 
@@ -15,29 +15,29 @@
15
15
  "@radix-ui/react-dialog": "^1.1.4",
16
16
  "@radix-ui/react-label": "^2.1.1",
17
17
  "@radix-ui/react-slot": "^1.1.1",
18
- "@tiptap/extension-image": "^2.10.4",
19
- "@tiptap/extension-link": "^2.10.4",
20
- "@tiptap/pm": "^2.10.4",
21
- "@tiptap/react": "^2.10.4",
22
- "@tiptap/starter-kit": "^2.10.4",
23
- "@ampless/plugin-og-image": "^0.2.0-alpha.0",
24
- "@ampless/plugin-rss": "^0.2.0-alpha.0",
25
- "@ampless/plugin-seo": "^0.2.0-alpha.0",
26
- "@ampless/plugin-webhook": "^0.2.0-alpha.0",
27
- "@ampless/admin": "^0.2.0-alpha.0",
28
- "@ampless/backend": "^0.2.0-alpha.0",
29
- "@ampless/runtime": "^0.2.0-alpha.0",
18
+ "@tiptap/extension-image": "^3.23.4",
19
+ "@tiptap/extension-link": "^3.23.4",
20
+ "@tiptap/pm": "^3.23.4",
21
+ "@tiptap/react": "^3.23.4",
22
+ "@tiptap/starter-kit": "^3.23.4",
23
+ "@ampless/plugin-og-image": "^0.2.0-alpha.1",
24
+ "@ampless/plugin-rss": "^0.2.0-alpha.1",
25
+ "@ampless/plugin-seo": "^0.2.0-alpha.1",
26
+ "@ampless/plugin-webhook": "^0.2.0-alpha.1",
27
+ "@ampless/admin": "^0.2.0-alpha.1",
28
+ "@ampless/backend": "^0.2.0-alpha.1",
29
+ "@ampless/runtime": "^0.2.0-alpha.1",
30
30
  "@digital-go-jp/tailwind-theme-plugin": "^0.3.4",
31
- "ampless": "^0.2.0-alpha.0",
31
+ "ampless": "^0.2.0-alpha.1",
32
32
  "aws-amplify": "^6.10.0",
33
33
  "class-variance-authority": "^0.7.1",
34
34
  "clsx": "^2.1.1",
35
- "lucide-react": "^0.469.0",
36
- "next": "^15.1.0",
35
+ "lucide-react": "^1.16.0",
36
+ "next": "^16.2.6",
37
37
  "react": "^19.0.0",
38
38
  "react-dom": "^19.0.0",
39
39
  "react-image-crop": "^11.0.7",
40
- "tailwind-merge": "^2.6.0"
40
+ "tailwind-merge": "^3.6.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@aws-amplify/backend": "^1.13.0",
@@ -45,7 +45,7 @@
45
45
  "@aws-sdk/client-appsync": "^3.717.0",
46
46
  "@aws-sdk/client-cognito-identity-provider": "^3.717.0",
47
47
  "@aws-sdk/client-dynamodb": "^3.717.0",
48
- "@aws-sdk/client-s3": "^3.717.0",
48
+ "@aws-sdk/client-s3": "^3.1048.0",
49
49
  "@aws-sdk/client-sqs": "^3.717.0",
50
50
  "@aws-sdk/lib-dynamodb": "^3.717.0",
51
51
  "@aws-sdk/util-dynamodb": "^3.717.0",
@@ -58,6 +58,6 @@
58
58
  "aws-cdk-lib": "^2.174.0",
59
59
  "postcss": "^8.4.0",
60
60
  "tailwindcss": "^4.0.0",
61
- "typescript": "^5.7.0"
61
+ "typescript": "^6.0.3"
62
62
  }
63
63
  }
@@ -0,0 +1,16 @@
1
+ // Public-site proxy (Next.js 16 rename of "middleware"). Implementation
2
+ // moved to `@ampless/runtime` (L1 extraction); this file wires the
3
+ // project's `cms.config` into the factory and re-exports the default
4
+ // matcher. The runtime export name is still `createAmplessMiddleware`
5
+ // for API stability; only the user-side file convention (proxy.ts +
6
+ // `export const proxy`) follows Next 16's rename.
7
+ //
8
+ // See `@ampless/runtime/middleware` for behaviour details: multi-site
9
+ // host rewrite, `<slug>.html` → raw route, `?previewTheme=` header
10
+ // forwarding, multi-site Cache-Control override.
11
+
12
+ import cmsConfig from './cms.config'
13
+ import { createAmplessMiddleware, defaultMatcherConfig } from '@ampless/runtime/middleware'
14
+
15
+ export const proxy = createAmplessMiddleware({ cmsConfig })
16
+ export const config = defaultMatcherConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ampless",
3
- "version": "0.2.0-alpha.0",
3
+ "version": "0.2.0-alpha.2",
4
4
  "description": "Create a new ampless project",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "homepage": "https://github.com/heavymoons/ampless#readme",
23
23
  "bugs": "https://github.com/heavymoons/ampless/issues",
24
24
  "dependencies": {
25
- "@clack/prompts": "^0.9.1",
25
+ "@clack/prompts": "^1.4.0",
26
26
  "picocolors": "^1.1.1"
27
27
  },
28
28
  "keywords": [
@@ -1,13 +0,0 @@
1
- // Public-site middleware. Implementation moved to `@ampless/runtime`
2
- // (L1 extraction); this file wires the project's `cms.config` into
3
- // the factory and re-exports the default matcher.
4
- //
5
- // See `@ampless/runtime/middleware` for behaviour details: multi-site
6
- // host rewrite, `<slug>.html` → raw route, `?previewTheme=` header
7
- // forwarding, multi-site Cache-Control override.
8
-
9
- import cmsConfig from './cms.config'
10
- import { createAmplessMiddleware, defaultMatcherConfig } from '@ampless/runtime/middleware'
11
-
12
- export const middleware = createAmplessMiddleware({ cmsConfig })
13
- export const config = defaultMatcherConfig