@bridge-ds/core 0.20.0 → 0.21.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/audit/index.js +275 -52
- package/dist/audit/index.js.map +1 -1
- package/dist/audit/missing-pieces.d.ts +4 -0
- package/dist/component-spec.d.ts +13 -0
- package/dist/exploration-done-github.d.ts +50 -0
- package/dist/exploration-resume.d.ts +136 -0
- package/dist/explorations-github.d.ts +75 -3
- package/dist/explorations.d.ts +137 -8
- package/dist/figma-fix-loop.d.ts +1 -1
- package/dist/figma-fixes.d.ts +14 -2
- package/dist/github-client.d.ts +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1708 -1283
- package/dist/index.js.map +1 -1
- package/dist/measured-only.d.ts +13 -1
- package/dist/node/index.js +11 -11
- package/dist/previews-github.d.ts +13 -0
- package/dist/previews.d.ts +8 -1
- package/dist/{prod-branch-CJZwMfVD.js → prod-branch-C7tphFAA.js} +255 -192
- package/dist/prod-branch-C7tphFAA.js.map +1 -0
- package/dist/prod-branch-github.d.ts +54 -4
- package/dist/prod-branch.d.ts +42 -1
- package/dist/products.d.ts +17 -0
- package/dist/{repo-source-CshjjC7x.js → repo-source-CEBBBtm1.js} +2165 -1998
- package/dist/repo-source-CEBBBtm1.js.map +1 -0
- package/dist/{report-CE-jHAuw.js → report-B7wNAnSu.js} +38 -38
- package/dist/{report-CE-jHAuw.js.map → report-B7wNAnSu.js.map} +1 -1
- package/dist/review-gate.d.ts +1 -1
- package/dist/try-in-product.d.ts +4 -1
- package/package.json +1 -1
- package/dist/prod-branch-CJZwMfVD.js.map +0 -1
- package/dist/repo-source-CshjjC7x.js.map +0 -1
|
@@ -86,6 +86,12 @@ export interface OpenLibraryBranchInput {
|
|
|
86
86
|
* the token only needs Issues write. Callers pass changesMode(config), or an explicit choice.
|
|
87
87
|
*/
|
|
88
88
|
mode?: ChangesMode | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* The design system repository, when the product branch lives in the product's own repository (`gh` reads that
|
|
91
|
+
* one): the library side (request, suggestion, library exploration) is opened here, and the product branch keeps the
|
|
92
|
+
* link. Its preview cannot be merged across repositories, so `usePreview` does nothing then.
|
|
93
|
+
*/
|
|
94
|
+
library?: GitHubClient | undefined;
|
|
89
95
|
}
|
|
90
96
|
/** What writeTokens returns: the pull request it opened, or the suggestion it filed. */
|
|
91
97
|
export type LibraryTokenWrite = {
|
|
@@ -107,7 +113,7 @@ export interface OpenedLibraryBranch {
|
|
|
107
113
|
warnings: string[];
|
|
108
114
|
}
|
|
109
115
|
/** The product branch as the library side names it. */
|
|
110
|
-
export declare function productBranchRef(pull: Pick<Pull, 'number' | 'title' | 'headRef' | 'url' | 'author' | 'body'>, product: ProductConfig): ProductBranchRef;
|
|
116
|
+
export declare function productBranchRef(pull: Pick<Pull, 'number' | 'title' | 'headRef' | 'url' | 'author' | 'body'>, product: ProductConfig, repo?: string): ProductBranchRef;
|
|
111
117
|
/**
|
|
112
118
|
* Opens the library side of a missing piece and links both ways: the library branch (or request) says "Needed by" the
|
|
113
119
|
* product branch and carries the `needed-by-product` label; the product branch records the link. A token piece opens a
|
|
@@ -134,11 +140,17 @@ export interface ProductBranchView {
|
|
|
134
140
|
/** Pieces with no library branch yet. */
|
|
135
141
|
open: MissingPiece[];
|
|
136
142
|
}
|
|
137
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* Where one linked library branch stands, and what its preview means for the product branch. `gh` reads the library
|
|
145
|
+
* side. `opts.across`: the product branch lives in the product's own repository, so the library change reaches it as
|
|
146
|
+
* an npm release, never by a merge: nothing is compared across the two repositories.
|
|
147
|
+
*/
|
|
138
148
|
export declare function linkedLibraryBranchOnGitHub(gh: GitHubClient, link: LibraryLink, product: {
|
|
139
149
|
headSha: string;
|
|
140
150
|
baseRef: string;
|
|
141
|
-
}, piece?: MissingPiece
|
|
151
|
+
}, piece?: MissingPiece, opts?: {
|
|
152
|
+
across?: boolean;
|
|
153
|
+
}): Promise<LinkedLibraryBranch>;
|
|
142
154
|
/**
|
|
143
155
|
* Everything a product branch page shows: the record, the sentence, and each linked library branch with its status,
|
|
144
156
|
* its reviewers and what its preview means for the product branch. A few reads per linked branch.
|
|
@@ -146,7 +158,8 @@ export declare function linkedLibraryBranchOnGitHub(gh: GitHubClient, link: Libr
|
|
|
146
158
|
export declare function productBranchViewOnGitHub(gh: GitHubClient, pr: number, opts: {
|
|
147
159
|
products: readonly ProductConfig[];
|
|
148
160
|
viewer?: string | null | undefined;
|
|
149
|
-
agentName?: string | undefined;
|
|
161
|
+
agentName?: string | undefined; /** The design system repository, when `gh` reads a product's own one: its requests and library branches are read there. */
|
|
162
|
+
library?: GitHubClient | undefined;
|
|
150
163
|
}): Promise<ProductBranchView>;
|
|
151
164
|
/**
|
|
152
165
|
* "Switch to the published version": once the library branch shipped, main comes into the product branch (GitHub's
|
|
@@ -157,4 +170,41 @@ export declare function switchToPublishedOnGitHub(gh: GitHubClient, pr: number):
|
|
|
157
170
|
status: 'switched' | 'up-to-date';
|
|
158
171
|
said: string;
|
|
159
172
|
}>;
|
|
173
|
+
export interface ProposedPieces {
|
|
174
|
+
/** Requests filed now, one per ticked piece (number 0 in a dry run). */
|
|
175
|
+
proposed: {
|
|
176
|
+
piece: string;
|
|
177
|
+
title: string;
|
|
178
|
+
number: number;
|
|
179
|
+
url: string;
|
|
180
|
+
}[];
|
|
181
|
+
/** Ticked pieces that already have a library side: never sent twice. */
|
|
182
|
+
already: {
|
|
183
|
+
piece: string;
|
|
184
|
+
number: number;
|
|
185
|
+
}[];
|
|
186
|
+
/** Ticked ids the record does not know. */
|
|
187
|
+
unknown: string[];
|
|
188
|
+
warnings: string[];
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* "Done exploring", the library side: each piece the designer ticks becomes a request for the DS lead (the request
|
|
192
|
+
* mechanism of requests.ts, labeled `needed-by-product`, with the "Needed by" block and the exploration's preview
|
|
193
|
+
* link), and the exploration records the link so it is never sent twice. Unticked pieces are not proposed. A branch
|
|
194
|
+
* outside any product (a library exploration) is named after the library.
|
|
195
|
+
*/
|
|
196
|
+
export declare function proposePiecesOnGitHub(gh: GitHubClient, pr: number, input: {
|
|
197
|
+
pieces: readonly string[];
|
|
198
|
+
products: readonly ProductConfig[];
|
|
199
|
+
previewUrl?: string | null | undefined;
|
|
200
|
+
openedBy?: string | undefined;
|
|
201
|
+
agent?: string | undefined;
|
|
202
|
+
source?: RequestSource | undefined;
|
|
203
|
+
dryRun?: boolean | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* The design system repository, when the exploration lives in a product's own repository (`gh` reads that one):
|
|
206
|
+
* the requests are filed there, where the DS lead works, and link back to the product pull request as owner/name#n.
|
|
207
|
+
*/
|
|
208
|
+
library?: GitHubClient | undefined;
|
|
209
|
+
}): Promise<ProposedPieces>;
|
|
160
210
|
export {};
|
package/dist/prod-branch.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { TokenEdit } from './token-edits';
|
|
|
6
6
|
/** What the library lacks: a token value, a variant of an existing component, or a component. */
|
|
7
7
|
export type PieceKind = 'token' | 'variant' | 'component';
|
|
8
8
|
/** What a variant changes on its component, in designer words. */
|
|
9
|
-
export type PieceAspect = 'tone' | 'shape' | 'size' | 'style';
|
|
9
|
+
export type PieceAspect = 'tone' | 'shape' | 'size' | 'style' | 'state';
|
|
10
10
|
export interface PieceValue {
|
|
11
11
|
/** Audit category: color, radius, spacing... */
|
|
12
12
|
category: string;
|
|
@@ -14,7 +14,11 @@ export interface PieceValue {
|
|
|
14
14
|
property?: string | undefined;
|
|
15
15
|
/** As written: "#c2410c", "10px". */
|
|
16
16
|
value: string;
|
|
17
|
+
/** The part of the component the value lands on, in plain words: "icon" for `.wishlist svg`. */
|
|
18
|
+
part?: string | undefined;
|
|
17
19
|
}
|
|
20
|
+
/** How a request names a value: "fill (icon)", "background-color", "color". */
|
|
21
|
+
export declare const pieceValueField: (v: PieceValue) => string;
|
|
18
22
|
export interface PieceNearest {
|
|
19
23
|
/** Token path of the closest library value: color.feedback.danger.bg. */
|
|
20
24
|
token: string;
|
|
@@ -46,6 +50,15 @@ export interface MissingPiece {
|
|
|
46
50
|
file: string;
|
|
47
51
|
line: number;
|
|
48
52
|
}[];
|
|
53
|
+
/**
|
|
54
|
+
* Set when the branch restyles a library component from outside (its CSS or style, through a class or a state
|
|
55
|
+
* selector) using only tokens or keywords: no hand-picked value, but a look or a state the component lacks. Pieces
|
|
56
|
+
* built from hand-picked values leave it out.
|
|
57
|
+
*/
|
|
58
|
+
restyle?: {
|
|
59
|
+
state?: string | undefined;
|
|
60
|
+
selector: string;
|
|
61
|
+
} | undefined;
|
|
49
62
|
/** Token pieces: the token the library branch would add (one value, every file the closest token lives in). */
|
|
50
63
|
token?: {
|
|
51
64
|
path: string;
|
|
@@ -71,6 +84,11 @@ export interface LibraryLink {
|
|
|
71
84
|
agent?: string | undefined;
|
|
72
85
|
/** ISO date. */
|
|
73
86
|
at: string;
|
|
87
|
+
/**
|
|
88
|
+
* "owner/name" of the design system repository, when the product branch lives in the product's own repository:
|
|
89
|
+
* "#12" alone would point at the product's own issue 12 there.
|
|
90
|
+
*/
|
|
91
|
+
repo?: string | undefined;
|
|
74
92
|
}
|
|
75
93
|
/** What the product branch body keeps: the last check and the library branches opened for its pieces. */
|
|
76
94
|
export interface PiecesRecord {
|
|
@@ -117,6 +135,13 @@ export interface NeededBy {
|
|
|
117
135
|
/** The closest thing the library has today, so a reviewer can suggest it instead: "danger". */
|
|
118
136
|
nearest?: string | undefined;
|
|
119
137
|
nearestToken?: string | undefined;
|
|
138
|
+
/** Its value, as the audit resolved it: "#c3184c". */
|
|
139
|
+
nearestValue?: string | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* "owner/name" when the product branch lives in the product's own repository: the request is filed in the design
|
|
142
|
+
* system repository, so "#12" alone would point at the wrong pull request there.
|
|
143
|
+
*/
|
|
144
|
+
repo?: string | undefined;
|
|
120
145
|
}
|
|
121
146
|
/** "Needed by" for a library branch body: one line people read, one hidden block tools read. */
|
|
122
147
|
export declare function neededBySection(n: NeededBy): string;
|
|
@@ -131,6 +156,8 @@ export interface ProductBranchRef {
|
|
|
131
156
|
productKey: string;
|
|
132
157
|
productName: string;
|
|
133
158
|
author?: string | undefined;
|
|
159
|
+
/** "owner/name" when the product branch lives in the product's own repository (not the design system one). */
|
|
160
|
+
repo?: string | undefined;
|
|
134
161
|
}
|
|
135
162
|
export type LibraryBranchPlan = {
|
|
136
163
|
kind: 'token-change';
|
|
@@ -163,6 +190,20 @@ export declare function libraryBranchPlan(piece: MissingPiece, branch: ProductBr
|
|
|
163
190
|
requestedBy?: string | undefined;
|
|
164
191
|
mode?: ChangesMode | undefined;
|
|
165
192
|
}): LibraryBranchPlan;
|
|
193
|
+
/**
|
|
194
|
+
* The request a piece becomes when a designer says "Done exploring" and ticks it: always a request (an issue), never a
|
|
195
|
+
* branch, so the DS lead decides on it first. A token is asked for beside the closest token, a variant on its
|
|
196
|
+
* component, a new component as one. The summary links the exploration's preview, so the DS lead sees the piece in
|
|
197
|
+
* context. The "Needed by" block (withNeededBy, the plan's `neededBy`) goes on the issue too.
|
|
198
|
+
*/
|
|
199
|
+
export declare function pieceRequest(piece: MissingPiece, branch: ProductBranchRef, opts?: {
|
|
200
|
+
previewUrl?: string | null | undefined;
|
|
201
|
+
source?: ComponentChangeRequest['source'];
|
|
202
|
+
requestedBy?: string | undefined;
|
|
203
|
+
}): {
|
|
204
|
+
request: ComponentChangeRequest;
|
|
205
|
+
neededBy: NeededBy;
|
|
206
|
+
};
|
|
166
207
|
export type LinkStatusKey = 'draft' | 'in-review' | 'changes' | 'approved' | 'shipped' | 'closed' | 'exploring' | 'requested' | 'in-progress' | 'done' | 'declined' | 'outdated';
|
|
167
208
|
export interface LinkStatus {
|
|
168
209
|
key: LinkStatusKey;
|
package/dist/products.d.ts
CHANGED
|
@@ -59,6 +59,23 @@ export declare function productForPlace(products: readonly ProductConfig[], plac
|
|
|
59
59
|
product: ProductConfig;
|
|
60
60
|
how: 'repo' | 'path' | 'default';
|
|
61
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* The repository an exploration for this product is created in: the product's own repository when the team connected
|
|
64
|
+
* one (`repo`, other than the design system repository), so developers check the branch out in their own
|
|
65
|
+
* environment and get the library from npm. Null otherwise (a product folder of the design system repository, the
|
|
66
|
+
* library itself, the demo workspace): the exploration then lives in the design system repository.
|
|
67
|
+
*/
|
|
68
|
+
export declare function productRepoOf(p: ProductConfig | null | undefined, designSystemRepo: string | null | undefined): string | null;
|
|
69
|
+
/**
|
|
70
|
+
* The products whose explorations live in their own repository (productRepoOf), each with that repository, one entry
|
|
71
|
+
* per repository (the first product listed wins when two share one). Lists read each of them once.
|
|
72
|
+
*/
|
|
73
|
+
export declare function productRepos(products: readonly ProductConfig[], designSystemRepo: string | null | undefined): {
|
|
74
|
+
product: ProductConfig;
|
|
75
|
+
repo: string;
|
|
76
|
+
}[];
|
|
77
|
+
/** The product whose own repository is `repo` ("owner/name", any case), or undefined (the design system repository). */
|
|
78
|
+
export declare function productOfRepo(products: readonly ProductConfig[], repo: string | null | undefined, designSystemRepo?: string | null | undefined): ProductConfig | undefined;
|
|
62
79
|
/** What is wrong with a `products` value, each problem saying how to fix it. Empty: valid (or absent). */
|
|
63
80
|
export declare function productProblems(raw: unknown): string[];
|
|
64
81
|
/** Whether two product lists say the same thing (toConfigJson leaves the default list out). */
|