@saastemly/voidcommerce 0.1.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/README.md +271 -0
- package/bin/vc +2 -0
- package/dist/catalog.d.ts +69 -0
- package/dist/catalog.js +34 -0
- package/dist/cli.d.ts +24 -0
- package/dist/cli.js +544 -0
- package/dist/deploy/cloudflare.d.ts +25 -0
- package/dist/deploy/index.d.ts +16 -0
- package/dist/deploy/jsonc.d.ts +8 -0
- package/dist/deploy/preflight.d.ts +29 -0
- package/dist/deploy/wrangler.d.ts +37 -0
- package/dist/dist.d.ts +22 -0
- package/dist/generate/auth.d.ts +2 -0
- package/dist/generate/ci.d.ts +24 -0
- package/dist/generate/env.d.ts +13 -0
- package/dist/generate/frontend.d.ts +47 -0
- package/dist/generate/index.d.ts +28 -0
- package/dist/generate/requirements.d.ts +13 -0
- package/dist/generate/strict.d.ts +72 -0
- package/dist/generate/support.d.ts +23 -0
- package/dist/help.d.ts +31 -0
- package/dist/import.d.ts +2 -0
- package/dist/index-s7sq41qs.js +590 -0
- package/dist/index-ssv3a6wc.js +172 -0
- package/dist/index-wzy1xtr1.js +3155 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +190 -0
- package/dist/init.d.ts +1 -0
- package/dist/manifest.d.ts +131 -0
- package/dist/manifest.js +41 -0
- package/dist/project.d.ts +20 -0
- package/dist/regenerate.d.ts +9 -0
- package/dist/scripts.d.ts +12 -0
- package/dist/void.d.ts +30 -0
- package/dist/wizard.d.ts +7 -0
- package/package.json +50 -0
- package/src/catalog.ts +673 -0
- package/src/cli.ts +78 -0
- package/src/deploy/cloudflare.ts +166 -0
- package/src/deploy/index.ts +101 -0
- package/src/deploy/jsonc.ts +148 -0
- package/src/deploy/preflight.ts +137 -0
- package/src/deploy/wrangler.ts +111 -0
- package/src/dist.ts +157 -0
- package/src/generate/auth.ts +386 -0
- package/src/generate/ci.ts +208 -0
- package/src/generate/env.ts +164 -0
- package/src/generate/frontend.ts +275 -0
- package/src/generate/index.ts +390 -0
- package/src/generate/requirements.ts +48 -0
- package/src/generate/strict.ts +692 -0
- package/src/generate/support.ts +252 -0
- package/src/help.ts +172 -0
- package/src/import.ts +237 -0
- package/src/index.ts +37 -0
- package/src/init.ts +187 -0
- package/src/manifest.ts +303 -0
- package/src/project.ts +63 -0
- package/src/regenerate.ts +51 -0
- package/src/scripts.ts +53 -0
- package/src/void.ts +115 -0
- package/src/wizard.ts +234 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Manifest } from "../manifest";
|
|
2
|
+
/**
|
|
3
|
+
* The workflow that turns a push into a deploy.
|
|
4
|
+
*
|
|
5
|
+
* ── Why a branch and not a build ─────────────────────────────────────────
|
|
6
|
+
*
|
|
7
|
+
* Cloudflare's Workers Builds watches a repository and builds what it finds.
|
|
8
|
+
* A strict repository has no app in it — `.vc/app` is generated and
|
|
9
|
+
* gitignored — and Cloudflare documents nothing about a build command that
|
|
10
|
+
* writes the source it then builds. The install step's ordering against a
|
|
11
|
+
* generated `package.json` is undocumented, which is not a thing to guess at
|
|
12
|
+
* in the path that puts a shop on the internet.
|
|
13
|
+
*
|
|
14
|
+
* So the generator runs in GitHub Actions, where it is ordinary, and pushes
|
|
15
|
+
* the result to its own branch. `main` stays the manifest and the data;
|
|
16
|
+
* `void-dist` is a plain Void app with a committed `package.json`, lockfile
|
|
17
|
+
* and `wrangler.jsonc` that anything can build from a cold checkout.
|
|
18
|
+
* Cloudflare is pointed at that branch and needs to know nothing about
|
|
19
|
+
* voidcommerce — which also means the deploy path is one a person can run by
|
|
20
|
+
* hand when CI is not the answer.
|
|
21
|
+
*/
|
|
22
|
+
export declare function renderDistWorkflow(manifest: Manifest): string;
|
|
23
|
+
/** What a person still has to do once, and why each thing cannot be done for them. */
|
|
24
|
+
export declare function renderDeployReadme(manifest: Manifest, zone: string, hosts: string[]): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type EnvKey } from "../catalog";
|
|
2
|
+
import { type Manifest, has } from "../manifest";
|
|
3
|
+
export declare function allEnvKeys(manifest: Manifest): EnvKey[];
|
|
4
|
+
export declare function renderEnvTs(manifest: Manifest): string;
|
|
5
|
+
export declare function renderEnvExample(manifest: Manifest): string;
|
|
6
|
+
export declare function renderEnvLocal(manifest: Manifest): string;
|
|
7
|
+
export declare function renderEnvProduction(manifest: Manifest): string;
|
|
8
|
+
/** So the generator can say what it decided. */
|
|
9
|
+
export declare function envSummary(manifest: Manifest): {
|
|
10
|
+
secrets: string[];
|
|
11
|
+
plaintext: string[];
|
|
12
|
+
};
|
|
13
|
+
export { has };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Manifest } from "../manifest";
|
|
2
|
+
/**
|
|
3
|
+
* The storefront: a static Void site that talks to the worker over HTTP.
|
|
4
|
+
*
|
|
5
|
+
* Two layouts have one, and the only difference is where it sits.
|
|
6
|
+
*
|
|
7
|
+
* monorepo `frontend/`, its own workspace beside `api/`
|
|
8
|
+
* strict the REPOSITORY ROOT, sharing the one package.json
|
|
9
|
+
*
|
|
10
|
+
* Strict's placement is the interesting one. What a person edits in a strict
|
|
11
|
+
* repository is the storefront, so the storefront is what the repository
|
|
12
|
+
* looks like: its Vite config, its pages, its package.json. The backend is
|
|
13
|
+
* generated underneath it at `.vc/app` and is nobody's to edit. So the repo
|
|
14
|
+
* is, in technicality, a frontend app that builds a backend app — and in
|
|
15
|
+
* practice a monorepo without the ceremony of being one.
|
|
16
|
+
*
|
|
17
|
+
* Void prerenders it (`output: "static"`), and a workflow publishes the built
|
|
18
|
+
* tree to a branch that GitHub Pages — or Cloudflare Pages — serves as-is.
|
|
19
|
+
*/
|
|
20
|
+
/** Where the frontend's build output lands, relative to its own directory. */
|
|
21
|
+
export declare const FRONTEND_OUT = "dist/client";
|
|
22
|
+
export declare const FRONTEND_BRANCH = "frontend-static";
|
|
23
|
+
export declare function renderFrontendApiTs(manifest: Manifest): string;
|
|
24
|
+
export declare function renderFrontendEnvProduction(manifest: Manifest): string;
|
|
25
|
+
/** The Vite config for a static Void site. Deliberately small: this is yours. */
|
|
26
|
+
export declare function renderFrontendViteConfig(): string;
|
|
27
|
+
/**
|
|
28
|
+
* `target: node` because Void 0.10.13's Cloudflare prerender calls miniflare
|
|
29
|
+
* with the single-worker shorthand that the miniflare its own dependencies
|
|
30
|
+
* pin rejects. The node target prerenders directly, and needs
|
|
31
|
+
* `@hono/node-server`. It also disables Cloudflare bindings, which a static
|
|
32
|
+
* export could not use anyway.
|
|
33
|
+
*/
|
|
34
|
+
export declare function renderFrontendVoidJson(): string;
|
|
35
|
+
export declare function renderFrontendTsconfig(): string;
|
|
36
|
+
/** A storefront that actually shows the catalogue, so the first build proves the wiring. */
|
|
37
|
+
export declare function renderStorefrontPage(manifest: Manifest): string;
|
|
38
|
+
/**
|
|
39
|
+
* Publishes the storefront to a branch on every push.
|
|
40
|
+
*
|
|
41
|
+
* The branch holds build output only, so it is force-pushed as a single
|
|
42
|
+
* orphan commit rather than accumulating history. GitHub Pages serves it from
|
|
43
|
+
* `/`, and the CNAME file in it sets the domain — so a green run is a live
|
|
44
|
+
* deploy with no Pages environment to configure. Cloudflare Pages can be
|
|
45
|
+
* pointed at the same branch instead.
|
|
46
|
+
*/
|
|
47
|
+
export declare function renderFrontendWorkflow(manifest: Manifest, dir: string): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Manifest } from "../manifest";
|
|
2
|
+
import { envSummary } from "./env";
|
|
3
|
+
/**
|
|
4
|
+
* Turn a manifest into files.
|
|
5
|
+
*
|
|
6
|
+
* Two kinds of file, and the difference matters:
|
|
7
|
+
*
|
|
8
|
+
* REGENERATED — `auth.ts`, `env.ts`, `.env.example`, `.env.production`,
|
|
9
|
+
* `lib/deploy/requirements.ts`, the Pages workflow. Derived entirely from
|
|
10
|
+
* the manifest; edit the manifest, not the file.
|
|
11
|
+
*
|
|
12
|
+
* OWNED — `lib/domain.ts`, `lib/payment.ts`, `lib/notifications.ts`,
|
|
13
|
+
* `lib/erp.ts`, `.env`, the frontend's `lib/api.ts`. Written once if
|
|
14
|
+
* absent, then yours. They are what a shop edits when it grows past the
|
|
15
|
+
* wizard, and overwriting them would destroy that work.
|
|
16
|
+
*
|
|
17
|
+
* Where the files go follows the layout: one app writes at the root; a
|
|
18
|
+
* monorepo writes api/ and frontend/ and a root that holds both; strict
|
|
19
|
+
* writes the whole app under .vc/app, where NOTHING is owned — the point of
|
|
20
|
+
* strict is that the manifest is the only source.
|
|
21
|
+
*/
|
|
22
|
+
export interface GenerateResult {
|
|
23
|
+
written: string[];
|
|
24
|
+
kept: string[];
|
|
25
|
+
packages: string[];
|
|
26
|
+
}
|
|
27
|
+
export declare function generate(root: string, manifest: Manifest): Promise<GenerateResult>;
|
|
28
|
+
export { envSummary };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Manifest } from "../manifest";
|
|
2
|
+
/**
|
|
3
|
+
* `lib/deploy/requirements.ts` — the preflight manifest.
|
|
4
|
+
*
|
|
5
|
+
* Every key in `env.ts` is required, which stops one being silently absent.
|
|
6
|
+
* It cannot stop one being PRESENT and meaningless: the `unset` sentinel lets
|
|
7
|
+
* a developer run the app without an Adyen account, and a deployment carrying
|
|
8
|
+
* it would start perfectly, take an order, and never charge anyone.
|
|
9
|
+
*
|
|
10
|
+
* This is the second gate, and the one that says WHY — because a list of key
|
|
11
|
+
* names tells an operator nothing about which one is urgent.
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderRequirementsTs(manifest: Manifest): string;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type Manifest } from "../manifest";
|
|
2
|
+
/**
|
|
3
|
+
* Strict layout — EXPERIMENTAL.
|
|
4
|
+
*
|
|
5
|
+
* The repository is the manifest plus what the manifest cannot express. The
|
|
6
|
+
* Void app is an artifact under `.vc/app`, gitignored, rewritten by
|
|
7
|
+
* `vc generate`, never hand-edited: a hand edit to a generated app drifts
|
|
8
|
+
* from the thing it exists to describe, and strict is the mode that refuses
|
|
9
|
+
* to let it.
|
|
10
|
+
*
|
|
11
|
+
* What is committed, and why each cannot be derived:
|
|
12
|
+
*
|
|
13
|
+
* voidcommerce.json the answers
|
|
14
|
+
* package.json one install for the artifact, which resolves modules
|
|
15
|
+
* through a node_modules symlink
|
|
16
|
+
* data/ the catalogue, pushed by `vc import`
|
|
17
|
+
* content/ launch FAQ and posts, copied in and wired at generate
|
|
18
|
+
* branding/ static assets, copied to public/branding/
|
|
19
|
+
* migrations/ what production has already applied. A migration
|
|
20
|
+
* regenerated on a fresh clone gets a new name, and a
|
|
21
|
+
* deploy would try to apply it again — so they live
|
|
22
|
+
* here and the app reaches them through a symlink.
|
|
23
|
+
* patches/ a void fix that has not shipped upstream
|
|
24
|
+
* .env local values, symlinked into the app
|
|
25
|
+
*
|
|
26
|
+
* The app's skeleton below is what `void init` and the panel's host files
|
|
27
|
+
* come to in the reference shop, with the copied shadcn components replaced
|
|
28
|
+
* by their package imports.
|
|
29
|
+
*/
|
|
30
|
+
export declare const STRICT_APP: string;
|
|
31
|
+
/** The one version the vendored patch applies to. */
|
|
32
|
+
export declare const VOID_VERSION = "0.10.13";
|
|
33
|
+
export declare function strictDependencies(manifest: Manifest): {
|
|
34
|
+
dependencies: Record<string, string>;
|
|
35
|
+
devDependencies: Record<string, string>;
|
|
36
|
+
patchedDependencies: Record<string, string>;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* void's `appendAuthHeaders` writes to immutable headers on Vite's own
|
|
40
|
+
* dev-asset responses, which 500s every page of a pages-mode app with auth
|
|
41
|
+
* enabled. Unreported upstream (the repo is private); this is the guard.
|
|
42
|
+
*/
|
|
43
|
+
export declare function renderVoidPatch(): string;
|
|
44
|
+
export declare function renderViteConfig(manifest: Manifest): string;
|
|
45
|
+
export declare function renderStrictTsconfig(): string;
|
|
46
|
+
export declare function renderVoidJson(): string;
|
|
47
|
+
export declare function renderDbSchema(): string;
|
|
48
|
+
export declare function renderDbSeed(): string;
|
|
49
|
+
export declare function renderLayoutTsx(): string;
|
|
50
|
+
export declare function renderAppCss(): string;
|
|
51
|
+
export declare function renderIndexServer(): string;
|
|
52
|
+
/** Void routes a page only when the component file exists; the loader above answers before this renders. */
|
|
53
|
+
export declare const INDEX_PAGE = "/** Never rendered: index.server.ts redirects to /api-dashboard first. */\nexport default function HomePage() {\n\treturn null;\n}\n";
|
|
54
|
+
export declare function renderDashboardPage(manifest: Manifest): string;
|
|
55
|
+
export declare const CLIENT_ONLY = "// Client-mounted: the kit's module graph must stay out of the Cloudflare worker.\nexport const ssr = false;\n";
|
|
56
|
+
export declare function renderSignInPage(manifest: Manifest): string;
|
|
57
|
+
export declare function renderAuthClient(manifest: Manifest): string;
|
|
58
|
+
/** Launch content, copied from content/ at generate time and typed against the plugins that take it. */
|
|
59
|
+
export declare function renderContentTs(manifest: Manifest): string;
|
|
60
|
+
export declare function renderCron(): string;
|
|
61
|
+
export declare function renderQueue(): string;
|
|
62
|
+
export declare function renderLiveStream(): string;
|
|
63
|
+
export declare function renderLiveRoute(): string;
|
|
64
|
+
export declare function renderStrictAppPackageJson(manifest: Manifest): string;
|
|
65
|
+
export declare const DATA_README = "# data/\n\nThe catalogue: `catalog.json` and `categories.json`, pushed into the running\nshop by `vc import` \u2014 the same operation in development and production. The\nworker never carries a copy.\n";
|
|
66
|
+
export declare const BRANDING_README = "# branding/\n\nStatic assets \u2014 logo, favicon, images. Copied to `public/branding/` at\ngenerate time and served at `/branding/<file>`.\n";
|
|
67
|
+
export declare const MIGRATIONS_README = "# migrations/\n\nWhat production has already applied. `void db generate` writes here through\n`.vc/app/db/migrations`, and a deploy verifies these produce the schema.\nCommit them: a migration regenerated on a fresh clone would get a new name,\nand the deploy would try to apply it twice.\n";
|
|
68
|
+
/**
|
|
69
|
+
* After the files: let void generate its artifacts and the migrations, so
|
|
70
|
+
* the app typechecks and deploys. Needs an install; says so otherwise.
|
|
71
|
+
*/
|
|
72
|
+
export declare function finishStrict(root: string): Promise<number>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Layout, type Manifest } from "../manifest";
|
|
2
|
+
/**
|
|
3
|
+
* The small modules `auth.ts` imports: the domain, the payment rail, the
|
|
4
|
+
* notification bridge, and the ERP when one was chosen.
|
|
5
|
+
*
|
|
6
|
+
* Each is written once and then OWNED by the app — they are the files a shop
|
|
7
|
+
* edits when it grows past the wizard, so they are not regenerated. `auth.ts`
|
|
8
|
+
* is the only file with a marked region.
|
|
9
|
+
*/
|
|
10
|
+
export declare function renderDomainTs(layout: Layout): string;
|
|
11
|
+
export declare function renderPaymentTs(manifest: Manifest): string;
|
|
12
|
+
export declare function renderNotificationsTs(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Which chain, and who mints. Written once, then yours.
|
|
15
|
+
*
|
|
16
|
+
* The default mints NOTHING and says so: a shop that has not chosen a chain
|
|
17
|
+
* has not chosen one, and a fulfilment row claiming a token exists when it
|
|
18
|
+
* does not is a lie with a customer attached. Swap `recordedMint()` for a
|
|
19
|
+
* real provider when you have decided, and every past order keeps working
|
|
20
|
+
* because the choice lives on the line, not in the catalogue.
|
|
21
|
+
*/
|
|
22
|
+
export declare function renderMintTs(): string;
|
|
23
|
+
export declare function renderErpTs(): string;
|
package/dist/help.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help that extends void's rather than replacing it.
|
|
3
|
+
*
|
|
4
|
+
* `vc --help` is void's help with a `shop` group merged into its Commands
|
|
5
|
+
* box. `vc init --help` is void's init help with a second box under it. Only
|
|
6
|
+
* when void cannot be asked does vc print its own text alone — and says why.
|
|
7
|
+
*/
|
|
8
|
+
/** What vc adds. One row per extended command; the merge reads this. */
|
|
9
|
+
export declare const EXTENDED_ROWS: Array<[command: string, summary: string]>;
|
|
10
|
+
/** One box line: `│ text…│`, padded to the box's width. */
|
|
11
|
+
export declare function line(text: string, width: number): string;
|
|
12
|
+
/**
|
|
13
|
+
* A command and its description in void's two-column layout, wrapped at the
|
|
14
|
+
* description column. A box too narrow for two columns, or a command too long
|
|
15
|
+
* for its column, stacks the description beneath the command instead.
|
|
16
|
+
*/
|
|
17
|
+
export declare function row(command: string, description: string, width: number, indent?: number): string[];
|
|
18
|
+
/** A clack-style box like void's own: `◇ title ───╮`, lines, `├───╯`. */
|
|
19
|
+
export declare function box(title: string, body: string[], width: number): string;
|
|
20
|
+
/**
|
|
21
|
+
* Void's help with vc's rows merged into the Commands box, as a `shop` group
|
|
22
|
+
* ahead of void's `help` group. Null when the output is not the box we know —
|
|
23
|
+
* then the caller prints void's help untouched and vc's after it.
|
|
24
|
+
*/
|
|
25
|
+
export declare function mergeHelp(voidHelp: string): string | null;
|
|
26
|
+
/** What vc prints when void cannot be asked. */
|
|
27
|
+
export declare function standaloneHelp(reason: string): string;
|
|
28
|
+
export declare function fullHelp(): Promise<number>;
|
|
29
|
+
/** `vc init --help`: void's init help, then what vc adds, in the same style. */
|
|
30
|
+
export declare function initHelp(): Promise<number>;
|
|
31
|
+
export declare function version(): Promise<number>;
|
package/dist/import.d.ts
ADDED