create-marcapony-app 0.2.2 → 0.3.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/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/template/base/{.dev.vars.example → .env.local.example} +1 -1
- package/template/base/_gitignore +3 -1
- package/template/base/_package.json +3 -3
- package/template/base/marcapony.json +11 -7
- package/template/base/scripts/dev.ts +9 -6
- package/template/base/src/server/marcapony.ts +2 -2
- package/template/base/vite.config.ts +1 -1
- package/template/blank/README.md +2 -2
- package/template/booking/README.md +2 -2
- package/template/booking/marcapony.json +14 -8
- package/template/shop/README.md +2 -2
- package/template/shop/marcapony.json +11 -7
- package/template/team-tool/README.md +2 -2
- package/template/team-tool/marcapony.json +11 -7
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare function templateRoot(moduleUrl: string): string;
|
|
|
40
40
|
*
|
|
41
41
|
* That matters most with `--force`, which is how someone lands here with a
|
|
42
42
|
* directory that already has content. Clobbering would destroy exactly the files
|
|
43
|
-
* you cannot get back: `.dev.vars` holds a key the platform will not show again,
|
|
43
|
+
* you cannot get back: `.env.local` (or `.dev.vars`) holds a key the platform will not show again,
|
|
44
44
|
* and `marcapony.json` holds the app slug `marcapony app link` wrote. Filling in
|
|
45
45
|
* only what is missing is both safer and the more useful meaning of --force.
|
|
46
46
|
*/
|
package/dist/index.js
CHANGED
|
@@ -113,7 +113,7 @@ export function nextSteps(dir, template = DEFAULT_TEMPLATE) {
|
|
|
113
113
|
'Next:',
|
|
114
114
|
` cd ${dir}`,
|
|
115
115
|
' bun install',
|
|
116
|
-
' bun run link # writes your app key into .
|
|
116
|
+
' bun run link # writes your app key into .env.local',
|
|
117
117
|
' bun run dev',
|
|
118
118
|
'',
|
|
119
119
|
'When it is ready:',
|
|
@@ -130,7 +130,7 @@ export function templateRoot(moduleUrl) {
|
|
|
130
130
|
*
|
|
131
131
|
* That matters most with `--force`, which is how someone lands here with a
|
|
132
132
|
* directory that already has content. Clobbering would destroy exactly the files
|
|
133
|
-
* you cannot get back: `.dev.vars` holds a key the platform will not show again,
|
|
133
|
+
* you cannot get back: `.env.local` (or `.dev.vars`) holds a key the platform will not show again,
|
|
134
134
|
* and `marcapony.json` holds the app slug `marcapony app link` wrote. Filling in
|
|
135
135
|
* only what is missing is both safer and the more useful meaning of --force.
|
|
136
136
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-marcapony-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Scaffold a Marcapony app \u2014 a Worker backed by the Marcapony API, ready for `marcapony app link` and `marcapony app deploy`",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# `bun run link` writes the real values into `.
|
|
1
|
+
# `bun run link` writes the real values into `.env.local` for you: the key is
|
|
2
2
|
# minted fresh and never passes through a clipboard. This file is only here to
|
|
3
3
|
# document what ends up there.
|
|
4
4
|
MARCAPONY_API_KEY=mpk_...
|
package/template/base/_gitignore
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
"dev": "bun run scripts/dev.ts",
|
|
8
8
|
"link": "marcapony app link",
|
|
9
9
|
"deploy": "marcapony app deploy",
|
|
10
|
-
"build": "bun run build:client && bun run build:
|
|
10
|
+
"build": "bun run build:client && bun run build:server",
|
|
11
11
|
"build:client": "vite build",
|
|
12
|
-
"build:
|
|
12
|
+
"build:server": "esbuild src/server/index.ts --bundle --format=esm --platform=neutral --conditions=worker,browser --target=es2022 --outfile=dist/server/index.js",
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@types/react-dom": "^19.3.0",
|
|
25
25
|
"@vitejs/plugin-react": "^5.2.0",
|
|
26
26
|
"esbuild": "^0.28.0",
|
|
27
|
-
"marcapony": "^0.
|
|
27
|
+
"marcapony": "^0.6.0",
|
|
28
28
|
"typescript": "^5.9.0",
|
|
29
29
|
"vite": "^7.3.0"
|
|
30
30
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "./node_modules/marcapony/manifest.schema.json",
|
|
3
|
+
"manifest": 2,
|
|
2
4
|
"build": "bun run build",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
"not_found_handling": "single-page-application",
|
|
7
|
-
"run_worker_first": ["/api/*"]
|
|
5
|
+
"server": "dist/server/index.js",
|
|
6
|
+
"public": {
|
|
7
|
+
"dir": "dist/client"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
9
|
+
"routes": {
|
|
10
|
+
"server": ["/api/*"],
|
|
11
|
+
"notFound": "spa"
|
|
12
|
+
},
|
|
13
|
+
"runtime": "2026-10",
|
|
14
|
+
"ignore": ["coverage/", "*.log"]
|
|
11
15
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Local dev: Vite serves the UI and proxies `/api` here, where the same Hono app
|
|
3
3
|
* that ships to production handles the request.
|
|
4
4
|
*
|
|
5
|
-
* Caveat worth knowing: this runs under Bun, not the
|
|
6
|
-
* are close but not identical, so a deployed app can still surface something
|
|
5
|
+
* Caveat worth knowing: this runs under Bun, not the Marcapony runtime. The
|
|
6
|
+
* two are close but not identical, so a deployed app can still surface something
|
|
7
7
|
* local dev did not. Verify after `bun run deploy`, and prefer plain
|
|
8
8
|
* web APIs (fetch, Request, Response, crypto) over Node built-ins in
|
|
9
9
|
* `src/server` — those are the ones that behave the same in both.
|
|
@@ -12,12 +12,15 @@ import { readFileSync, existsSync } from 'node:fs'
|
|
|
12
12
|
import app from '../src/server/index'
|
|
13
13
|
|
|
14
14
|
const API_PORT = 8787
|
|
15
|
-
|
|
15
|
+
// `.env.local` is where `bun run link` writes the key; `.dev.vars` is read for
|
|
16
|
+
// projects linked before marcapony.json version 2.
|
|
17
|
+
const ENV_FILES = ['.env.local', '.dev.vars']
|
|
16
18
|
|
|
17
19
|
function loadDevVars(): Record<string, string> {
|
|
18
|
-
|
|
20
|
+
const file = ENV_FILES.find((name) => existsSync(name))
|
|
21
|
+
if (!file) return {}
|
|
19
22
|
const out: Record<string, string> = {}
|
|
20
|
-
for (const line of readFileSync(
|
|
23
|
+
for (const line of readFileSync(file, 'utf8').split('\n')) {
|
|
21
24
|
const trimmed = line.trim()
|
|
22
25
|
if (!trimmed || trimmed.startsWith('#')) continue
|
|
23
26
|
const eq = trimmed.indexOf('=')
|
|
@@ -39,7 +42,7 @@ function readPlacement(): string | undefined {
|
|
|
39
42
|
const env = loadDevVars()
|
|
40
43
|
if (!env.MARCAPONY_API_KEY) {
|
|
41
44
|
console.warn(
|
|
42
|
-
`No MARCAPONY_API_KEY in ${
|
|
45
|
+
`No MARCAPONY_API_KEY in ${ENV_FILES[0]}: /api routes that call Marcapony will fail.\nRun \`bun run link\` to get one.`,
|
|
43
46
|
)
|
|
44
47
|
}
|
|
45
48
|
|
|
@@ -6,7 +6,7 @@ import { createClient, MarcaponyError, type Identity } from 'marcapony-sdk'
|
|
|
6
6
|
* ends up read from the wrong place, or bundled into the browser.
|
|
7
7
|
*/
|
|
8
8
|
export interface MarcaponyBindings {
|
|
9
|
-
/** Scoped app key (`mpk_...`). Written into `.
|
|
9
|
+
/** Scoped app key (`mpk_...`). Written into `.env.local` by `bun run link`. */
|
|
10
10
|
MARCAPONY_API_KEY?: string
|
|
11
11
|
/** API root. Also written by `bun run link`; the SDK defaults to production. */
|
|
12
12
|
MARCAPONY_API_URL?: string
|
|
@@ -28,7 +28,7 @@ export type Marcapony = ReturnType<typeof createClient>
|
|
|
28
28
|
export function marcaponyFromEnv(env: MarcaponyBindings): Marcapony {
|
|
29
29
|
if (!env.MARCAPONY_API_KEY) {
|
|
30
30
|
throw new Error(
|
|
31
|
-
'MARCAPONY_API_KEY is missing. Run `bun run link` in this project. It writes the key into .
|
|
31
|
+
'MARCAPONY_API_KEY is missing. Run `bun run link` in this project. It writes the key into .env.local for you.',
|
|
32
32
|
)
|
|
33
33
|
}
|
|
34
34
|
return createClient({
|
|
@@ -10,7 +10,7 @@ export default defineConfig({
|
|
|
10
10
|
},
|
|
11
11
|
server: {
|
|
12
12
|
// `bun run dev` serves the Hono app on 8787; in production the platform
|
|
13
|
-
// routes /api/* to the
|
|
13
|
+
// routes /api/* to the server instead (see routes.server in marcapony.json).
|
|
14
14
|
proxy: { '/api': 'http://localhost:8787' },
|
|
15
15
|
},
|
|
16
16
|
})
|
package/template/blank/README.md
CHANGED
|
@@ -33,12 +33,12 @@ Requires [Bun](https://bun.sh).
|
|
|
33
33
|
|
|
34
34
|
```sh
|
|
35
35
|
bun install
|
|
36
|
-
bun run link # paste the connection code from the app's page; writes .
|
|
36
|
+
bun run link # paste the connection code from the app's page; writes .env.local and AGENTS.md
|
|
37
37
|
bun run dev # interface and /api routes on your machine
|
|
38
38
|
bun run deploy # build and publish; prints the address
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
`.
|
|
41
|
+
`.env.local` holds the app key. Never commit it, and never send it to the
|
|
42
42
|
browser: the interface calls this app's own `/api` routes, and only those talk
|
|
43
43
|
to Marcapony. `MARCAPONY_APP_ID` is set by Marcapony when the app is deployed;
|
|
44
44
|
locally there is none, so nobody is signed in during `bun run dev`.
|
|
@@ -43,12 +43,12 @@ Requires [Bun](https://bun.sh).
|
|
|
43
43
|
|
|
44
44
|
```sh
|
|
45
45
|
bun install
|
|
46
|
-
bun run link # paste the connection code from the app's page; writes .
|
|
46
|
+
bun run link # paste the connection code from the app's page; writes .env.local and AGENTS.md
|
|
47
47
|
bun run dev # interface and /api routes on your machine
|
|
48
48
|
bun run deploy # build and publish; prints the address
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
`.
|
|
51
|
+
`.env.local` holds the app key. Never commit it, and never send it to the
|
|
52
52
|
browser: the interface calls this app's own `/api` routes, and only those talk
|
|
53
53
|
to Marcapony. `MARCAPONY_APP_ID` is set by Marcapony when the app is deployed;
|
|
54
54
|
locally there is none, so nobody is signed in during `bun run dev`.
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "./node_modules/marcapony/manifest.schema.json",
|
|
3
|
+
"manifest": 2,
|
|
2
4
|
"build": "bun run build",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
"not_found_handling": "single-page-application",
|
|
7
|
-
"run_worker_first": ["/api/*"]
|
|
5
|
+
"server": "dist/server/index.js",
|
|
6
|
+
"public": {
|
|
7
|
+
"dir": "dist/client"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
9
|
+
"routes": {
|
|
10
|
+
"server": ["/api/*"],
|
|
11
|
+
"notFound": "spa"
|
|
12
|
+
},
|
|
13
|
+
"runtime": "2026-10",
|
|
14
|
+
"ignore": ["coverage/", "*.log"],
|
|
11
15
|
"placement": "portal",
|
|
12
16
|
"dataAccess": "customer",
|
|
13
17
|
"permissions": [
|
|
@@ -22,5 +26,7 @@
|
|
|
22
26
|
"grants": ["reservations.own.create", "reservations.own.cancel"]
|
|
23
27
|
}
|
|
24
28
|
],
|
|
25
|
-
"portal": {
|
|
29
|
+
"portal": {
|
|
30
|
+
"title": "Appointments"
|
|
31
|
+
}
|
|
26
32
|
}
|
package/template/shop/README.md
CHANGED
|
@@ -51,12 +51,12 @@ Requires [Bun](https://bun.sh).
|
|
|
51
51
|
|
|
52
52
|
```sh
|
|
53
53
|
bun install
|
|
54
|
-
bun run link # paste the connection code from the app's page; writes .
|
|
54
|
+
bun run link # paste the connection code from the app's page; writes .env.local and AGENTS.md
|
|
55
55
|
bun run dev # interface and /api routes on your machine
|
|
56
56
|
bun run deploy # build and publish; prints the address
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
`.
|
|
59
|
+
`.env.local` holds the app key. Never commit it, and never send it to the
|
|
60
60
|
browser: the interface calls this app's own `/api` routes, and only those talk
|
|
61
61
|
to Marcapony. `MARCAPONY_APP_ID` is set by Marcapony when the app is deployed;
|
|
62
62
|
locally there is none, so nobody is signed in during `bun run dev`.
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "./node_modules/marcapony/manifest.schema.json",
|
|
3
|
+
"manifest": 2,
|
|
2
4
|
"build": "bun run build",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
"not_found_handling": "single-page-application",
|
|
7
|
-
"run_worker_first": ["/api/*"]
|
|
5
|
+
"server": "dist/server/index.js",
|
|
6
|
+
"public": {
|
|
7
|
+
"dir": "dist/client"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
9
|
+
"routes": {
|
|
10
|
+
"server": ["/api/*"],
|
|
11
|
+
"notFound": "spa"
|
|
12
|
+
},
|
|
13
|
+
"runtime": "2026-10",
|
|
14
|
+
"ignore": ["coverage/", "*.log"],
|
|
11
15
|
"placement": "public"
|
|
12
16
|
}
|
|
@@ -44,12 +44,12 @@ Requires [Bun](https://bun.sh).
|
|
|
44
44
|
|
|
45
45
|
```sh
|
|
46
46
|
bun install
|
|
47
|
-
bun run link # paste the connection code from the app's page; writes .
|
|
47
|
+
bun run link # paste the connection code from the app's page; writes .env.local and AGENTS.md
|
|
48
48
|
bun run dev # interface and /api routes on your machine
|
|
49
49
|
bun run deploy # build and publish; prints the address
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
`.
|
|
52
|
+
`.env.local` holds the app key. Never commit it, and never send it to the
|
|
53
53
|
browser: the interface calls this app's own `/api` routes, and only those talk
|
|
54
54
|
to Marcapony. `MARCAPONY_APP_ID` is set by Marcapony when the app is deployed;
|
|
55
55
|
locally there is none, so nobody is signed in during `bun run dev`.
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "./node_modules/marcapony/manifest.schema.json",
|
|
3
|
+
"manifest": 2,
|
|
2
4
|
"build": "bun run build",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
"not_found_handling": "single-page-application",
|
|
7
|
-
"run_worker_first": ["/api/*"]
|
|
5
|
+
"server": "dist/server/index.js",
|
|
6
|
+
"public": {
|
|
7
|
+
"dir": "dist/client"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
9
|
+
"routes": {
|
|
10
|
+
"server": ["/api/*"],
|
|
11
|
+
"notFound": "spa"
|
|
12
|
+
},
|
|
13
|
+
"runtime": "2026-10",
|
|
14
|
+
"ignore": ["coverage/", "*.log"],
|
|
11
15
|
"placement": "portal",
|
|
12
16
|
"dataAccess": "team",
|
|
13
17
|
"permissions": [
|