@frontfriend/sdk 1.2.2 → 1.2.4

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 CHANGED
@@ -240,7 +240,7 @@ npx frontfriend add custom/acme/data-grid --release <release-id> --dry-run
240
240
 
241
241
  Without a component or a selection flag, `frontfriend update` adopts what the App's `adopt` levels cover, in one lock: the approved contracts (`--working-design`), plus the Release tokens and the installed components (`--installed --tokens`) when the App adopts tokens or components. A contracts-only App gets `--contracts-only --working-design`. An applied adoption also writes `.frontfriend/rules/`, so `frontfriend check` reads the adopted rules.
242
242
 
243
- An applied adoption installs the npm dependencies of the components it wrote that `package.json` lacks, with the package manager your lockfile names (`--no-install` prints the command instead). It then refreshes the token cache in `node_modules/.cache/frontfriend` when the token pin moved: a running Vite dev server reloads by itself, without a restart. With `--installed --replace`, a stock shadcn file that the Design System ships under another name (`sonner.tsx` → `toast`) is replaced by the Design System component and removed, and its imports point at the new module.
243
+ An applied adoption installs the npm dependencies of the components it adds or moves to another version, with the package manager your lockfile names (`--no-install` prints the command instead). It installs a dependency that `package.json` lacks, or raises a requirement below the minimum of the declared range. It never lowers or replaces a newer requirement: ``⚠️ `lucide-react` stays at 1.17.0; `icon@1.1.0` declares ^0.468.0.`` A component whose pin does not change, or whose local edit is kept, does not impose its dependencies. If an unchanged component that you have not edited declares a package that `package.json` lacks, `update` prints the install command and does not install it. A file that already matches the incoming source is reported as unchanged and is not rewritten. `update --json` reports the install requests in `npm_dependencies.missing`, the newer requirements kept in `npm_dependencies.kept`, the packages unchanged components lack in `npm_dependencies.repair`, and `files_unchanged` and `files_kept` (local edits). It then refreshes the token cache in `node_modules/.cache/frontfriend` when the token pin moved: a running Vite dev server reloads by itself, without a restart. With `--installed --replace`, a stock shadcn file that the Design System ships under another name (`sonner.tsx` → `toast`) is replaced by the Design System component and removed, and its imports point at the new module.
244
244
 
245
245
  A private component deleted from the Design System leaves every Release. `update` removes its pin from `frontfriend.lock.json` and prints `custom/... was deleted from the design system. Its files in <path> were kept; remove them and their imports if you no longer use them.` It never deletes those files. `add` and `download` refuse a deleted component that the lock pins; `diff` and `doctor` report the pin until `update` removes it. `update --json` (with `--yes` or `--dry-run`) prints one JSON result on stdout, with the removed pins in `components_removed`.
246
246
 
@@ -326,6 +326,10 @@ npx frontfriend init --tag <tag-name-or-id>
326
326
 
327
327
  `--version` takes a Release ID, not an SDK version. A Studio refusal, such as a missing login or no access to the Design System, stops initialization.
328
328
 
329
+ After the tokens, an online `init` registers the App named in `frontfriend.config.js` on its tag (`--tag`, then `tag`) with its `framework` and `primitive`, so `update` and the design reads find it. When Studio refuses the registration, `init` stops with the reason; the installed tokens stay. During an outage it keeps the tokens and asks you to run `init` again. When the App adopts contracts and `frontfriend.lock.json` pins a design snapshot, `init` also writes that snapshot's contracts to `.frontfriend/design/` and, when they are missing or belong to another snapshot, its rules to `.frontfriend/rules/`: the same files `update` writes.
330
+
331
+ `frontfriend.lock.json` lists its contract pins by slug, then kind, and its `adoptionDigest` does not depend on the order of the pins. A lock written by an earlier SDK in another order is still valid; `update` keeps its bytes until the adoption itself changes.
332
+
329
333
  Every online `init` keeps a verified copy of the selected tokens in `.frontfriend/artifacts`. When Studio is unreachable (network failure, timeout or server error), a signed-in `init` restores that copy. A first install during an outage has no copy to restore.
330
334
 
331
335
  ### Offline tokens
@@ -340,7 +344,7 @@ npx frontfriend init --offline
340
344
 
341
345
  The default API uses the production token CDN automatically. For a custom API, set `token-cdn-url`, `FF_TOKEN_CDN_URL`, or `--token-cdn-url`. Set `token-cdn-url: false` to disable CDN delivery.
342
346
 
343
- Downloads validate artifact identity and integrity. Access refusals and invalid data stop initialization. Token delivery does not update component files, register the application, or publish changes. Run `connect` or `design sync` online for those operations. External fonts and images have their own availability.
347
+ Downloads validate artifact identity and integrity. Access refusals and invalid data stop initialization. Token delivery does not update component files or publish changes; `init --offline` also does not register the application or write contracts. Run `init`, `connect` or `design sync` online for those operations. External fonts and images have their own availability.
344
348
 
345
349
  ## CI authentication
346
350
 
@@ -3,6 +3,7 @@ import type {
3
3
  AdoptionComponent,
4
4
  AdoptionDigestLock,
5
5
  ApplicationLock,
6
+ DesignAdoption,
6
7
  } from "./application-adoption";
7
8
 
8
9
  export type {
@@ -26,6 +27,18 @@ export type ParsedApplicationLock =
26
27
 
27
28
  export function sortedObject<T>(value: Record<string, T>): Record<string, T>;
28
29
  export function adoptionDigest(lock: AdoptionDigestLock): string;
30
+ export function hasValidAdoptionDigest(lock: AdoptionDigestLock): boolean;
31
+ export function sameAdoption(
32
+ left: AdoptionDigestLock,
33
+ right: AdoptionDigestLock,
34
+ ): boolean;
35
+ export function sortContractPins<T extends { slug: string; kind: string }>(
36
+ pins: T[],
37
+ ): T[];
38
+ export function canonicalDesignAdoption<T extends DesignAdoption>(design: T): T;
39
+ export function canonicalApplicationLock<T extends AdoptionDigestLock>(
40
+ lock: T,
41
+ ): T;
29
42
  export function normalizeLock(value: unknown): ParsedApplicationLock;
30
43
  export function parseApplicationLock(content: unknown): ParsedApplicationLock;
31
44
  export function serializeApplicationLock(lock: unknown): string;
@@ -98,6 +98,13 @@ export class ApplicationAdoption {
98
98
  nextLock: ApplicationLock;
99
99
  changelogs: string[];
100
100
  npmDependencies: string[];
101
+ npmDeclarations: Array<{
102
+ component: string;
103
+ dependencies: string[];
104
+ required: boolean;
105
+ }>;
106
+ unchanged: string[];
107
+ kept: string[];
101
108
  };
102
109
  apply(plan: unknown, hooks?: Record<string, unknown>): ApplicationLock;
103
110
  }