@ucm-kit/cli 0.1.20 → 0.1.21
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 +32 -32
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,17 +5,19 @@ exported them.
|
|
|
5
5
|
|
|
6
6
|
A **UCM contract** is a JSON file describing a UI component exactly as it exists
|
|
7
7
|
in Figma: its variants, its structure, its design tokens, its usage rules. It is
|
|
8
|
-
written by the [UCM Contract
|
|
9
|
-
Figma plugin and committed
|
|
10
|
-
those files and says whether
|
|
8
|
+
written by the [UCM Contract
|
|
9
|
+
Exporter](https://github.com/Vassili-g/UCM-Exporter) Figma plugin and committed
|
|
10
|
+
next to the component's code. This command reads those files and says whether
|
|
11
|
+
they still hold together.
|
|
11
12
|
|
|
12
13
|
```sh
|
|
13
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
14
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
14
|
+
npx --yes @ucm-kit/cli@0.1.21 init
|
|
15
|
+
npx --yes @ucm-kit/cli@0.1.21 check --report ci-report.md
|
|
15
16
|
```
|
|
16
17
|
|
|
17
|
-
Pin an exact version, without `^`. A range would let npx
|
|
18
|
-
|
|
18
|
+
Pin an exact version, without `^`. A range would let npx install a build this
|
|
19
|
+
project has not tested. Two runs would then return different verdicts for the
|
|
20
|
+
same contract.
|
|
19
21
|
|
|
20
22
|
## Your repository does not have to be a Node project
|
|
21
23
|
|
|
@@ -24,8 +26,8 @@ an Android one, or a plain folder of contracts can have its exports checked. The
|
|
|
24
26
|
only requirement is Node, and in CI `setup-node` provides it.
|
|
25
27
|
|
|
26
28
|
If a `package-lock.json` happens to exist, the workflow runs `npm ci` first, so
|
|
27
|
-
that any optional stack adapter the repository installed becomes visible to
|
|
28
|
-
|
|
29
|
+
that any optional stack adapter the repository installed becomes visible to `ucm
|
|
30
|
+
check`.
|
|
29
31
|
|
|
30
32
|
## Commands
|
|
31
33
|
|
|
@@ -56,7 +58,7 @@ not write React states its own extension here, rather than carrying a `.tsx`
|
|
|
56
58
|
that was wrong the day it was installed:
|
|
57
59
|
|
|
58
60
|
```sh
|
|
59
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
61
|
+
npx --yes @ucm-kit/cli@0.1.21 init --components Sources/DesignSystem --implementation '{dir}/{id}.swift'
|
|
60
62
|
```
|
|
61
63
|
|
|
62
64
|
All three act only on a first install: `ucm init` never overwrites an existing
|
|
@@ -82,8 +84,8 @@ has one.
|
|
|
82
84
|
|
|
83
85
|
## What `ucm init` writes
|
|
84
86
|
|
|
85
|
-
Five files
|
|
86
|
-
as it is, and the command
|
|
87
|
+
Five files. The command explains each one as it writes it. An existing file is
|
|
88
|
+
kept as it is, and the command names what it left alone.
|
|
87
89
|
|
|
88
90
|
| File | Why |
|
|
89
91
|
|---|---|
|
|
@@ -97,14 +99,14 @@ The workflow is yours once written. It will never be overwritten.
|
|
|
97
99
|
|
|
98
100
|
### `ucm.config.json`
|
|
99
101
|
|
|
100
|
-
Three paths
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
Three paths. **This file is the only authority on where an export lands.** The
|
|
103
|
+
Figma plugin reads it before publishing, and `ucm check` reads it before looking
|
|
104
|
+
for contracts. A repository that arranges things differently says so here, once,
|
|
105
|
+
and both sides follow.
|
|
104
106
|
|
|
105
|
-
Its absence is the nominal case
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
Its absence is the nominal case: the defaults below apply. A repository with a
|
|
108
|
+
single `components/` folder works without writing a line. A file that exists but
|
|
109
|
+
is malformed is refused on both sides.
|
|
108
110
|
|
|
109
111
|
```json
|
|
110
112
|
{
|
|
@@ -115,8 +117,7 @@ file that exists but is malformed is refused on both sides.
|
|
|
115
117
|
```
|
|
116
118
|
|
|
117
119
|
`implementation` is a pattern with two tokens, `{dir}` for the contract's folder
|
|
118
|
-
and `{id}` for its identifier. Replace it with the pattern your repository
|
|
119
|
-
uses.
|
|
120
|
+
and `{id}` for its identifier. Replace it with the pattern your repository uses.
|
|
120
121
|
|
|
121
122
|
No version number goes in this file. Which contract versions can be read belongs
|
|
122
123
|
to the installed package, and repeating it here would create a second authority
|
|
@@ -124,17 +125,16 @@ that drifts on the first update.
|
|
|
124
125
|
|
|
125
126
|
## What the report says
|
|
126
127
|
|
|
127
|
-
The report is written for the **designer** who validates the export
|
|
128
|
-
|
|
129
|
-
it.
|
|
128
|
+
The report is written for the **designer** who validates the export. It requires
|
|
129
|
+
no CI log. Every reason a pull request is refused appears in it.
|
|
130
130
|
|
|
131
131
|
Six checks run on each contract. Four block a merge, two only warn: **a check
|
|
132
132
|
blocks when the file on disk cannot be read as it stands**, and warns when the
|
|
133
133
|
read succeeds and the gap points at the code or at the token file.
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
request
|
|
137
|
-
|
|
135
|
+
The direction of the gap names who fixes it. The CI never reads who opened the
|
|
136
|
+
pull request. A contract that is too old is re-exported; a contract that is too
|
|
137
|
+
new needs this package upgraded, which no re-export replaces.
|
|
138
138
|
[`@ucm-kit/core`](https://www.npmjs.com/package/@ucm-kit/core) names both
|
|
139
139
|
directions.
|
|
140
140
|
|
|
@@ -149,18 +149,18 @@ directions.
|
|
|
149
149
|
|
|
150
150
|
A gap with the code needs a developer, so it warns and lets the merge through. A
|
|
151
151
|
token removed from the design system does too: tokens are the source of truth,
|
|
152
|
-
|
|
152
|
+
so an older contract does not hold back their evolution. A token file that is
|
|
153
153
|
absent or unreadable is another matter: no reference can be resolved at all, so
|
|
154
154
|
the check gives up rather than reporting every path as missing.
|
|
155
155
|
|
|
156
156
|
A contract may land before the code that implements it. A missing implementation
|
|
157
|
-
is an allowed
|
|
157
|
+
is an allowed stage of the work.
|
|
158
158
|
|
|
159
159
|
**So is a repository with no contract at all.** Right after `ucm init` nothing
|
|
160
160
|
has been exported: there is no token file, and usually no contract folder. From
|
|
161
161
|
`0.1.10` on, `ucm check` returns 0 there and reports what to do next. The number
|
|
162
162
|
of contracts decides: with one or more, a missing token file blocks the merge
|
|
163
|
-
again, because those contracts cite tokens
|
|
163
|
+
again, because those contracts cite tokens that cannot be resolved.
|
|
164
164
|
|
|
165
165
|
The report also relays two things it does not measure itself: the warnings the
|
|
166
166
|
export wrote into the contract, and the verdict of the repository's own tests
|
|
@@ -169,8 +169,8 @@ when an orchestrator passes it in through `UCM_ECHECS_DE_TESTS`.
|
|
|
169
169
|
## Optional stack adapters
|
|
170
170
|
|
|
171
171
|
The first five checks above read contracts and tokens only, so they work
|
|
172
|
-
whatever the repository is written in. Comparing a contract to real code needs
|
|
173
|
-
code, which is a stack adapter's job.
|
|
172
|
+
whatever the repository is written in. Comparing a contract to real code needs
|
|
173
|
+
to read that code, which is a stack adapter's job.
|
|
174
174
|
|
|
175
175
|
`ucm check` discovers an adapter installed **by the repository**, resolving from
|
|
176
176
|
the checked root rather than from the npx cache. Install
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ucm-kit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "La ligne de commande UCM : initialiser un repository, lister ce qu'il doit couvrir.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,6 +27,6 @@
|
|
|
27
27
|
"test": "node scripts/run-tests.cjs"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@ucm-kit/core": "0.1.
|
|
30
|
+
"@ucm-kit/core": "0.1.22"
|
|
31
31
|
}
|
|
32
32
|
}
|