@vendure/create 3.7.3-master-202608260231 → 3.7.3-master-202608270343

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/assets/.env.hbs CHANGED
@@ -3,6 +3,10 @@ VENDURE_SERVER_PORT={{ port }}
3
3
  COOKIE_SECRET={{ cookieSecret }}
4
4
  SUPERADMIN_USERNAME={{{ escapeSingle superadminIdentifier }}}
5
5
  SUPERADMIN_PASSWORD={{{ escapeSingle superadminPassword }}}
6
+ # Comma-separated list of browser origins allowed to make credentialed API requests,
7
+ # e.g. https://example.com,https://admin.example.com
8
+ # Only used when APP_ENV is not "dev". Leave empty in local development.
9
+ CORS_ORIGINS=
6
10
  {{#if requiresConnection}}
7
11
  DB_HOST={{ dbHost }}
8
12
  DB_PORT={{ dbPort }}
@@ -11,6 +11,7 @@ declare global {
11
11
  COOKIE_SECRET: string;
12
12
  SUPERADMIN_USERNAME: string;
13
13
  SUPERADMIN_PASSWORD: string;
14
+ CORS_ORIGINS?: string;
14
15
  {{#if requiresConnection}}
15
16
  DB_HOST: string;
16
17
  DB_PORT: number;
package/assets/readme.hbs CHANGED
@@ -35,6 +35,16 @@ will compile the TypeScript sources and build the Dashboard into the `/dist` dir
35
35
  For production, there are many possibilities which depend on your operational requirements as well as your production
36
36
  hosting environment.
37
37
 
38
+ ### CORS origins
39
+
40
+ Set the `CORS_ORIGINS` environment variable to a comma-separated list of the origins your browsers call
41
+ the API from, for example `https://example.com,https://admin.example.com`. If you leave it empty, the
42
+ server sends no `Access-Control-Allow-Origin` header and a separately hosted storefront or dashboard
43
+ gets a CORS error on every request. The dashboard served by the `DashboardPlugin` runs on the same
44
+ origin as the API, so it is not affected.
45
+
46
+ In development (`APP_ENV=dev`) any origin is allowed, so you do not need to set this locally.
47
+
38
48
  ### Running directly
39
49
 
40
50
  You can run the built files directly with the `start` script:
@@ -23,6 +23,15 @@ export const config: VendureConfig = {
23
23
  adminApiPath: 'admin-api',
24
24
  shopApiPath: 'shop-api',
25
25
  trustProxy: IS_DEV ? false : 1,
26
+ // Which browser origins may make credentialed requests to the Shop and Admin APIs.
27
+ // In dev any origin is reflected, so a storefront on any port works. In production set
28
+ // CORS_ORIGINS to a comma-separated list of the origins you serve, for example
29
+ // "https://example.com,https://admin.example.com". An unset value blocks all
30
+ // cross-origin browser requests, which is the safe default.
31
+ cors: {
32
+ origin: IS_DEV ? true : (process.env.CORS_ORIGINS?.split(',').map(o => o.trim()).filter(Boolean) ?? []),
33
+ credentials: true,
34
+ },
26
35
  // The following options are useful in development mode,
27
36
  // but are best turned off for production for security
28
37
  // reasons.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendure/create",
3
- "version": "3.7.3-master-202608260231",
3
+ "version": "3.7.3-master-202608270343",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "bin": {
6
6
  "create": "./index.js"
@@ -32,7 +32,7 @@
32
32
  "@types/fs-extra": "^11.0.4",
33
33
  "@types/handlebars": "^4.1.0",
34
34
  "@types/semver": "^7.5.8",
35
- "@vendure/core": "^3.7.3-master-202608260231",
35
+ "@vendure/core": "^3.7.3-master-202608270343",
36
36
  "rimraf": "^5.0.5",
37
37
  "ts-node": "^10.9.2",
38
38
  "typescript": "5.8.2",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@clack/prompts": "^0.11.0",
43
- "@vendure/common": "^3.7.3-master-202608260231",
43
+ "@vendure/common": "^3.7.3-master-202608270343",
44
44
  "commander": "^14.0.1",
45
45
  "cross-spawn": "^7.0.6",
46
46
  "fs-extra": "^11.2.0",