@proveanything/smartlinks 2.0.14 → 2.0.15
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/docs/API_SUMMARY.md
CHANGED
|
@@ -236,14 +236,24 @@ today.)
|
|
|
236
236
|
|
|
237
237
|
---
|
|
238
238
|
|
|
239
|
-
## Wiring it into your build
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
## Wiring it into your build (the KEYED path — CI / controlled env / beta·stable)
|
|
240
|
+
|
|
241
|
+
> ⚠️ **This is the deploy-key path — not the default for a Lovable dev publish.** If you build in
|
|
242
|
+
> Lovable (no deploy key in the build), your dev publishes register via the **key-free `refresh-dev`
|
|
243
|
+
> ping** in **[Section A](#a-from-lovable--hit-publish-no-key-anywhere-recommended-for-lovable-apps)** — put *that* in `postbuild`, not the
|
|
244
|
+
> binary below. Reach for `smartlinks-register-release` only where you (a) hold a deploy key and
|
|
245
|
+
> (b) set `SMARTLINKS_CHANNEL` — i.e. a controlled dev/CI environment, or a formal **beta/stable**
|
|
246
|
+
> deploy. In a keyless Lovable postbuild this binary **skips silently** (no channel ⇒ no-op), so a
|
|
247
|
+
> dev publish would register *nothing* — that's the trap. One rule: **dev publish → `refresh-dev`;
|
|
248
|
+
> keyed/formal deploy → `register-release`.**
|
|
249
|
+
|
|
250
|
+
Registration is the **last step of a keyed build** — after bundles are built and hashed. Run a
|
|
242
251
|
small script that reads your built manifest and POSTs it, and **exits non-zero on failure**
|
|
243
252
|
so a bad install fails the publish.
|
|
244
253
|
|
|
245
|
-
The SDK ships the script, so you don't copy-paste it — run it as your postbuild step
|
|
246
|
-
your built manifest, POSTs it, prints any warnings, and exits non-zero on
|
|
254
|
+
The SDK ships the script, so you don't copy-paste it — run it as your postbuild step **in a keyed
|
|
255
|
+
environment**. It reads your built manifest, POSTs it, prints any warnings, and exits non-zero on
|
|
256
|
+
failure.
|
|
247
257
|
|
|
248
258
|
```jsonc
|
|
249
259
|
// package.json
|
|
@@ -266,13 +276,16 @@ It is driven entirely by env vars, so the same command works for dev (Lovable) a
|
|
|
266
276
|
|
|
267
277
|
> The full source is at `scripts/register-release.mjs` in the SDK package if you'd rather vendor it.
|
|
268
278
|
|
|
269
|
-
Registration is gated by **`SMARTLINKS_CHANNEL`**, so
|
|
279
|
+
Registration is gated by **`SMARTLINKS_CHANNEL`**, so a keyed build behaves correctly by intent:
|
|
270
280
|
|
|
271
281
|
| Build | `SMARTLINKS_CHANNEL` | Result |
|
|
272
282
|
|---|---|---|
|
|
273
|
-
| **Preview / live-edit** | unset | **skips quietly** — never registers, never fails |
|
|
274
|
-
| **
|
|
275
|
-
| **Prod (CI)** | `stable` | registers to `stable` with the prod/master key; a missing key **hard-fails** |
|
|
283
|
+
| **Preview / live-edit / plain Lovable dev publish** | unset | **skips quietly** — never registers, never fails. (A Lovable dev publish is meant to register via the key-free `refresh-dev` ping in [Section A](#a-from-lovable--hit-publish-no-key-anywhere-recommended-for-lovable-apps), not this binary.) |
|
|
284
|
+
| **Controlled dev env (you hold a dev key)** | `dev` | registers to `dev` with the dev key + your `SMARTLINKS_BUNDLE_BASE_URL` |
|
|
285
|
+
| **Prod (CI / formal deploy)** | `stable` | registers to `stable` with the prod/master key; a missing key **hard-fails** |
|
|
286
|
+
|
|
287
|
+
> The middle row is a *controlled* dev environment where you deliberately hold a dev key and set the
|
|
288
|
+
> channel — **not** a stock Lovable publish, which carries neither and so should use `refresh-dev`.
|
|
276
289
|
|
|
277
290
|
**Two secrets, two scopes:** the **deploy key** is channel-scoped and can be a *workspace-level*
|
|
278
291
|
Lovable Build Secret shared by every app (a dev key only writes `dev`, so sharing it is safe). The
|
|
@@ -178,3 +178,24 @@ if (host && host.version !== SHARED_DEPENDENCY_CONTRACT_VERSION) {
|
|
|
178
178
|
The host publishes its live contract on `window.__SMARTLINKS_SHARED__` (`{ version, specifiers }`),
|
|
179
179
|
which `getHostSharedDependencies()` reads. Import-map shim paths follow `importMapPathFor(specifier)`
|
|
180
180
|
(`/sl-shared/<version>/<slug>.js`), so both the portal and the SDK generate identical paths.
|
|
181
|
+
|
|
182
|
+
## Version retention — hosts MUST keep every published version (load-bearing)
|
|
183
|
+
|
|
184
|
+
The version in the shim path (`/sl-shared/vN/`) exists **so multiple contract versions coexist**. A
|
|
185
|
+
deployed app pins the version it was built against (`meta.sharedDependencies`) and resolves its shims
|
|
186
|
+
from that path forever. Therefore:
|
|
187
|
+
|
|
188
|
+
> **A contract bump is ADDITIVE. Generating `/sl-shared/v7/` MUST NOT delete `/sl-shared/v5/` or
|
|
189
|
+
> `/sl-shared/v6/`.** The shims are tiny re-export files — keep them.
|
|
190
|
+
|
|
191
|
+
If the host's shim generator *replaces* the previous version instead of *appending*, the versioning
|
|
192
|
+
buys nothing: every bump silently breaks every already-deployed app not yet rebuilt (bare-specifier
|
|
193
|
+
resolution failure → blank container — the exact failure this whole contract prevents). "The host
|
|
194
|
+
serves all versions while apps migrate" is not aspirational; it's a hard requirement of the host.
|
|
195
|
+
|
|
196
|
+
**Retiring a version:** only remove `/sl-shared/vN/` once no installed app still declares that
|
|
197
|
+
`meta.sharedDependencies` version. You can determine that from the app registry (each app's declared
|
|
198
|
+
version × where it's installed); until it's provably unreferenced, keep it. Prefer a long deprecation
|
|
199
|
+
window over reclaiming a few KB.
|
|
200
|
+
|
|
201
|
+
(The same rule applies to any versioned CSS-baseline paths — additive, never delete a live version.)
|
package/docs/API_SUMMARY.md
CHANGED
package/docs/deploying-apps.md
CHANGED
|
@@ -236,14 +236,24 @@ today.)
|
|
|
236
236
|
|
|
237
237
|
---
|
|
238
238
|
|
|
239
|
-
## Wiring it into your build
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
## Wiring it into your build (the KEYED path — CI / controlled env / beta·stable)
|
|
240
|
+
|
|
241
|
+
> ⚠️ **This is the deploy-key path — not the default for a Lovable dev publish.** If you build in
|
|
242
|
+
> Lovable (no deploy key in the build), your dev publishes register via the **key-free `refresh-dev`
|
|
243
|
+
> ping** in **[Section A](#a-from-lovable--hit-publish-no-key-anywhere-recommended-for-lovable-apps)** — put *that* in `postbuild`, not the
|
|
244
|
+
> binary below. Reach for `smartlinks-register-release` only where you (a) hold a deploy key and
|
|
245
|
+
> (b) set `SMARTLINKS_CHANNEL` — i.e. a controlled dev/CI environment, or a formal **beta/stable**
|
|
246
|
+
> deploy. In a keyless Lovable postbuild this binary **skips silently** (no channel ⇒ no-op), so a
|
|
247
|
+
> dev publish would register *nothing* — that's the trap. One rule: **dev publish → `refresh-dev`;
|
|
248
|
+
> keyed/formal deploy → `register-release`.**
|
|
249
|
+
|
|
250
|
+
Registration is the **last step of a keyed build** — after bundles are built and hashed. Run a
|
|
242
251
|
small script that reads your built manifest and POSTs it, and **exits non-zero on failure**
|
|
243
252
|
so a bad install fails the publish.
|
|
244
253
|
|
|
245
|
-
The SDK ships the script, so you don't copy-paste it — run it as your postbuild step
|
|
246
|
-
your built manifest, POSTs it, prints any warnings, and exits non-zero on
|
|
254
|
+
The SDK ships the script, so you don't copy-paste it — run it as your postbuild step **in a keyed
|
|
255
|
+
environment**. It reads your built manifest, POSTs it, prints any warnings, and exits non-zero on
|
|
256
|
+
failure.
|
|
247
257
|
|
|
248
258
|
```jsonc
|
|
249
259
|
// package.json
|
|
@@ -266,13 +276,16 @@ It is driven entirely by env vars, so the same command works for dev (Lovable) a
|
|
|
266
276
|
|
|
267
277
|
> The full source is at `scripts/register-release.mjs` in the SDK package if you'd rather vendor it.
|
|
268
278
|
|
|
269
|
-
Registration is gated by **`SMARTLINKS_CHANNEL`**, so
|
|
279
|
+
Registration is gated by **`SMARTLINKS_CHANNEL`**, so a keyed build behaves correctly by intent:
|
|
270
280
|
|
|
271
281
|
| Build | `SMARTLINKS_CHANNEL` | Result |
|
|
272
282
|
|---|---|---|
|
|
273
|
-
| **Preview / live-edit** | unset | **skips quietly** — never registers, never fails |
|
|
274
|
-
| **
|
|
275
|
-
| **Prod (CI)** | `stable` | registers to `stable` with the prod/master key; a missing key **hard-fails** |
|
|
283
|
+
| **Preview / live-edit / plain Lovable dev publish** | unset | **skips quietly** — never registers, never fails. (A Lovable dev publish is meant to register via the key-free `refresh-dev` ping in [Section A](#a-from-lovable--hit-publish-no-key-anywhere-recommended-for-lovable-apps), not this binary.) |
|
|
284
|
+
| **Controlled dev env (you hold a dev key)** | `dev` | registers to `dev` with the dev key + your `SMARTLINKS_BUNDLE_BASE_URL` |
|
|
285
|
+
| **Prod (CI / formal deploy)** | `stable` | registers to `stable` with the prod/master key; a missing key **hard-fails** |
|
|
286
|
+
|
|
287
|
+
> The middle row is a *controlled* dev environment where you deliberately hold a dev key and set the
|
|
288
|
+
> channel — **not** a stock Lovable publish, which carries neither and so should use `refresh-dev`.
|
|
276
289
|
|
|
277
290
|
**Two secrets, two scopes:** the **deploy key** is channel-scoped and can be a *workspace-level*
|
|
278
291
|
Lovable Build Secret shared by every app (a dev key only writes `dev`, so sharing it is safe). The
|
|
@@ -178,3 +178,24 @@ if (host && host.version !== SHARED_DEPENDENCY_CONTRACT_VERSION) {
|
|
|
178
178
|
The host publishes its live contract on `window.__SMARTLINKS_SHARED__` (`{ version, specifiers }`),
|
|
179
179
|
which `getHostSharedDependencies()` reads. Import-map shim paths follow `importMapPathFor(specifier)`
|
|
180
180
|
(`/sl-shared/<version>/<slug>.js`), so both the portal and the SDK generate identical paths.
|
|
181
|
+
|
|
182
|
+
## Version retention — hosts MUST keep every published version (load-bearing)
|
|
183
|
+
|
|
184
|
+
The version in the shim path (`/sl-shared/vN/`) exists **so multiple contract versions coexist**. A
|
|
185
|
+
deployed app pins the version it was built against (`meta.sharedDependencies`) and resolves its shims
|
|
186
|
+
from that path forever. Therefore:
|
|
187
|
+
|
|
188
|
+
> **A contract bump is ADDITIVE. Generating `/sl-shared/v7/` MUST NOT delete `/sl-shared/v5/` or
|
|
189
|
+
> `/sl-shared/v6/`.** The shims are tiny re-export files — keep them.
|
|
190
|
+
|
|
191
|
+
If the host's shim generator *replaces* the previous version instead of *appending*, the versioning
|
|
192
|
+
buys nothing: every bump silently breaks every already-deployed app not yet rebuilt (bare-specifier
|
|
193
|
+
resolution failure → blank container — the exact failure this whole contract prevents). "The host
|
|
194
|
+
serves all versions while apps migrate" is not aspirational; it's a hard requirement of the host.
|
|
195
|
+
|
|
196
|
+
**Retiring a version:** only remove `/sl-shared/vN/` once no installed app still declares that
|
|
197
|
+
`meta.sharedDependencies` version. You can determine that from the app registry (each app's declared
|
|
198
|
+
version × where it's installed); until it's provably unreferenced, keep it. Prefer a long deprecation
|
|
199
|
+
window over reclaiming a few KB.
|
|
200
|
+
|
|
201
|
+
(The same rule applies to any versioned CSS-baseline paths — additive, never delete a live version.)
|