Skip to content

Commit 4efcf00

Browse files
chore: add dotns-ui as packages/ui (#24)
## Description ## Type - [ ] Bug fix - [ ] Feature - [ ] Breaking change - [ ] Documentation - [x] Chore ## Package - [ ] `@dotns/cli` - [x] `@dotns/ui` - [ ] Root/monorepo - [ ] Documentation ## Related Issues ## Fixes ## Checklist ### Code - [ ] Follows project style - [x] `bun run lint` passes - [x] `bun run format` passes - [x] `bun run typecheck` passes ### Documentation - [ ] README updated if needed - [ ] Types updated if needed ### Breaking Changes - [ ] No breaking changes - [ ] Breaking changes documented below **Breaking changes:** ## Testing How to test: 1. 2. ## Notes --------- Co-authored-by: Siphamandla Mjoli <siphamandla@parity.io>
1 parent 2ee7ce9 commit 4efcf00

File tree

200 files changed

+31607
-376
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+31607
-376
lines changed

.github/actions/bulletin/action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ runs:
4343
- name: Authorize account for Bulletin
4444
shell: bash
4545
run: |
46-
echo "::add-mask::$MNEMONIC"
46+
echo "::add-mask::$DOTNS_MNEMONIC"
4747
48-
ADDRESS=$(dotns account address --mnemonic "$MNEMONIC")
48+
ADDRESS=$(dotns account address)
4949
5050
echo "Authorizing ${ADDRESS} for Bulletin TransactionStorage..."
5151
52-
ARGS=("$ADDRESS" --json --mnemonic "$MNEMONIC")
52+
ARGS=("$ADDRESS" --json)
5353
[[ -n "$BULLETIN_RPC" ]] && ARGS+=(--bulletin-rpc "$BULLETIN_RPC")
5454
5555
OUTPUT=$(dotns bulletin authorize "${ARGS[@]}" 2>&1) || {
@@ -61,16 +61,16 @@ runs:
6161
fi
6262
}
6363
env:
64-
MNEMONIC: ${{ inputs.mnemonic }}
64+
DOTNS_MNEMONIC: ${{ inputs.mnemonic }}
6565
BULLETIN_RPC: ${{ inputs.bulletin-rpc }}
6666

6767
- name: Upload to Bulletin
6868
id: upload
6969
shell: bash
7070
run: |
71-
echo "::add-mask::$MNEMONIC"
71+
echo "::add-mask::$DOTNS_MNEMONIC"
7272
73-
ARGS=("$BUILD_PATH" --json --mnemonic "$MNEMONIC")
73+
ARGS=("$BUILD_PATH" --json)
7474
[[ -n "$BULLETIN_RPC" ]] && ARGS+=(--bulletin-rpc "$BULLETIN_RPC")
7575
[[ "$PARALLEL" == "true" ]] && ARGS+=(--parallel --concurrency "$UPLOAD_CONCURRENCY")
7676
@@ -97,7 +97,7 @@ runs:
9797
echo "::error::Upload failed after $MAX_RETRIES attempts"
9898
exit 1
9999
env:
100-
MNEMONIC: ${{ inputs.mnemonic }}
100+
DOTNS_MNEMONIC: ${{ inputs.mnemonic }}
101101
BULLETIN_RPC: ${{ inputs.bulletin-rpc }}
102102
BUILD_PATH: ${{ inputs.build-path }}
103103
PARALLEL: ${{ inputs.parallel }}

.github/actions/dotns/action.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ runs:
8585
if: steps.check-base.outputs.exists != 'true' && inputs.register-base == 'true'
8686
shell: bash
8787
run: |
88-
echo "::add-mask::$MNEMONIC"
88+
echo "::add-mask::$DOTNS_MNEMONIC"
8989
9090
for ATTEMPT in $(seq 1 "$MAX_RETRIES"); do
9191
echo "Register base attempt $ATTEMPT/$MAX_RETRIES"
9292
93-
if dotns register domain --name "$BASENAME" --mnemonic "$MNEMONIC" 2>&1; then
93+
if dotns register domain --name "$BASENAME" 2>&1; then
9494
echo "::notice::Base domain ${BASENAME}.dot registered"
9595
exit 0
9696
fi
@@ -112,7 +112,7 @@ runs:
112112
echo "You can also register manually at https://dotns.paseo.li"
113113
exit 1
114114
env:
115-
MNEMONIC: ${{ inputs.mnemonic }}
115+
DOTNS_MNEMONIC: ${{ inputs.mnemonic }}
116116
BASENAME: ${{ inputs.basename }}
117117
MAX_RETRIES: ${{ inputs.max-retries }}
118118
RETRY_DELAY: ${{ inputs.retry-delay }}
@@ -146,12 +146,12 @@ runs:
146146
if: inputs.mode == 'preview' && steps.check-subname.outputs.exists != 'true'
147147
shell: bash
148148
run: |
149-
echo "::add-mask::$MNEMONIC"
149+
echo "::add-mask::$DOTNS_MNEMONIC"
150150
151151
for ATTEMPT in $(seq 1 "$MAX_RETRIES"); do
152152
echo "Register subname attempt $ATTEMPT/$MAX_RETRIES"
153153
154-
OUTPUT=$(dotns register subname --name "$SUBNAME" --parent "$BASENAME" --mnemonic "$MNEMONIC" 2>&1) && {
154+
OUTPUT=$(dotns register subname --name "$SUBNAME" --parent "$BASENAME" 2>&1) && {
155155
echo "::notice::Subname ${SUBNAME}.${BASENAME}.dot registered"
156156
exit 0
157157
}
@@ -188,7 +188,7 @@ runs:
188188
echo " dotns register subname --name $SUBNAME --parent $BASENAME"
189189
exit 1
190190
env:
191-
MNEMONIC: ${{ inputs.mnemonic }}
191+
DOTNS_MNEMONIC: ${{ inputs.mnemonic }}
192192
SUBNAME: ${{ inputs.subname }}
193193
BASENAME: ${{ inputs.basename }}
194194
MAX_RETRIES: ${{ inputs.max-retries }}
@@ -197,9 +197,9 @@ runs:
197197
- name: Set contenthash
198198
shell: bash
199199
run: |
200-
echo "::add-mask::$MNEMONIC"
200+
echo "::add-mask::$DOTNS_MNEMONIC"
201201
202-
ARGS=("$DOMAIN" "$CID" --mnemonic "$MNEMONIC")
202+
ARGS=("$DOMAIN" "$CID")
203203
[[ -n "$RPC" ]] && ARGS+=(--rpc "$RPC")
204204
205205
for ATTEMPT in $(seq 1 "$MAX_RETRIES"); do
@@ -217,7 +217,7 @@ runs:
217217
echo "::error::Failed to set contenthash after $MAX_RETRIES attempts"
218218
exit 1
219219
env:
220-
MNEMONIC: ${{ inputs.mnemonic }}
220+
DOTNS_MNEMONIC: ${{ inputs.mnemonic }}
221221
DOMAIN: ${{ inputs.domain }}
222222
CID: ${{ inputs.cid }}
223223
RPC: ${{ inputs.rpc }}

.github/labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
- changed-files:
33
- any-glob-to-any-file: "packages/cli/**"
44

5+
"pkg: ui":
6+
- changed-files:
7+
- any-glob-to-any-file: "packages/ui/**"
8+
59
"scope: bulletin":
610
- changed-files:
711
- any-glob-to-any-file:

.github/labels.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
color: "c5def5"
3535
description: "@dotns/cli"
3636

37+
- name: "pkg: ui"
38+
color: "c5def5"
39+
description: "@dotns/ui"
40+
3741
- name: "P0"
3842
color: "b60205"
3943
description: "Critical priority"

.github/semantic.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"types": [
44
"feat",
55
"fix",
6+
"bug",
67
"docs",
78
"style",
89
"refactor",
@@ -14,6 +15,7 @@
1415
],
1516
"scopes": [
1617
"cli",
18+
"ui",
1719
"bulletin",
1820
"auth",
1921
"register",

.github/workflows/build-ui.yml

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
name: Build (UI)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "packages/ui/**"
8+
pull_request:
9+
branches: [main]
10+
paths:
11+
- "packages/ui/**"
12+
13+
concurrency:
14+
group: build-ui-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
permissions:
18+
contents: read
19+
pull-requests: write
20+
21+
jobs:
22+
build:
23+
name: Build (UI)
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- uses: oven-sh/setup-bun@v2
29+
with:
30+
bun-version: "1.2.6"
31+
32+
- name: Install dependencies
33+
shell: bash
34+
run: |
35+
set -euo pipefail
36+
bun install --frozen-lockfile
37+
for pkg in packages/*; do
38+
[ -f "$pkg/package.json" ] || continue
39+
grep -q '"file:' "$pkg/package.json" || continue
40+
grep -oP '"[^"]+": "file:\K[^"]+' "$pkg/package.json" | while read -r dep; do
41+
name=$(jq -r .name "$pkg/$dep/package.json")
42+
scope_dir="$pkg/node_modules/$(dirname "$name")"
43+
mkdir -p "$scope_dir"
44+
ln -sfn "$(cd "$pkg/$dep" && pwd)" "$pkg/node_modules/$name"
45+
done
46+
done
47+
48+
- name: Run build
49+
id: build
50+
continue-on-error: true
51+
working-directory: packages/ui
52+
shell: bash
53+
run: |
54+
set -o pipefail
55+
bun run build 2>&1 | tee "$GITHUB_WORKSPACE/build-ui-output.txt"
56+
57+
- name: Process results
58+
id: result
59+
shell: bash
60+
run: |
61+
set -euo pipefail
62+
if [ "${{ steps.build.outcome }}" = "success" ]; then
63+
echo "status=Passed" >> "$GITHUB_OUTPUT"
64+
echo "details=" >> "$GITHUB_OUTPUT"
65+
else
66+
echo "status=Failed" >> "$GITHUB_OUTPUT"
67+
echo "details=Build failed" >> "$GITHUB_OUTPUT"
68+
fi
69+
70+
- name: Upload build output
71+
if: always()
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: build-ui-output
75+
path: build-ui-output.txt
76+
retention-days: 7
77+
78+
- name: Upload artifacts
79+
if: steps.build.outcome == 'success'
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: ui-dist
83+
path: packages/ui/dist
84+
retention-days: 7
85+
86+
- name: Update PR comment
87+
if: github.event_name == 'pull_request'
88+
uses: actions/github-script@v7
89+
env:
90+
SECTION: Build (UI)
91+
STATUS: ${{ steps.result.outputs.status }}
92+
DETAILS: ${{ steps.result.outputs.details }}
93+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
94+
with:
95+
script: |
96+
const fs = require("fs");
97+
98+
const marker = "<!-- ci-summary -->";
99+
const detailsMarker = "<!-- details-section -->";
100+
const section = process.env.SECTION;
101+
const status = process.env.STATUS;
102+
const details = process.env.DETAILS;
103+
const runUrl = process.env.RUN_URL;
104+
105+
const { owner, repo } = context.repo;
106+
const issue_number = context.payload.pull_request.number;
107+
108+
let output = "";
109+
try {
110+
output = fs.readFileSync("build-ui-output.txt", "utf8");
111+
} catch (_) {
112+
output = "(build-ui-output.txt not found)";
113+
}
114+
115+
const MAX_CHARS = 60000;
116+
if (output.length > MAX_CHARS) {
117+
output = [
118+
"(truncated; showing last " + MAX_CHARS + " chars)",
119+
"",
120+
output.slice(-MAX_CHARS),
121+
].join("\n");
122+
}
123+
124+
const comments = await github.paginate(github.rest.issues.listComments, {
125+
owner, repo, issue_number, per_page: 100,
126+
});
127+
128+
const existing = comments.find(c =>
129+
c.user?.login === "github-actions[bot]" && c.body?.includes(marker)
130+
);
131+
132+
let rows = {};
133+
let existingDetails = {};
134+
135+
if (existing?.body) {
136+
const parts = existing.body.split(detailsMarker);
137+
const tableSection = parts[0] || "";
138+
139+
const lines = tableSection.split("\n");
140+
for (const line of lines) {
141+
const match = line.match(/^\| ([^|]+) \| ([^|]+) \|$/);
142+
if (match) {
143+
const name = match[1].trim();
144+
if (name && name !== "Check" && !name.startsWith(":")) {
145+
rows[name] = match[2].trim();
146+
}
147+
}
148+
}
149+
150+
const detailsRegex = /<details>\s*<summary><strong>([^<]+)<\/strong>.*?<\/summary>([\s\S]*?)<\/details>/g;
151+
let detailMatch;
152+
while ((detailMatch = detailsRegex.exec(existing.body)) !== null) {
153+
existingDetails[detailMatch[1].trim()] = detailMatch[0];
154+
}
155+
}
156+
157+
const resultText = status === "Passed" ? "Passed" : "Failed";
158+
rows[section] = status === "Passed" ? resultText : `[${resultText}](${runUrl}) - ${details}`;
159+
160+
if (status === "Failed") {
161+
existingDetails[section] = [
162+
`<details>`,
163+
`<summary><strong>${section}</strong> - ${resultText}</summary>`,
164+
"",
165+
details || "Failed",
166+
"",
167+
`[View run](${runUrl})`,
168+
"",
169+
"```text",
170+
output,
171+
"```",
172+
"</details>",
173+
].join("\n");
174+
} else {
175+
delete existingDetails[section];
176+
}
177+
178+
const order = ["Lint", "Lint (UI)", "Format", "Format (UI)", "Typecheck", "Typecheck (UI)", "Build", "Build (UI)", "Test", "Release", "Deploy UI", "Deploy Example", "PR Title", "Labels"];
179+
const sortedKeys = Object.keys(rows).sort((a, b) => {
180+
const ai = order.indexOf(a), bi = order.indexOf(b);
181+
return (ai === -1 ? 999 : ai) - (bi === -1 ? 999 : bi);
182+
});
183+
184+
let table = `| Check | Result |\n|:------|:-------|\n`;
185+
for (const key of sortedKeys) {
186+
table += `| ${key} | ${rows[key]} |\n`;
187+
}
188+
189+
const detailsOrder = ["Lint", "Lint (UI)", "Format", "Format (UI)", "Typecheck", "Typecheck (UI)", "Build", "Build (UI)", "Test", "Release", "Deploy UI", "Deploy Example", "PR Title", "Labels"];
190+
const sortedDetails = Object.keys(existingDetails).sort((a, b) => {
191+
const ai = detailsOrder.indexOf(a), bi = detailsOrder.indexOf(b);
192+
return (ai === -1 ? 999 : ai) - (bi === -1 ? 999 : bi);
193+
});
194+
195+
let body = `${marker}\n## CI Summary\n\n${table}`;
196+
197+
if (sortedDetails.length > 0) {
198+
body += `\n${detailsMarker}\n\n---\n\n${sortedDetails.map(k => existingDetails[k]).join("\n\n")}`;
199+
}
200+
201+
if (existing) {
202+
await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body });
203+
} else {
204+
await github.rest.issues.createComment({ owner, repo, issue_number, body });
205+
}
206+
207+
- name: Fail if build failed
208+
if: steps.build.outcome == 'failure'
209+
run: exit 1

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ jobs:
171171
delete existingDetails[section];
172172
}
173173
174-
const order = ["Lint", "Format", "Typecheck", "Build", "Release", "PR Title", "Labels"];
174+
const order = ["Lint", "Lint (UI)", "Format", "Format (UI)", "Typecheck", "Typecheck (UI)", "Build", "Build (UI)", "Test", "Release", "Deploy UI", "Deploy Example", "PR Title", "Labels"];
175175
const sortedKeys = Object.keys(rows).sort((a, b) => {
176176
const ai = order.indexOf(a), bi = order.indexOf(b);
177177
return (ai === -1 ? 999 : ai) - (bi === -1 ? 999 : bi);
@@ -182,7 +182,7 @@ jobs:
182182
table += `| ${key} | ${rows[key]} |\n`;
183183
}
184184
185-
const detailsOrder = ["Lint", "Format", "Typecheck", "Build", "Release", "PR Title", "Labels"];
185+
const detailsOrder = ["Lint", "Lint (UI)", "Format", "Format (UI)", "Typecheck", "Typecheck (UI)", "Build", "Build (UI)", "Test", "Release", "Deploy UI", "Deploy Example", "PR Title", "Labels"];
186186
const sortedDetails = Object.keys(existingDetails).sort((a, b) => {
187187
const ai = detailsOrder.indexOf(a), bi = detailsOrder.indexOf(b);
188188
return (ai === -1 ? 999 : ai) - (bi === -1 ? 999 : bi);

.github/workflows/deploy-example.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ jobs:
307307
].join("\n");
308308
}
309309
310-
const order = ["Lint", "Format", "Typecheck", "Build", "Release", "Deploy Example", "PR Title", "Labels"];
310+
const order = ["Lint", "Lint (UI)", "Format", "Format (UI)", "Typecheck", "Typecheck (UI)", "Build", "Build (UI)", "Test", "Release", "Deploy UI", "Deploy Example", "PR Title", "Labels"];
311311
const sortedKeys = Object.keys(rows).sort((a, b) => {
312312
const ai = order.indexOf(a), bi = order.indexOf(b);
313313
return (ai === -1 ? 999 : ai) - (bi === -1 ? 999 : bi);

0 commit comments

Comments
 (0)