@pradip1995/create-storefront-app 0.4.0 → 0.4.1
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/bin/create-storefront-app.js +1 -0
- package/lib/docker-template-vars.js +1 -1
- package/lib/medusa-plugin-versions.json +2 -1
- package/lib/scaffold-backend.js +3 -1
- package/lib/versions.js +1 -1
- package/package.json +1 -1
- package/templates/backend/README.md +5 -4
- package/templates/backend/env.template +2 -2
- package/templates/docker/docker-compose.infra.yml +1 -1
- package/templates/docker/docker-compose.yml +1 -1
- package/templates/root/.cursor/rules/monorepo-layout.mdc +4 -3
- package/templates/shared/.cursor/rules/customize-sections.mdc +1 -1
- package/templates/shared/.cursor/rules/customize-theme.mdc +1 -1
- package/templates/shared/README.md +5 -4
|
@@ -195,6 +195,7 @@ function scaffoldProject(args) {
|
|
|
195
195
|
"storefront:build": "npm run storefront:build --prefix storefront",
|
|
196
196
|
"dev:backend": "npm run dev --prefix backend",
|
|
197
197
|
"build:backend": "npm run build --prefix backend",
|
|
198
|
+
"migrate:backend": "npm run db:migrate --prefix backend",
|
|
198
199
|
seed: "npm run seed --prefix backend && node scripts/sync-publishable-key.mjs --from-db",
|
|
199
200
|
},
|
|
200
201
|
}
|
|
@@ -23,7 +23,7 @@ export function buildDockerTemplateVars(args) {
|
|
|
23
23
|
BACKEND_URL: args.backendUrl,
|
|
24
24
|
BASE_URL: args.baseUrl,
|
|
25
25
|
DEFAULT_REGION: args.defaultRegion,
|
|
26
|
-
DATABASE_URL: `postgres://${postgresUser}:${postgresPassword}@localhost:
|
|
26
|
+
DATABASE_URL: `postgres://${postgresUser}:${postgresPassword}@localhost:5433/${postgresDb}?sslmode=disable`,
|
|
27
27
|
DATABASE_URL_DOCKER: `postgres://${postgresUser}:${postgresPassword}@postgres:5432/${postgresDb}?sslmode=disable`,
|
|
28
28
|
PUBLISHABLE_KEY: args.publishableKey || "pk_test",
|
|
29
29
|
ADMIN_EMAIL: `admin@${slug}.local`,
|
package/lib/scaffold-backend.js
CHANGED
|
@@ -88,7 +88,7 @@ export function scaffoldBackend(backendRoot, args) {
|
|
|
88
88
|
join(backendRoot, ".env.example"),
|
|
89
89
|
applyTemplate(readFileSync(envTemplate, "utf8"), {
|
|
90
90
|
...templateVars,
|
|
91
|
-
DATABASE_URL: "postgres://user:pass@localhost:
|
|
91
|
+
DATABASE_URL: "postgres://user:pass@localhost:5433/medusa",
|
|
92
92
|
})
|
|
93
93
|
)
|
|
94
94
|
|
|
@@ -102,6 +102,8 @@ export function scaffoldBackend(backendRoot, args) {
|
|
|
102
102
|
private: true,
|
|
103
103
|
scripts: {
|
|
104
104
|
"backend:build": "backend-build",
|
|
105
|
+
"db:migrate":
|
|
106
|
+
"npm run backend:build && cd .generated-backend && npm install && npx medusa db:migrate",
|
|
105
107
|
dev: "npm run backend:build && cd .generated-backend && npm install && npm run dev",
|
|
106
108
|
build:
|
|
107
109
|
"npm run backend:build && cd .generated-backend && npm install && npm run build",
|
package/lib/versions.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Published package semver ranges — bump when releasing framework/components. */
|
|
2
2
|
export const COMMERCE_CORE_VERSION = "^4.0.2"
|
|
3
3
|
export const FRAMEWORK_VERSION = "^0.2.1"
|
|
4
|
-
export const FRAMEWORK_COMPILER_VERSION = "^0.3.
|
|
4
|
+
export const FRAMEWORK_COMPILER_VERSION = "^0.3.1"
|
|
5
5
|
export const COMPONENTS_VERSION = ">=0.2.0 <0.4.0"
|
|
6
6
|
|
|
7
7
|
export const FRAMEWORK_PACKAGES = [
|
package/package.json
CHANGED
|
@@ -13,10 +13,11 @@ Medusa source is **generated** into `.generated-backend/` — same pattern as `s
|
|
|
13
13
|
## Commands
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npm run dev
|
|
17
|
-
npm run
|
|
18
|
-
npm run
|
|
19
|
-
npm run
|
|
16
|
+
npm run dev # backend-build → medusa develop
|
|
17
|
+
npm run db:migrate # first time (run twice on fresh DB if needed)
|
|
18
|
+
npm run build # backend-build → medusa build
|
|
19
|
+
npm run seed # seed demo data
|
|
20
|
+
npm run backend:build # regenerate .generated-backend/ only
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
**Do not edit** `.generated-backend/` — changes are overwritten on the next build.
|
|
@@ -19,8 +19,8 @@ GOOGLE_CLIENT_ID=
|
|
|
19
19
|
GOOGLE_CLIENT_SECRET=
|
|
20
20
|
GOOGLE_CALLBACK_URL={{BASE_URL}}/auth/customer/google/callback
|
|
21
21
|
|
|
22
|
-
# Email (optional —
|
|
23
|
-
SMTP_HOST=
|
|
22
|
+
# Email (optional — use Mailpit with make up-infra: SMTP_HOST=localhost SMTP_PORT=1025 SMTP_SECURE=false)
|
|
23
|
+
SMTP_HOST=
|
|
24
24
|
SMTP_PORT=465
|
|
25
25
|
SMTP_SECURE=true
|
|
26
26
|
SMTP_USER=
|
|
@@ -32,9 +32,10 @@ See `Makefile` and command `docker-dev`.
|
|
|
32
32
|
|
|
33
33
|
## First-time backend
|
|
34
34
|
|
|
35
|
-
1. Set `DATABASE_URL` in `backend/.env`
|
|
36
|
-
2. `npm run
|
|
37
|
-
3. `npm run
|
|
35
|
+
1. Set `DATABASE_URL` in `backend/.env` (port **5433** when using `make up-infra`)
|
|
36
|
+
2. `npm run migrate:backend` (may need two runs on fresh DB)
|
|
37
|
+
3. `npm run dev:backend` (generates backend + migrations on start)
|
|
38
|
+
4. `npm run seed` (region, API key, sample product)
|
|
38
39
|
4. Run `npm run seed` from project root (syncs publishable key to `storefront/.env.local` via Postgres)
|
|
39
40
|
|
|
40
41
|
## Build
|
|
@@ -26,7 +26,7 @@ Each entry in `segments` renders top-to-bottom:
|
|
|
26
26
|
npm run storefront:build
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
This regenerates the Next.js app **and** syncs `backend/config/homepage-config.json` (Admin fields for your active segments). Restart the backend after schema changes.
|
|
29
|
+
This regenerates the Next.js app **and** syncs `backend/.generated-backend/config/homepage-config.json` (Admin fields for your active segments). Restart the backend after schema changes.
|
|
30
30
|
|
|
31
31
|
**Remove** — delete the line and remove the package from `package.json` if unused elsewhere.
|
|
32
32
|
|
|
@@ -54,4 +54,4 @@ NEXT_PUBLIC_HOME_PAGE_DESCRIPTION=Subtext
|
|
|
54
54
|
|
|
55
55
|
## Medusa admin content
|
|
56
56
|
|
|
57
|
-
Hero banners, promo text, testimonials, features → Medusa **dynamic-config** (`homepage-config`).
|
|
57
|
+
Hero banners, promo text, testimonials, features → Medusa **dynamic-config** (`homepage-config`). Schema syncs to `backend/.generated-backend/config/` on `storefront:build`; storefront loads values from `GET /store/dynamic-config`.
|
|
@@ -37,13 +37,14 @@ Default admin: `make admin-create` (see `Makefile` for `ADMIN_EMAIL` / `ADMIN_PA
|
|
|
37
37
|
## Option B — Docker infra + local Node dev
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
make up-infra # postgres, redis, mailpit
|
|
41
|
-
npm run
|
|
42
|
-
npm run
|
|
40
|
+
make up-infra # postgres (host :5433), redis, mailpit
|
|
41
|
+
npm run migrate:backend # first time — run twice if needed on fresh DB
|
|
42
|
+
npm run dev:backend # terminal 1
|
|
43
|
+
npm run seed # from project root
|
|
43
44
|
npm run dev:storefront # terminal 2
|
|
44
45
|
```
|
|
45
46
|
|
|
46
|
-
`backend/.env` `DATABASE_URL`
|
|
47
|
+
`backend/.env` `DATABASE_URL` uses port **5433** (Docker maps `5433→5432` to avoid conflict with a local Postgres on 5432).
|
|
47
48
|
|
|
48
49
|
For OTP/email in local backend with infra Docker, set `SMTP_HOST=localhost` and `SMTP_PORT=1025` (Mailpit exposes SMTP when using `docker-compose.infra.yml`).
|
|
49
50
|
|