Open History to see the last commit
1# Prerelease package build and deployment
2
3Use Node 22.23.2 and npm 10.9.8. `neon-toolchain.lock.json` pins Neon source
4commit `3c08c9b45a919515a7b79977fa6267f828ce52d5`, pnpm 10.30.3, SDK artifacts and
5Vercel CLI 48.10.10. The installed native Vercel CLI 62.2.0 failed to load its
6builder during this build; the pinned Node CLI succeeds.
7
8## Build from a checkout
9
10```sh
11npm run bootstrap
12npm ci
13npm run typecheck
14npm test
15npm run build
16```
17
18Bootstrap clones into `.local/toolchains/neon-pkgs`, installs its frozen
19lockfile, builds the required packages and CLI, and creates `.sdk/*.tgz`.
20Runtime workspace dependencies are resolved to the matching sibling versions;
21all required siblings are direct local dependencies of the app. Application
22installation uses its committed lockfile.
23
24Neon's declaration bundler produces nondeterministic source-map encodings.
25Packing removes optional source maps and their references while preserving
26runtime JavaScript and declarations. SHA512 artifact checks match both the
27toolchain manifest and the application lockfile. A mismatched package aborts
28bootstrap. `NEON_PKGS_DIR` is accepted only for a clean checkout at the exact
29pinned commit. A fresh clone with no SDK artifacts or dependencies passed the
30full build; run `npm run test:clean` to reproduce that check.
31
32For an intentional source update, update the pinned commit, run
33`node scripts/bootstrap.mjs --update-integrity`, regenerate the application
34lockfile from the new artifacts, and rerun the clean-build check. Do not use
35the integrity-update switch in routine builds.
36
37## Prebuilt Vercel deployment
38
39```sh
40npx --yes vercel@48.10.10 link --yes --project hackernews-realtime
41node scripts/vercel-env.mjs preview
42npx --yes vercel@48.10.10 pull --yes --environment=preview
43node scripts/hydrate-build-env.mjs preview
44npx --yes vercel@48.10.10 build --yes
45npx --yes vercel@48.10.10 deploy --prebuilt --target preview
46```
47
48The environment setup script uses installed Vercel CLI 62 for its API and
49credential commands; deployment uses the pinned version above. Vercel stores
50server values as secrets that cannot be pulled back. The
51environment setup script feeds credentials via stdin and uses the Vercel API
52to store the validated public WebSocket URL as plain configuration. After
53pulling, the hydration script replaces build placeholders in the ignored
54`.vercel/.env.preview.local` with the corresponding values from `.env.local`.
55Never commit either file. Configure the public URL before
56the build; Next embeds it in browser assets. Server credentials remain runtime
57environment variables supplied by Vercel.
58
59Add the resulting exact browser origin to `DEMO_ORIGIN` and run
60`npm run ingest:deploy` to update Realtime's allowed origins. For subsequent
61preview URLs, preserve all origins still in use in `DEMO_ADDITIONAL_ORIGINS`.
62Use an explicit deployment target: Vercel can promote a project's first default
63deployment to production even when the command omits `--prod`.
64
65The shared demo is deployed at
66[hackernews-realtime.vercel.app](https://hackernews-realtime.vercel.app/).
67For a production artifact, run:
68
69```sh
70node scripts/vercel-env.mjs production
71npx --yes vercel@48.10.10 pull --yes --environment=production
72node scripts/hydrate-build-env.mjs production
73npx --yes vercel@48.10.10 build --prod --yes
74npx --yes vercel@48.10.10 deploy --prebuilt --prod
75```
76
77Run this in a checkout whose pinned bootstrap, frozen install and checks have
78passed. The clean-build script reports its artifact directory in
79`.local/clean-build-result.json`; copy only the ignored `.env.local` and Vercel
80project link into that directory before preparing deployment configuration.
81
82The prebuilt artifact contains traced server dependencies and bundled Neon
83server code. The deployment does not install missing ignored SDK tarballs.
84`.vercelignore` excludes local toolchains and credentials. Browser assets were
85checked against the actual sealing secret and database password before upload.
86
87The Neon Function deploys separately with `npm run ingest:deploy`. The policy
88keeps schedules disabled; that wrapper explicitly enables the named shared
89project/branch only when `ENABLE_INGEST=1`.