@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
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* voidcommerce — the library half of `vc`.
|
|
3
|
+
*
|
|
4
|
+
* The CLI is `bin/vc`. This is what a generator, a test, or Void itself one
|
|
5
|
+
* day, imports: the catalogue of choices, the manifest they are recorded in,
|
|
6
|
+
* and the generators that turn a manifest into files.
|
|
7
|
+
*/
|
|
8
|
+
export * from "./catalog";
|
|
9
|
+
export * from "./manifest";
|
|
10
|
+
export { generate, type GenerateResult } from "./generate/index";
|
|
11
|
+
export { renderAuthTs } from "./generate/auth";
|
|
12
|
+
export { allEnvKeys, envSummary, renderEnvExample, renderEnvLocal, renderEnvProduction, renderEnvTs, } from "./generate/env";
|
|
13
|
+
export { renderRequirementsTs } from "./generate/requirements";
|
|
14
|
+
export { renderDomainTs } from "./generate/support";
|
|
15
|
+
export * from "./generate/strict";
|
|
16
|
+
export { findProject, type Project } from "./project";
|
|
17
|
+
export { parseJsonc, upsertJsonc } from "./deploy/jsonc";
|
|
18
|
+
export { parseWhoAmI, findWrangler } from "./deploy/wrangler";
|
|
19
|
+
export { preflight, printPreflight, productionEnv, routeProblem } from "./deploy/preflight";
|
|
20
|
+
export { deployCloudflare } from "./deploy/cloudflare";
|
|
21
|
+
export { FRONTEND_BRANCH, renderFrontendApiTs, renderFrontendEnvProduction, renderFrontendWorkflow, renderStorefrontPage, } from "./generate/frontend";
|
|
22
|
+
export { distCommand, DIST_BRANCH, DIST_DIR } from "./dist";
|
|
23
|
+
export { renderDistWorkflow, renderDeployReadme } from "./generate/ci";
|
|
24
|
+
export { importCommand } from "./import";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BRANDING_README,
|
|
3
|
+
CLIENT_ONLY,
|
|
4
|
+
DATA_README,
|
|
5
|
+
DIST_BRANCH,
|
|
6
|
+
DIST_DIR,
|
|
7
|
+
FRONTEND_BRANCH,
|
|
8
|
+
INDEX_PAGE,
|
|
9
|
+
MIGRATIONS_README,
|
|
10
|
+
STRICT_APP,
|
|
11
|
+
VOID_VERSION,
|
|
12
|
+
allEnvKeys,
|
|
13
|
+
deployCloudflare,
|
|
14
|
+
distCommand,
|
|
15
|
+
envSummary,
|
|
16
|
+
findProject,
|
|
17
|
+
findWrangler,
|
|
18
|
+
finishStrict,
|
|
19
|
+
generate,
|
|
20
|
+
importCommand,
|
|
21
|
+
parseJsonc,
|
|
22
|
+
parseWhoAmI,
|
|
23
|
+
preflight,
|
|
24
|
+
printPreflight,
|
|
25
|
+
productionEnv,
|
|
26
|
+
renderAppCss,
|
|
27
|
+
renderAuthClient,
|
|
28
|
+
renderAuthTs,
|
|
29
|
+
renderContentTs,
|
|
30
|
+
renderCron,
|
|
31
|
+
renderDashboardPage,
|
|
32
|
+
renderDbSchema,
|
|
33
|
+
renderDbSeed,
|
|
34
|
+
renderDeployReadme,
|
|
35
|
+
renderDistWorkflow,
|
|
36
|
+
renderDomainTs,
|
|
37
|
+
renderEnvExample,
|
|
38
|
+
renderEnvLocal,
|
|
39
|
+
renderEnvProduction,
|
|
40
|
+
renderEnvTs,
|
|
41
|
+
renderFrontendApiTs,
|
|
42
|
+
renderFrontendEnvProduction,
|
|
43
|
+
renderFrontendWorkflow,
|
|
44
|
+
renderIndexServer,
|
|
45
|
+
renderLayoutTsx,
|
|
46
|
+
renderLiveRoute,
|
|
47
|
+
renderLiveStream,
|
|
48
|
+
renderQueue,
|
|
49
|
+
renderRequirementsTs,
|
|
50
|
+
renderSignInPage,
|
|
51
|
+
renderStorefrontPage,
|
|
52
|
+
renderStrictAppPackageJson,
|
|
53
|
+
renderStrictTsconfig,
|
|
54
|
+
renderViteConfig,
|
|
55
|
+
renderVoidJson,
|
|
56
|
+
renderVoidPatch,
|
|
57
|
+
routeProblem,
|
|
58
|
+
strictDependencies,
|
|
59
|
+
upsertJsonc
|
|
60
|
+
} from "./index-wzy1xtr1.js";
|
|
61
|
+
import {
|
|
62
|
+
LAYOUTS,
|
|
63
|
+
MANIFEST_FILE,
|
|
64
|
+
OWN_PACKAGES,
|
|
65
|
+
chosenIn,
|
|
66
|
+
envKeysOf,
|
|
67
|
+
has,
|
|
68
|
+
hasFrontend,
|
|
69
|
+
isApex,
|
|
70
|
+
isSingleApp,
|
|
71
|
+
packagesOf,
|
|
72
|
+
readManifest,
|
|
73
|
+
specifier,
|
|
74
|
+
validate,
|
|
75
|
+
withRequired,
|
|
76
|
+
workerHosts,
|
|
77
|
+
writeManifest,
|
|
78
|
+
zone,
|
|
79
|
+
zoneOf
|
|
80
|
+
} from "./index-ssv3a6wc.js";
|
|
81
|
+
import {
|
|
82
|
+
AUTH_PLUGINS,
|
|
83
|
+
CARRIERS,
|
|
84
|
+
CHOICES,
|
|
85
|
+
COMMERCE_CATALOG,
|
|
86
|
+
COMMERCE_OPERATIONS,
|
|
87
|
+
COMMERCE_SALES,
|
|
88
|
+
CONTENT,
|
|
89
|
+
DNS,
|
|
90
|
+
EMAIL,
|
|
91
|
+
ERP,
|
|
92
|
+
GROUPS,
|
|
93
|
+
PAYMENT,
|
|
94
|
+
SIGN_IN,
|
|
95
|
+
TAX,
|
|
96
|
+
UI
|
|
97
|
+
} from "./index-s7sq41qs.js";
|
|
98
|
+
export {
|
|
99
|
+
zoneOf,
|
|
100
|
+
zone,
|
|
101
|
+
writeManifest,
|
|
102
|
+
workerHosts,
|
|
103
|
+
withRequired,
|
|
104
|
+
validate,
|
|
105
|
+
upsertJsonc,
|
|
106
|
+
strictDependencies,
|
|
107
|
+
specifier,
|
|
108
|
+
routeProblem,
|
|
109
|
+
renderVoidPatch,
|
|
110
|
+
renderVoidJson,
|
|
111
|
+
renderViteConfig,
|
|
112
|
+
renderStrictTsconfig,
|
|
113
|
+
renderStrictAppPackageJson,
|
|
114
|
+
renderStorefrontPage,
|
|
115
|
+
renderSignInPage,
|
|
116
|
+
renderRequirementsTs,
|
|
117
|
+
renderQueue,
|
|
118
|
+
renderLiveStream,
|
|
119
|
+
renderLiveRoute,
|
|
120
|
+
renderLayoutTsx,
|
|
121
|
+
renderIndexServer,
|
|
122
|
+
renderFrontendWorkflow,
|
|
123
|
+
renderFrontendEnvProduction,
|
|
124
|
+
renderFrontendApiTs,
|
|
125
|
+
renderEnvTs,
|
|
126
|
+
renderEnvProduction,
|
|
127
|
+
renderEnvLocal,
|
|
128
|
+
renderEnvExample,
|
|
129
|
+
renderDomainTs,
|
|
130
|
+
renderDistWorkflow,
|
|
131
|
+
renderDeployReadme,
|
|
132
|
+
renderDbSeed,
|
|
133
|
+
renderDbSchema,
|
|
134
|
+
renderDashboardPage,
|
|
135
|
+
renderCron,
|
|
136
|
+
renderContentTs,
|
|
137
|
+
renderAuthTs,
|
|
138
|
+
renderAuthClient,
|
|
139
|
+
renderAppCss,
|
|
140
|
+
readManifest,
|
|
141
|
+
productionEnv,
|
|
142
|
+
printPreflight,
|
|
143
|
+
preflight,
|
|
144
|
+
parseWhoAmI,
|
|
145
|
+
parseJsonc,
|
|
146
|
+
packagesOf,
|
|
147
|
+
isSingleApp,
|
|
148
|
+
isApex,
|
|
149
|
+
importCommand,
|
|
150
|
+
hasFrontend,
|
|
151
|
+
has,
|
|
152
|
+
generate,
|
|
153
|
+
finishStrict,
|
|
154
|
+
findWrangler,
|
|
155
|
+
findProject,
|
|
156
|
+
envSummary,
|
|
157
|
+
envKeysOf,
|
|
158
|
+
distCommand,
|
|
159
|
+
deployCloudflare,
|
|
160
|
+
chosenIn,
|
|
161
|
+
allEnvKeys,
|
|
162
|
+
VOID_VERSION,
|
|
163
|
+
UI,
|
|
164
|
+
TAX,
|
|
165
|
+
STRICT_APP,
|
|
166
|
+
SIGN_IN,
|
|
167
|
+
PAYMENT,
|
|
168
|
+
OWN_PACKAGES,
|
|
169
|
+
MIGRATIONS_README,
|
|
170
|
+
MANIFEST_FILE,
|
|
171
|
+
LAYOUTS,
|
|
172
|
+
INDEX_PAGE,
|
|
173
|
+
GROUPS,
|
|
174
|
+
FRONTEND_BRANCH,
|
|
175
|
+
ERP,
|
|
176
|
+
EMAIL,
|
|
177
|
+
DNS,
|
|
178
|
+
DIST_DIR,
|
|
179
|
+
DIST_BRANCH,
|
|
180
|
+
DATA_README,
|
|
181
|
+
CONTENT,
|
|
182
|
+
COMMERCE_SALES,
|
|
183
|
+
COMMERCE_OPERATIONS,
|
|
184
|
+
COMMERCE_CATALOG,
|
|
185
|
+
CLIENT_ONLY,
|
|
186
|
+
CHOICES,
|
|
187
|
+
CARRIERS,
|
|
188
|
+
BRANDING_README,
|
|
189
|
+
AUTH_PLUGINS
|
|
190
|
+
};
|
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function init(args: string[]): Promise<number>;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `voidcommerce.json` — what this shop is made of.
|
|
3
|
+
*
|
|
4
|
+
* ── Why a manifest and not just generated files ─────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* A wizard that writes `auth.ts` once and forgets what it asked is a
|
|
7
|
+
* scaffolder: useful on day one, useless on day thirty when you want to add
|
|
8
|
+
* subscriptions and cannot remember which of the forty checkboxes you ticked.
|
|
9
|
+
*
|
|
10
|
+
* The manifest is the answers. Every generated file derives from it, so
|
|
11
|
+
* `vc init` on an existing project means "edit the answers and regenerate",
|
|
12
|
+
* and `vc gen` can read it to know what the shop already has. It is the
|
|
13
|
+
* Rails `config/` — the thing that makes the rest reproducible.
|
|
14
|
+
*/
|
|
15
|
+
export declare const MANIFEST_FILE = "voidcommerce.json";
|
|
16
|
+
/**
|
|
17
|
+
* How the shop is laid out — on disk and on the internet.
|
|
18
|
+
*
|
|
19
|
+
* app One Void app: the API and the generated storefront and panel,
|
|
20
|
+
* on Cloudflare Workers at <domain> and www.<domain>.
|
|
21
|
+
* monorepo api/ a Void app on Workers at api.<domain>, with the panel
|
|
22
|
+
* frontend/ a static Void site on GitHub Pages at <domain>
|
|
23
|
+
*
|
|
24
|
+
* strict EXPERIMENTAL. A monorepo turned inside out. The REPOSITORY
|
|
25
|
+
* ROOT is the storefront — its package.json, its pages, yours to
|
|
26
|
+
* edit — and the worker is generated underneath it at .vc/app
|
|
27
|
+
* from the manifest, gitignored, never hand-edited. Hosted the
|
|
28
|
+
* way a monorepo is: the worker on api.<domain>, the storefront
|
|
29
|
+
* on <domain>.
|
|
30
|
+
*
|
|
31
|
+
* The first question, because it decides where `void init` runs and what
|
|
32
|
+
* the domain means. It cannot change after init: moving files is not a
|
|
33
|
+
* regeneration.
|
|
34
|
+
*/
|
|
35
|
+
export type Layout = "app" | "monorepo" | "strict";
|
|
36
|
+
export declare const LAYOUTS: Array<{
|
|
37
|
+
id: Layout;
|
|
38
|
+
label: string;
|
|
39
|
+
hint: string;
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* One worker that IS the site, with no storefront anywhere else.
|
|
43
|
+
*
|
|
44
|
+
* Only `app`. A monorepo has `frontend/`; strict has the storefront at the
|
|
45
|
+
* ROOT — what a person edits there is the shop front, and the worker is
|
|
46
|
+
* generated underneath it. Both put the worker on `api.<domain>` and the
|
|
47
|
+
* storefront on the domain itself.
|
|
48
|
+
*/
|
|
49
|
+
export declare const isSingleApp: (layout: Layout) => boolean;
|
|
50
|
+
/** Does this layout carry a storefront of its own, and so a second origin to trust? */
|
|
51
|
+
export declare const hasFrontend: (layout: Layout) => boolean;
|
|
52
|
+
/** The zone a hostname most likely belongs to: the registrable domain. */
|
|
53
|
+
export declare function zoneOf(domain: string): string;
|
|
54
|
+
/** The zone this shop's records go in. */
|
|
55
|
+
export declare function zone(manifest: Manifest): string;
|
|
56
|
+
/** Is the shop at the zone's apex? Only then is there a `www` to answer on. */
|
|
57
|
+
export declare function isApex(manifest: Manifest): boolean;
|
|
58
|
+
/** Every hostname the worker answers on — the wrangler routes, in order. */
|
|
59
|
+
export declare function workerHosts(manifest: Manifest): string[];
|
|
60
|
+
export interface Manifest {
|
|
61
|
+
/** Schema version, for the day the shape changes. */
|
|
62
|
+
version: 1;
|
|
63
|
+
layout: Layout;
|
|
64
|
+
shop: {
|
|
65
|
+
name: string;
|
|
66
|
+
/** `deki.dk`, or `tshirt.saastemly.com` — the shop's public hostname; everything derives from it. */
|
|
67
|
+
domain: string;
|
|
68
|
+
/**
|
|
69
|
+
* The DNS zone that CONTAINS the domain: `deki.dk` for an apex,
|
|
70
|
+
* `saastemly.com` for `tshirt.saastemly.com`. Records are written here,
|
|
71
|
+
* and a Worker custom domain needs this zone on Cloudflare. Absent
|
|
72
|
+
* means the domain is its own zone.
|
|
73
|
+
*/
|
|
74
|
+
zone?: string | undefined;
|
|
75
|
+
/** `DK` — drives the declared VAT rate and the default region. */
|
|
76
|
+
country: string;
|
|
77
|
+
/** `dkk` */
|
|
78
|
+
currency: string;
|
|
79
|
+
/** `da` — copy in emails and launch content. */
|
|
80
|
+
locale: string;
|
|
81
|
+
/**
|
|
82
|
+
* Is the shop registered for VAT (or its local equivalent)?
|
|
83
|
+
*
|
|
84
|
+
* Not a preference. A business below the registration threshold must
|
|
85
|
+
* NOT add tax to a price, and one above it must. Getting this wrong is
|
|
86
|
+
* unlawful in both directions, and it is invisible in a generated
|
|
87
|
+
* `auth.ts` unless something asks — so this asks, and there is no
|
|
88
|
+
* default that is safe to assume.
|
|
89
|
+
*/
|
|
90
|
+
taxRegistered?: boolean | undefined;
|
|
91
|
+
/** `saastemly.github.io` — the monorepo's frontend lives on GitHub Pages; the www record points here. */
|
|
92
|
+
pagesHost?: string | undefined;
|
|
93
|
+
};
|
|
94
|
+
/** Chosen ids from each group, keyed by group id. */
|
|
95
|
+
chosen: Record<string, string[]>;
|
|
96
|
+
/**
|
|
97
|
+
* Where the betterCommerce packages come from, when not from npm.
|
|
98
|
+
* `vc init --link ../` writes `file:../better-commerce` and friends, so a
|
|
99
|
+
* checkout of the whole suite installs. Absent means the registry.
|
|
100
|
+
*/
|
|
101
|
+
link?: string | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* What `vc deploy --cloudflare --provision` created. Recorded here so a
|
|
104
|
+
* regenerated wrangler.jsonc (strict) carries the real ids.
|
|
105
|
+
*/
|
|
106
|
+
cloudflare?: {
|
|
107
|
+
accountId?: string;
|
|
108
|
+
d1?: {
|
|
109
|
+
name: string;
|
|
110
|
+
id: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** Everything a group's `required` choices and the layout imply, whatever was ticked. */
|
|
115
|
+
export declare function withRequired(chosen: Record<string, string[]>, layout?: Layout): Record<string, string[]>;
|
|
116
|
+
/** Is a choice in the manifest, in any group? */
|
|
117
|
+
export declare function has(manifest: Manifest, id: string): boolean;
|
|
118
|
+
/** The chosen ids of one group — for ids like `none` that several groups use. */
|
|
119
|
+
export declare function chosenIn(manifest: Manifest, groupId: string): string[];
|
|
120
|
+
/** Every env key the chosen set needs, deduplicated, in group order. */
|
|
121
|
+
export declare function envKeysOf(manifest: Manifest): import("./catalog").EnvKey[];
|
|
122
|
+
/** The packages this suite publishes, which a checkout can supply instead of npm. */
|
|
123
|
+
export declare const OWN_PACKAGES: string[];
|
|
124
|
+
/** What a dependency on `name` should say: a link into the checkout, or a version. */
|
|
125
|
+
export declare function specifier(manifest: Manifest, name: string, version?: string): string;
|
|
126
|
+
/** Every npm package the chosen set needs — for the app, or the monorepo's api/. */
|
|
127
|
+
export declare function packagesOf(manifest: Manifest): string[];
|
|
128
|
+
export declare function readManifest(root: string): Promise<Manifest | null>;
|
|
129
|
+
export declare function writeManifest(root: string, manifest: Manifest): Promise<void>;
|
|
130
|
+
/** Refuse a manifest that contradicts the catalogue's rules or its own layout. */
|
|
131
|
+
export declare function validate(manifest: Manifest): string[];
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LAYOUTS,
|
|
3
|
+
MANIFEST_FILE,
|
|
4
|
+
OWN_PACKAGES,
|
|
5
|
+
chosenIn,
|
|
6
|
+
envKeysOf,
|
|
7
|
+
has,
|
|
8
|
+
hasFrontend,
|
|
9
|
+
isApex,
|
|
10
|
+
isSingleApp,
|
|
11
|
+
packagesOf,
|
|
12
|
+
readManifest,
|
|
13
|
+
specifier,
|
|
14
|
+
validate,
|
|
15
|
+
withRequired,
|
|
16
|
+
workerHosts,
|
|
17
|
+
writeManifest,
|
|
18
|
+
zone,
|
|
19
|
+
zoneOf
|
|
20
|
+
} from "./index-ssv3a6wc.js";
|
|
21
|
+
import"./index-s7sq41qs.js";
|
|
22
|
+
export {
|
|
23
|
+
zoneOf,
|
|
24
|
+
zone,
|
|
25
|
+
writeManifest,
|
|
26
|
+
workerHosts,
|
|
27
|
+
withRequired,
|
|
28
|
+
validate,
|
|
29
|
+
specifier,
|
|
30
|
+
readManifest,
|
|
31
|
+
packagesOf,
|
|
32
|
+
isSingleApp,
|
|
33
|
+
isApex,
|
|
34
|
+
hasFrontend,
|
|
35
|
+
has,
|
|
36
|
+
envKeysOf,
|
|
37
|
+
chosenIn,
|
|
38
|
+
OWN_PACKAGES,
|
|
39
|
+
MANIFEST_FILE,
|
|
40
|
+
LAYOUTS
|
|
41
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Manifest } from "./manifest";
|
|
2
|
+
/**
|
|
3
|
+
* The project vc is standing in, if any.
|
|
4
|
+
*
|
|
5
|
+
* The manifest names the root. Where void's commands run follows the layout:
|
|
6
|
+
* the root itself for one app; api/ for a monorepo — from the root or from
|
|
7
|
+
* inside api/; the artifact under .vc/app for strict, generated first if it
|
|
8
|
+
* is not there.
|
|
9
|
+
*/
|
|
10
|
+
export interface Project {
|
|
11
|
+
root: string;
|
|
12
|
+
manifest: Manifest;
|
|
13
|
+
/** Where void's commands run. */
|
|
14
|
+
appDir: string;
|
|
15
|
+
/** Strict only: the artifact has not been generated yet. */
|
|
16
|
+
needsGenerate: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function findProject(cwd?: string): Promise<Project | null>;
|
|
19
|
+
/** A strict artifact that is not there yet is generated before anything runs in it. */
|
|
20
|
+
export declare function ensureGenerated(project: Project): Promise<number>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vc generate` — the files from the manifest, without the form.
|
|
3
|
+
*
|
|
4
|
+
* In one-app and monorepo layouts it rewrites the regenerated files and
|
|
5
|
+
* keeps the owned ones. In strict it is the whole app: every file under
|
|
6
|
+
* .vc/app, then void's own artifacts and the migrations.
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateCommand(): Promise<number>;
|
|
9
|
+
export declare function generateHelp(): Promise<number>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vc dev`, `vc build`, `vc preview` — the app's own scripts, where the app is.
|
|
3
|
+
*
|
|
4
|
+
* void has no `dev` command: `void init` writes `dev`, `build` and `preview`
|
|
5
|
+
* into the app's package.json (`vp dev`, or `vite dev`), and that is what
|
|
6
|
+
* runs. vc adds nothing to them but the WHERE — a monorepo's api/ from the
|
|
7
|
+
* root, a strict artifact under .vc/app, generated first if it is not there.
|
|
8
|
+
* Outside a project they go to void, which says what it thinks of them.
|
|
9
|
+
*/
|
|
10
|
+
export type AppScript = "dev" | "build" | "preview";
|
|
11
|
+
export declare function appScript(name: AppScript): (args: string[]) => Promise<number>;
|
|
12
|
+
export declare function appScriptHelp(name: AppScript): () => Promise<number>;
|
package/dist/void.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `void` binary, and the two ways vc uses it.
|
|
3
|
+
*
|
|
4
|
+
* `runVoid` hands the terminal over — for everything vc passes through, and
|
|
5
|
+
* for `void init` when vc extends it. `captureVoid` reads what void would
|
|
6
|
+
* have printed, so vc can merge its own lines into void's help rather than
|
|
7
|
+
* replace it.
|
|
8
|
+
*
|
|
9
|
+
* Void is the app's dependency, not vc's, so the nearest node_modules wins,
|
|
10
|
+
* then PATH, then `bunx void` — the way Void's own docs say to invoke it.
|
|
11
|
+
*/
|
|
12
|
+
export interface VoidBin {
|
|
13
|
+
cmd: string;
|
|
14
|
+
prefix: string[];
|
|
15
|
+
}
|
|
16
|
+
export declare function findVoid(from?: string): VoidBin | null;
|
|
17
|
+
export declare const VOID_MISSING = "`void` is not installed here. `bun add -d void` \u2014 Void recommends a local install \u2014 then try again.";
|
|
18
|
+
/** Hand the terminal to void. Resolves with the exit code void would have had. */
|
|
19
|
+
export declare function runVoid(args: string[], cwd?: string): Promise<number>;
|
|
20
|
+
/** Hand the terminal to any command, forwarding signals, resolving with its exit code. */
|
|
21
|
+
export declare function runInherit(cmd: string, args: string[], cwd: string): Promise<number>;
|
|
22
|
+
/** What void prints for `args`, or null when void is not here. Stdout then stderr, as void ordered them. */
|
|
23
|
+
export declare function captureVoid(args: string[], cwd?: string): Promise<{
|
|
24
|
+
code: number;
|
|
25
|
+
out: string;
|
|
26
|
+
} | null>;
|
|
27
|
+
/** A directory Void already knows: its Vite config imports void, or it carries a void.json. */
|
|
28
|
+
export declare function isVoidApp(dir: string): boolean;
|
|
29
|
+
/** The Void apps directly under `dir` — for when `void init` chose to make a subfolder. */
|
|
30
|
+
export declare function voidAppsIn(dir: string): string[];
|
package/dist/wizard.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Layout, type Manifest } from "./manifest";
|
|
2
|
+
/** The first question. */
|
|
3
|
+
export declare function askLayout(): Promise<Layout>;
|
|
4
|
+
/** The rest of the form, once the layout is known and the Void app(s) exist. */
|
|
5
|
+
export declare function runWizard(existing: Manifest | null, layout: Layout): Promise<Manifest>;
|
|
6
|
+
/** A closing summary the person can read before anything is written. */
|
|
7
|
+
export declare function summarise(manifest: Manifest): string;
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@saastemly/voidcommerce",
|
|
3
|
+
"version": "0.1.0",
|
|
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
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"vc": "./bin/vc",
|
|
9
|
+
"@saastemly/voidcommerce": "./bin/vc"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin",
|
|
13
|
+
"dist",
|
|
14
|
+
"src"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./catalog": {
|
|
22
|
+
"types": "./dist/catalog.d.ts",
|
|
23
|
+
"default": "./dist/catalog.js"
|
|
24
|
+
},
|
|
25
|
+
"./manifest": {
|
|
26
|
+
"types": "./dist/manifest.d.ts",
|
|
27
|
+
"default": "./dist/manifest.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "rm -rf dist && bun build ./src/index.ts ./src/catalog.ts ./src/manifest.ts ./src/cli.ts --root ./src --outdir dist --target node --format esm --splitting --external @clack/prompts --external picocolors && tsc -p tsconfig.build.json",
|
|
32
|
+
"test": "bun test --parallel --no-isolate",
|
|
33
|
+
"typecheck": "tsc --noEmit"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@clack/prompts": "^0.11.0",
|
|
37
|
+
"picocolors": "^1.1.1"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/bun": "latest",
|
|
41
|
+
"typescript": "^5.6.0"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/saastemly/voidcommerce.git"
|
|
49
|
+
}
|
|
50
|
+
}
|