@biffo/cli 0.428.0 → 0.430.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/_skeletons/plugin-template/scripts/biffo.sh +16 -2
- package/_skeletons/plugin-template/web-admin/package.json +1 -1
- package/_skeletons/plugin-template/web-admin/pnpm-lock.yaml +6 -5
- package/_skeletons/plugin-template/web-admin/src/App.tsx +63 -12
- package/_skeletons/plugin-template/web-admin/src/index.css +17 -24
- package/_skeletons/sibling-template/scripts/biffo.sh +16 -2
- package/package.json +1 -1
|
@@ -107,8 +107,22 @@ if [ -f biffo.core.json ]; then
|
|
|
107
107
|
# The committed record first. Falls through to the working tree when there is
|
|
108
108
|
# no HEAD yet (a fresh `biffo init`, before the first commit) or when the file
|
|
109
109
|
# is newly added and not yet in any commit.
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
#
|
|
111
|
+
# While a merge is in progress HEAD is the branch being merged INTO, so its
|
|
112
|
+
# pin is the old branch's. Read the index instead so the merged-in pin runs;
|
|
113
|
+
# otherwise a conflict resolution on an older PR is judged by a CLI that
|
|
114
|
+
# predates the merge-aware ownership guard and refuses every merged-in file.
|
|
115
|
+
# Empty when the index carries no biffo.core.json, then HEAD's is used.
|
|
116
|
+
version=''
|
|
117
|
+
if git rev-parse -q --verify MERGE_HEAD >/dev/null 2>&1; then
|
|
118
|
+
version=$(git show :biffo.core.json 2>/dev/null |
|
|
119
|
+
node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).version" 2>/dev/null || echo '')
|
|
120
|
+
[ "$version" = 'undefined' ] && version=''
|
|
121
|
+
fi
|
|
122
|
+
if [ -z "$version" ]; then
|
|
123
|
+
version=$(git show HEAD:biffo.core.json 2>/dev/null |
|
|
124
|
+
node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).version" 2>/dev/null || echo '')
|
|
125
|
+
fi
|
|
112
126
|
if [ -z "$version" ] || [ "$version" = 'undefined' ]; then
|
|
113
127
|
version=$(node -p "require('./biffo.core.json').version" 2>/dev/null || echo '')
|
|
114
128
|
fi
|
|
@@ -16,8 +16,8 @@ importers:
|
|
|
16
16
|
.:
|
|
17
17
|
dependencies:
|
|
18
18
|
'@biffo/design-tokens':
|
|
19
|
-
specifier: ^0.
|
|
20
|
-
version: 0.
|
|
19
|
+
specifier: ^0.427.0
|
|
20
|
+
version: 0.427.0
|
|
21
21
|
amazon-cognito-identity-js:
|
|
22
22
|
specifier: ^6.3.12
|
|
23
23
|
version: 6.3.20
|
|
@@ -184,8 +184,9 @@ packages:
|
|
|
184
184
|
resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==}
|
|
185
185
|
engines: {node: '>=6.9.0'}
|
|
186
186
|
|
|
187
|
-
'@biffo/design-tokens@0.
|
|
188
|
-
resolution: {integrity: sha512-
|
|
187
|
+
'@biffo/design-tokens@0.427.0':
|
|
188
|
+
resolution: {integrity: sha512-3OjpF0hYAlg3k7ez/25LrkDVz+wgpx1mwaRhVkAtG0XEj0cfNhJ3In9Nk5XCh3JBy7HaIYn9tuILmXmIDYIS6w==}
|
|
189
|
+
hasBin: true
|
|
189
190
|
|
|
190
191
|
'@bramus/specificity@2.4.2':
|
|
191
192
|
resolution: {integrity: sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==}
|
|
@@ -1711,7 +1712,7 @@ snapshots:
|
|
|
1711
1712
|
'@babel/helper-string-parser': 7.29.7
|
|
1712
1713
|
'@babel/helper-validator-identifier': 7.29.7
|
|
1713
1714
|
|
|
1714
|
-
'@biffo/design-tokens@0.
|
|
1715
|
+
'@biffo/design-tokens@0.427.0': {}
|
|
1715
1716
|
|
|
1716
1717
|
'@bramus/specificity@2.4.2':
|
|
1717
1718
|
dependencies:
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react'
|
|
2
|
+
import { statusBadgeClass, statusLabel } from '@biffo/design-tokens/status.mjs'
|
|
2
3
|
|
|
3
4
|
import { getCurrentSession } from './lib/auth'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Starter admin surface. It proves the SHARED-SESSION INVARIANT works — reads
|
|
7
|
-
* the portal's Cognito session, shows a signed-in/signed-out state
|
|
8
|
-
*
|
|
8
|
+
* the portal's Cognito session, shows a signed-in/signed-out state — and shows
|
|
9
|
+
* the shared kit's controls (heading, primary button, status badge, delete with
|
|
10
|
+
* an in-page confirm). Replace the sample row with this plugin's own admin UI.
|
|
11
|
+
*
|
|
12
|
+
* Style with the kit's `biffo-*` classes (see @biffo/design-tokens/kit.css),
|
|
13
|
+
* never `window.confirm` and never local colour/font overrides.
|
|
9
14
|
*
|
|
10
15
|
* Wire real screens against `./lib/api`'s starter `request()` helper, which
|
|
11
16
|
* already carries the `Authorization: Bearer` header and error handling this
|
|
@@ -13,6 +18,8 @@ import { getCurrentSession } from './lib/auth'
|
|
|
13
18
|
*/
|
|
14
19
|
export default function App() {
|
|
15
20
|
const [signedIn, setSignedIn] = useState<boolean | null>(null)
|
|
21
|
+
const [confirming, setConfirming] = useState(false)
|
|
22
|
+
const [deleted, setDeleted] = useState(false)
|
|
16
23
|
|
|
17
24
|
useEffect(() => {
|
|
18
25
|
let cancelled = false
|
|
@@ -27,23 +34,67 @@ export default function App() {
|
|
|
27
34
|
|
|
28
35
|
if (signedIn === false) {
|
|
29
36
|
return (
|
|
30
|
-
<main className="
|
|
31
|
-
<h1>example-plugin — Admin</h1>
|
|
32
|
-
<p
|
|
37
|
+
<main className="biffo-kit layout">
|
|
38
|
+
<h1 className="biffo-heading">example-plugin — Admin</h1>
|
|
39
|
+
<p role="alert" className="biffo-badge biffo-badge--negative">
|
|
40
|
+
Not signed in. Open this from the Biffo portal.
|
|
41
|
+
</p>
|
|
33
42
|
</main>
|
|
34
43
|
)
|
|
35
44
|
}
|
|
36
45
|
|
|
37
46
|
return (
|
|
38
|
-
<main className="
|
|
39
|
-
<h1>example-plugin — Admin</h1>
|
|
47
|
+
<main className="biffo-kit layout">
|
|
48
|
+
<h1 className="biffo-heading">example-plugin — Admin</h1>
|
|
40
49
|
{signedIn === null ? (
|
|
41
|
-
<p
|
|
50
|
+
<p>Loading…</p>
|
|
42
51
|
) : (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
<>
|
|
53
|
+
<p>
|
|
54
|
+
Signed in via the shared portal session. Replace this screen with the plugin's own admin
|
|
55
|
+
UI.
|
|
56
|
+
</p>
|
|
57
|
+
{deleted ? (
|
|
58
|
+
<p>Sample item deleted.</p>
|
|
59
|
+
) : (
|
|
60
|
+
<div className="row">
|
|
61
|
+
<span>Sample item</span>
|
|
62
|
+
<span className={statusBadgeClass('active')}>{statusLabel('active')}</span>
|
|
63
|
+
<button type="button" className="biffo-btn-primary">
|
|
64
|
+
Edit
|
|
65
|
+
</button>
|
|
66
|
+
{confirming ? (
|
|
67
|
+
<span className="biffo-confirm">
|
|
68
|
+
<span className="biffo-confirm__prompt">
|
|
69
|
+
Delete this item? This action cannot be undone.
|
|
70
|
+
</span>
|
|
71
|
+
<button
|
|
72
|
+
type="button"
|
|
73
|
+
className="biffo-btn-delete biffo-confirm__yes"
|
|
74
|
+
onClick={() => setDeleted(true)}
|
|
75
|
+
>
|
|
76
|
+
Delete
|
|
77
|
+
</button>
|
|
78
|
+
<button
|
|
79
|
+
type="button"
|
|
80
|
+
className="biffo-confirm__no"
|
|
81
|
+
onClick={() => setConfirming(false)}
|
|
82
|
+
>
|
|
83
|
+
Cancel
|
|
84
|
+
</button>
|
|
85
|
+
</span>
|
|
86
|
+
) : (
|
|
87
|
+
<button
|
|
88
|
+
type="button"
|
|
89
|
+
className="biffo-btn-delete"
|
|
90
|
+
onClick={() => setConfirming(true)}
|
|
91
|
+
>
|
|
92
|
+
Delete
|
|
93
|
+
</button>
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
</>
|
|
47
98
|
)}
|
|
48
99
|
</main>
|
|
49
100
|
)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/* Look comes from the shared kit (#2495): headings, buttons, delete, status
|
|
2
|
+
badges and the in-page confirm are the kit's classes. Do not add local
|
|
3
|
+
colour, font, heading or button overrides here; change the kit instead.
|
|
4
|
+
tokens.css must load before kit.css. */
|
|
4
5
|
@import '@biffo/design-tokens/tokens.css';
|
|
6
|
+
@import '@biffo/design-tokens/kit.css';
|
|
5
7
|
|
|
6
8
|
* {
|
|
7
9
|
box-sizing: border-box;
|
|
@@ -9,32 +11,23 @@
|
|
|
9
11
|
|
|
10
12
|
body {
|
|
11
13
|
margin: 0;
|
|
12
|
-
font-family: var(--font-sans, system-ui, sans-serif);
|
|
13
|
-
color: var(--text, #1b1c1f);
|
|
14
|
-
background: var(--bg, #f7f8fa);
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
/* Layout only. */
|
|
17
|
+
.layout {
|
|
18
|
+
min-height: 100vh;
|
|
20
19
|
padding: 2rem 1.5rem 4rem;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
margin:
|
|
22
|
+
.layout > * {
|
|
23
|
+
max-width: 80rem;
|
|
24
|
+
margin-left: auto;
|
|
25
|
+
margin-right: auto;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
.error {
|
|
35
|
-
background: var(--state-negative-soft, #fdeaea);
|
|
36
|
-
color: var(--state-negative, #8c2b2b);
|
|
37
|
-
padding: 0.6rem 0.8rem;
|
|
38
|
-
border-radius: 6px;
|
|
39
|
-
font-size: 0.9rem;
|
|
28
|
+
.row {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: 0.75rem;
|
|
32
|
+
margin: 0.75rem auto;
|
|
40
33
|
}
|
|
@@ -107,8 +107,22 @@ if [ -f biffo.core.json ]; then
|
|
|
107
107
|
# The committed record first. Falls through to the working tree when there is
|
|
108
108
|
# no HEAD yet (a fresh `biffo init`, before the first commit) or when the file
|
|
109
109
|
# is newly added and not yet in any commit.
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
#
|
|
111
|
+
# While a merge is in progress HEAD is the branch being merged INTO, so its
|
|
112
|
+
# pin is the old branch's. Read the index instead so the merged-in pin runs;
|
|
113
|
+
# otherwise a conflict resolution on an older PR is judged by a CLI that
|
|
114
|
+
# predates the merge-aware ownership guard and refuses every merged-in file.
|
|
115
|
+
# Empty when the index carries no biffo.core.json, then HEAD's is used.
|
|
116
|
+
version=''
|
|
117
|
+
if git rev-parse -q --verify MERGE_HEAD >/dev/null 2>&1; then
|
|
118
|
+
version=$(git show :biffo.core.json 2>/dev/null |
|
|
119
|
+
node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).version" 2>/dev/null || echo '')
|
|
120
|
+
[ "$version" = 'undefined' ] && version=''
|
|
121
|
+
fi
|
|
122
|
+
if [ -z "$version" ]; then
|
|
123
|
+
version=$(git show HEAD:biffo.core.json 2>/dev/null |
|
|
124
|
+
node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).version" 2>/dev/null || echo '')
|
|
125
|
+
fi
|
|
112
126
|
if [ -z "$version" ] || [ "$version" = 'undefined' ]; then
|
|
113
127
|
version=$(node -p "require('./biffo.core.json').version" 2>/dev/null || echo '')
|
|
114
128
|
fi
|