@saastemly/voidcommerce 0.9.0 → 0.10.0
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/cli.js +2 -2
- package/dist/generate/frontend.d.ts +1 -1
- package/dist/{index-0w66yc8y.js → index-mb1p1rh0.js} +31 -5
- package/dist/{index-wykd4zmk.js → index-vhsq8jpy.js} +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -2
- package/dist/{keys-68c6vmds.js → keys-2q3qzntw.js} +1 -1
- package/package.json +1 -1
- package/src/generate/env.ts +5 -2
- package/src/generate/frontend.ts +27 -1
- package/src/generate/index.ts +1 -1
- package/src/index.ts +1 -0
package/dist/cli.js
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
runVoid,
|
|
22
22
|
version,
|
|
23
23
|
voidAppsIn
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-mb1p1rh0.js";
|
|
25
25
|
import {
|
|
26
26
|
LOCAL_KEY_FILE,
|
|
27
27
|
PRIVATE_KEY_VAR,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
setVariable,
|
|
51
51
|
variableNames,
|
|
52
52
|
verifyCloudflareToken
|
|
53
|
-
} from "./index-
|
|
53
|
+
} from "./index-vhsq8jpy.js";
|
|
54
54
|
import {
|
|
55
55
|
LAYOUTS,
|
|
56
56
|
oneOrigin,
|
|
@@ -23,7 +23,7 @@ export declare const FRONTEND_BRANCH = "frontend-static";
|
|
|
23
23
|
export declare function renderFrontendApiTs(manifest: Manifest): string;
|
|
24
24
|
export declare function renderFrontendEnvProduction(manifest: Manifest): string;
|
|
25
25
|
/** The Vite config for a static Void site. Deliberately small: this is yours. */
|
|
26
|
-
export declare function renderFrontendViteConfig(): string;
|
|
26
|
+
export declare function renderFrontendViteConfig(manifest: Manifest): string;
|
|
27
27
|
/**
|
|
28
28
|
* `target: node` because Void 0.10.13's Cloudflare prerender calls miniflare
|
|
29
29
|
* with the single-worker shorthand that the miniflare its own dependencies
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
renderEnvLocal,
|
|
10
10
|
renderEnvProduction,
|
|
11
11
|
renderEnvTs
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-vhsq8jpy.js";
|
|
13
13
|
import {
|
|
14
14
|
MANIFEST_FILE,
|
|
15
15
|
has,
|
|
@@ -422,7 +422,33 @@ function renderFrontendEnvProduction(manifest) {
|
|
|
422
422
|
VITE_API_ORIGIN=https://api.${manifest.shop.domain}
|
|
423
423
|
`;
|
|
424
424
|
}
|
|
425
|
-
function renderFrontendViteConfig() {
|
|
425
|
+
function renderFrontendViteConfig(manifest) {
|
|
426
|
+
if (oneOrigin(manifest.layout)) {
|
|
427
|
+
return `import { defineConfig } from "vite";
|
|
428
|
+
import { voidPlugin } from "void";
|
|
429
|
+
import { voidReact } from "@void/react/plugin";
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* The storefront.
|
|
433
|
+
*
|
|
434
|
+
* In production one worker serves this page and the API it calls, so the
|
|
435
|
+
* client uses relative URLs and there is nothing to configure. In DEV they
|
|
436
|
+
* are two processes on two ports, and a relative /api call would hit this
|
|
437
|
+
* dev server instead of the worker — so it is proxied. Without this, local
|
|
438
|
+
* development is the only place the shop is broken.
|
|
439
|
+
*
|
|
440
|
+
* Start the worker first: it takes 5173, and this lands on the next port.
|
|
441
|
+
*/
|
|
442
|
+
export default defineConfig({
|
|
443
|
+
plugins: [voidPlugin(), voidReact()],
|
|
444
|
+
server: {
|
|
445
|
+
proxy: {
|
|
446
|
+
"/api": { target: "http://127.0.0.1:5173", changeOrigin: false },
|
|
447
|
+
},
|
|
448
|
+
},
|
|
449
|
+
});
|
|
450
|
+
`;
|
|
451
|
+
}
|
|
426
452
|
return `import { defineConfig } from "vite";
|
|
427
453
|
import { voidPlugin } from "void";
|
|
428
454
|
import { voidReact } from "@void/react/plugin";
|
|
@@ -1344,7 +1370,7 @@ import color from "picocolors";
|
|
|
1344
1370
|
// package.json
|
|
1345
1371
|
var package_default = {
|
|
1346
1372
|
name: "@saastemly/voidcommerce",
|
|
1347
|
-
version: "0.
|
|
1373
|
+
version: "0.10.0",
|
|
1348
1374
|
description: "Void, with a shop in it. `vc init` walks you through Better Auth, betterCommerce and every plugin; everything else passes through to `void`.",
|
|
1349
1375
|
type: "module",
|
|
1350
1376
|
license: "MIT",
|
|
@@ -2457,7 +2483,7 @@ async function generateFrontend(root, dir, manifest, result) {
|
|
|
2457
2483
|
const at = (file) => join4(dir, file);
|
|
2458
2484
|
await put(root, at("lib/api.ts"), renderFrontendApiTs(manifest), result, "own");
|
|
2459
2485
|
await put(root, at(".env.production"), renderFrontendEnvProduction(manifest), result, "regenerate");
|
|
2460
|
-
await put(root, at("vite.config.ts"), renderFrontendViteConfig(), result, "own");
|
|
2486
|
+
await put(root, at("vite.config.ts"), renderFrontendViteConfig(manifest), result, "own");
|
|
2461
2487
|
await put(root, at("void.json"), renderFrontendVoidJson(), result, "own");
|
|
2462
2488
|
await put(root, at("tsconfig.json"), renderFrontendTsconfig(), result, "own");
|
|
2463
2489
|
await put(root, at("pages/index.tsx"), renderStorefrontPage(manifest), result, "own");
|
|
@@ -3405,4 +3431,4 @@ async function importHelp() {
|
|
|
3405
3431
|
return 0;
|
|
3406
3432
|
}
|
|
3407
3433
|
|
|
3408
|
-
export { renderAuthTs, FRONTEND_BRANCH, renderFrontendApiTs, renderFrontendEnvProduction, renderStorefrontPage, renderFrontendWorkflow, runVoid, runInherit, captureVoid, isVoidApp, voidAppsIn, STRICT_APP, VOID_VERSION, strictDependencies, renderVoidPatch, renderViteConfig, renderStrictTsconfig, renderVoidJson, renderDbSchema, renderDbSeed, renderLayoutTsx, renderAppCss, renderIndexServer, INDEX_PAGE, renderDashboardPage, CLIENT_ONLY, renderSignInPage, renderAuthClient, renderContentTs, renderCron, renderQueue, renderLiveStream, renderLiveRoute, renderStrictAppPackageJson, DATA_README, BRANDING_README, MIGRATIONS_README, finishStrict, line, row, box, fullHelp, initHelp, version, findProject, ensureGenerated, DIST_DIR, DIST_BRANCH, distCommand, distHelp, renderDistWorkflow, renderDeployReadme, renderRequirementsTs, renderDomainTs, generate, parseJsonc, upsertJsonc, findWrangler, parseWhoAmI, productionEnv, routeProblem, preflight, printPreflight, deployCloudflare, importCommand, importHelp };
|
|
3434
|
+
export { renderAuthTs, FRONTEND_BRANCH, renderFrontendApiTs, renderFrontendEnvProduction, renderFrontendViteConfig, renderStorefrontPage, renderFrontendWorkflow, runVoid, runInherit, captureVoid, isVoidApp, voidAppsIn, STRICT_APP, VOID_VERSION, strictDependencies, renderVoidPatch, renderViteConfig, renderStrictTsconfig, renderVoidJson, renderDbSchema, renderDbSeed, renderLayoutTsx, renderAppCss, renderIndexServer, INDEX_PAGE, renderDashboardPage, CLIENT_ONLY, renderSignInPage, renderAuthClient, renderContentTs, renderCron, renderQueue, renderLiveStream, renderLiveRoute, renderStrictAppPackageJson, DATA_README, BRANDING_README, MIGRATIONS_README, finishStrict, line, row, box, fullHelp, initHelp, version, findProject, ensureGenerated, DIST_DIR, DIST_BRANCH, distCommand, distHelp, renderDistWorkflow, renderDeployReadme, renderRequirementsTs, renderDomainTs, generate, parseJsonc, upsertJsonc, findWrangler, parseWhoAmI, productionEnv, routeProblem, preflight, printPreflight, deployCloudflare, importCommand, importHelp };
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
envKeysOf,
|
|
3
3
|
hasFrontend,
|
|
4
4
|
isApex,
|
|
5
|
+
oneOrigin,
|
|
5
6
|
zone
|
|
6
7
|
} from "./index-tjy6yygc.js";
|
|
7
8
|
import {
|
|
@@ -247,7 +248,7 @@ function renderEnvLocal(manifest) {
|
|
|
247
248
|
"# Local development. Gitignored; .env.example documents every key.",
|
|
248
249
|
"",
|
|
249
250
|
...keys.map((key) => `${key.key}=${local[key.key] ?? key.dev ?? "unset"}`),
|
|
250
|
-
...hasFrontend(manifest.layout) ? ["", "# The storefront, reaching the worker. Start the worker first.", "VITE_API_ORIGIN=http://localhost:5173"] : [],
|
|
251
|
+
...hasFrontend(manifest.layout) && !oneOrigin(manifest.layout) ? ["", "# The storefront, reaching the worker. Start the worker first.", "VITE_API_ORIGIN=http://localhost:5173"] : [],
|
|
251
252
|
""
|
|
252
253
|
].join(`
|
|
253
254
|
`);
|
|
@@ -384,7 +385,7 @@ async function decryptSecrets(project) {
|
|
|
384
385
|
}
|
|
385
386
|
const expected = committedPublicKey(root);
|
|
386
387
|
if (expected) {
|
|
387
|
-
const { publicKeyFor } = await import("./keys-
|
|
388
|
+
const { publicKeyFor } = await import("./keys-2q3qzntw.js");
|
|
388
389
|
const derived = await publicKeyFor(privateKey);
|
|
389
390
|
if (derived && derived.toLowerCase() !== expected.toLowerCase()) {
|
|
390
391
|
return {
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { parseJsonc, upsertJsonc } from "./deploy/jsonc";
|
|
|
18
18
|
export { parseWhoAmI, findWrangler } from "./deploy/wrangler";
|
|
19
19
|
export { preflight, printPreflight, productionEnv, routeProblem } from "./deploy/preflight";
|
|
20
20
|
export { deployCloudflare } from "./deploy/cloudflare";
|
|
21
|
-
export { FRONTEND_BRANCH, renderFrontendApiTs, renderFrontendEnvProduction, renderFrontendWorkflow, renderStorefrontPage, } from "./generate/frontend";
|
|
21
|
+
export { FRONTEND_BRANCH, renderFrontendViteConfig, renderFrontendApiTs, renderFrontendEnvProduction, renderFrontendWorkflow, renderStorefrontPage, } from "./generate/frontend";
|
|
22
22
|
export { distCommand, DIST_BRANCH, DIST_DIR } from "./dist";
|
|
23
23
|
export { renderDistWorkflow, renderDeployReadme } from "./generate/ci";
|
|
24
24
|
export { importCommand } from "./import";
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
renderDomainTs,
|
|
35
35
|
renderFrontendApiTs,
|
|
36
36
|
renderFrontendEnvProduction,
|
|
37
|
+
renderFrontendViteConfig,
|
|
37
38
|
renderFrontendWorkflow,
|
|
38
39
|
renderIndexServer,
|
|
39
40
|
renderLayoutTsx,
|
|
@@ -51,7 +52,7 @@ import {
|
|
|
51
52
|
routeProblem,
|
|
52
53
|
strictDependencies,
|
|
53
54
|
upsertJsonc
|
|
54
|
-
} from "./index-
|
|
55
|
+
} from "./index-mb1p1rh0.js";
|
|
55
56
|
import {
|
|
56
57
|
allEnvKeys,
|
|
57
58
|
envSummary,
|
|
@@ -59,7 +60,7 @@ import {
|
|
|
59
60
|
renderEnvLocal,
|
|
60
61
|
renderEnvProduction,
|
|
61
62
|
renderEnvTs
|
|
62
|
-
} from "./index-
|
|
63
|
+
} from "./index-vhsq8jpy.js";
|
|
63
64
|
import {
|
|
64
65
|
LAYOUTS,
|
|
65
66
|
MANIFEST_FILE,
|
|
@@ -124,6 +125,7 @@ export {
|
|
|
124
125
|
renderLayoutTsx,
|
|
125
126
|
renderIndexServer,
|
|
126
127
|
renderFrontendWorkflow,
|
|
128
|
+
renderFrontendViteConfig,
|
|
127
129
|
renderFrontendEnvProduction,
|
|
128
130
|
renderFrontendApiTs,
|
|
129
131
|
renderEnvTs,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saastemly/voidcommerce",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Void, with a shop in it. `vc init` walks you through Better Auth, betterCommerce and every plugin; everything else passes through to `void`.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/generate/env.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type EnvKey } from "../catalog";
|
|
2
|
-
import { type Manifest, envKeysOf, has, hasFrontend, isApex, zone } from "../manifest";
|
|
2
|
+
import { type Manifest, envKeysOf, has, hasFrontend, isApex, zone , oneOrigin} from "../manifest";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `env.ts`, `.env.example` and `.env.production` — from the manifest.
|
|
@@ -123,7 +123,10 @@ export function renderEnvLocal(manifest: Manifest): string {
|
|
|
123
123
|
// One file for both halves in a strict repo, where the storefront and
|
|
124
124
|
// the worker share a root. The worker takes 5173 because it is started
|
|
125
125
|
// first; the storefront lands on the next free port and calls back here.
|
|
126
|
-
|
|
126
|
+
// Only a monorepo bakes the API's address in. Where one worker serves
|
|
127
|
+
// both, the client uses relative URLs and dev proxies /api instead —
|
|
128
|
+
// so a VITE_API_ORIGIN here would be read by nothing.
|
|
129
|
+
...(hasFrontend(manifest.layout) && !oneOrigin(manifest.layout)
|
|
127
130
|
? ["", "# The storefront, reaching the worker. Start the worker first.", "VITE_API_ORIGIN=http://localhost:5173"]
|
|
128
131
|
: []),
|
|
129
132
|
"",
|
package/src/generate/frontend.ts
CHANGED
|
@@ -74,7 +74,33 @@ VITE_API_ORIGIN=https://api.${manifest.shop.domain}
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/** The Vite config for a static Void site. Deliberately small: this is yours. */
|
|
77
|
-
export function renderFrontendViteConfig(): string {
|
|
77
|
+
export function renderFrontendViteConfig(manifest: Manifest): string {
|
|
78
|
+
if (oneOrigin(manifest.layout)) {
|
|
79
|
+
return `import { defineConfig } from "vite";
|
|
80
|
+
import { voidPlugin } from "void";
|
|
81
|
+
import { voidReact } from "@void/react/plugin";
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The storefront.
|
|
85
|
+
*
|
|
86
|
+
* In production one worker serves this page and the API it calls, so the
|
|
87
|
+
* client uses relative URLs and there is nothing to configure. In DEV they
|
|
88
|
+
* are two processes on two ports, and a relative /api call would hit this
|
|
89
|
+
* dev server instead of the worker — so it is proxied. Without this, local
|
|
90
|
+
* development is the only place the shop is broken.
|
|
91
|
+
*
|
|
92
|
+
* Start the worker first: it takes 5173, and this lands on the next port.
|
|
93
|
+
*/
|
|
94
|
+
export default defineConfig({
|
|
95
|
+
plugins: [voidPlugin(), voidReact()],
|
|
96
|
+
server: {
|
|
97
|
+
proxy: {
|
|
98
|
+
"/api": { target: "http://127.0.0.1:5173", changeOrigin: false },
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
78
104
|
return `import { defineConfig } from "vite";
|
|
79
105
|
import { voidPlugin } from "void";
|
|
80
106
|
import { voidReact } from "@void/react/plugin";
|
package/src/generate/index.ts
CHANGED
|
@@ -314,7 +314,7 @@ async function generateFrontend(root: string, dir: string, manifest: Manifest, r
|
|
|
314
314
|
|
|
315
315
|
await put(root, at("lib/api.ts"), renderFrontendApiTs(manifest), result, "own");
|
|
316
316
|
await put(root, at(".env.production"), renderFrontendEnvProduction(manifest), result, "regenerate");
|
|
317
|
-
await put(root, at("vite.config.ts"), renderFrontendViteConfig(), result, "own");
|
|
317
|
+
await put(root, at("vite.config.ts"), renderFrontendViteConfig(manifest), result, "own");
|
|
318
318
|
await put(root, at("void.json"), renderFrontendVoidJson(), result, "own");
|
|
319
319
|
await put(root, at("tsconfig.json"), renderFrontendTsconfig(), result, "own");
|
|
320
320
|
await put(root, at("pages/index.tsx"), renderStorefrontPage(manifest), result, "own");
|
package/src/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ export { preflight, printPreflight, productionEnv, routeProblem } from "./deploy
|
|
|
27
27
|
export { deployCloudflare } from "./deploy/cloudflare";
|
|
28
28
|
export {
|
|
29
29
|
FRONTEND_BRANCH,
|
|
30
|
+
renderFrontendViteConfig,
|
|
30
31
|
renderFrontendApiTs,
|
|
31
32
|
renderFrontendEnvProduction,
|
|
32
33
|
renderFrontendWorkflow,
|