@worca/ui 0.5.0-rc.1 → 0.6.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/app/main.bundle.js +296 -292
- package/app/main.bundle.js.map +4 -4
- package/app/styles.css +10 -14
- package/package.json +1 -1
- package/server/versions.js +68 -10
package/app/styles.css
CHANGED
|
@@ -1504,7 +1504,8 @@ sl-details.log-history-panel::part(content) {
|
|
|
1504
1504
|
font-size: 14px;
|
|
1505
1505
|
font-weight: 600;
|
|
1506
1506
|
color: var(--fg);
|
|
1507
|
-
text-transform:
|
|
1507
|
+
text-transform: uppercase;
|
|
1508
|
+
letter-spacing: 0.03em;
|
|
1508
1509
|
}
|
|
1509
1510
|
|
|
1510
1511
|
.settings-card-body {
|
|
@@ -1547,8 +1548,9 @@ sl-details.log-history-panel::part(content) {
|
|
|
1547
1548
|
|
|
1548
1549
|
.settings-switch-row {
|
|
1549
1550
|
display: flex;
|
|
1550
|
-
|
|
1551
|
-
|
|
1551
|
+
flex-direction: column;
|
|
1552
|
+
align-items: flex-start;
|
|
1553
|
+
gap: 4px;
|
|
1552
1554
|
padding: 6px 0;
|
|
1553
1555
|
}
|
|
1554
1556
|
|
|
@@ -1576,19 +1578,10 @@ sl-details.log-history-panel::part(content) {
|
|
|
1576
1578
|
align-items: center;
|
|
1577
1579
|
gap: 4px;
|
|
1578
1580
|
padding: 16px 0;
|
|
1579
|
-
|
|
1581
|
+
flex-wrap: wrap;
|
|
1580
1582
|
}
|
|
1581
1583
|
|
|
1582
1584
|
.pipeline-stage-node {
|
|
1583
|
-
display: flex;
|
|
1584
|
-
flex-direction: column;
|
|
1585
|
-
align-items: center;
|
|
1586
|
-
gap: 4px;
|
|
1587
|
-
padding: 10px 14px;
|
|
1588
|
-
border: 1px solid var(--border-subtle);
|
|
1589
|
-
border-radius: var(--radius);
|
|
1590
|
-
background: var(--bg-secondary);
|
|
1591
|
-
min-width: 140px;
|
|
1592
1585
|
transition: opacity 0.2s, border-color 0.2s, background 0.2s;
|
|
1593
1586
|
}
|
|
1594
1587
|
|
|
@@ -4015,7 +4008,7 @@ sl-details.learnings-panel::part(content) {
|
|
|
4015
4008
|
.version-row { display: flex; align-items: center; padding: 4px 0; gap: 8px; }
|
|
4016
4009
|
.version-row-label { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 64px; }
|
|
4017
4010
|
.version-row-value { font-size: 13px; font-weight: 500; color: var(--fg); font-family: var(--sl-font-mono); white-space: nowrap; margin-left: auto; display: flex; align-items: center; gap: 6px; }
|
|
4018
|
-
.settings-card-header > sl-badge { margin-left: auto; }
|
|
4011
|
+
.settings-card-header > sl-badge, .settings-card-header > sl-switch { margin-left: auto; }
|
|
4019
4012
|
.version-title-exact { text-transform: none; }
|
|
4020
4013
|
.version-copy-btn {
|
|
4021
4014
|
background: none; border: 1px solid var(--border); border-radius: 4px;
|
|
@@ -4025,6 +4018,9 @@ sl-details.learnings-panel::part(content) {
|
|
|
4025
4018
|
}
|
|
4026
4019
|
.version-copy-btn:hover { background: var(--bg-tertiary); color: var(--fg); }
|
|
4027
4020
|
.version-copy-icon { display: inline-flex; align-items: center; min-width: 12px; }
|
|
4021
|
+
.install-path-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 12px; background: var(--bg-secondary); border-radius: var(--radius); border: 1px solid var(--border-subtle); }
|
|
4022
|
+
.install-path-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
|
|
4023
|
+
.install-path-value { font-size: 12px; color: var(--fg); font-family: var(--sl-font-mono); word-break: break-all; }
|
|
4028
4024
|
.version-refresh { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
|
|
4029
4025
|
.version-refresh-hint { font-size: 11px; color: var(--muted); }
|
|
4030
4026
|
.project-worca-version { font-size: 11px; color: var(--muted); font-family: var(--sl-font-mono); margin-top: 2px; }
|
package/package.json
CHANGED
package/server/versions.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// server/versions.js — version fetching + caching for worca-cc and @worca/ui
|
|
2
2
|
import { execFileSync } from 'node:child_process';
|
|
3
3
|
import { readFileSync } from 'node:fs';
|
|
4
|
-
import { join } from 'node:path';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
5
6
|
import { readPreferences } from './preferences.js';
|
|
6
7
|
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const INSTALL_DIR = dirname(__dirname); // worca-ui root
|
|
10
|
+
|
|
7
11
|
/** Cache: { data, timestamp } */
|
|
8
12
|
let _cache = null;
|
|
9
13
|
const CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
@@ -66,18 +70,19 @@ export async function fetchNpmVersions(packageName) {
|
|
|
66
70
|
}
|
|
67
71
|
if (!res.ok) return nullResult;
|
|
68
72
|
const data = await res.json();
|
|
69
|
-
const
|
|
73
|
+
const distLatest = data['dist-tags']?.latest || null;
|
|
70
74
|
let latestRc = data['dist-tags']?.rc || null;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
|
|
76
|
+
// Scan all versions for the highest stable and highest RC
|
|
77
|
+
let bestStable = null;
|
|
78
|
+
let bestRc = null;
|
|
79
|
+
let bestRcNum = -1;
|
|
80
|
+
if (data.versions) {
|
|
75
81
|
for (const ver of Object.keys(data.versions)) {
|
|
76
82
|
const rcMatch = ver.match(/^(.+)-rc\.(\d+)$/);
|
|
77
83
|
if (rcMatch) {
|
|
78
84
|
const rcNum = parseInt(rcMatch[2], 10);
|
|
79
85
|
const base = rcMatch[1];
|
|
80
|
-
// Compare base+rcNum to find the highest RC
|
|
81
86
|
if (
|
|
82
87
|
!bestRc ||
|
|
83
88
|
compareVersions(base, bestRc.base) > 0 ||
|
|
@@ -86,10 +91,21 @@ export async function fetchNpmVersions(packageName) {
|
|
|
86
91
|
bestRc = { base, full: ver };
|
|
87
92
|
bestRcNum = rcNum;
|
|
88
93
|
}
|
|
94
|
+
} else if (!ver.includes('-')) {
|
|
95
|
+
// Stable version (no pre-release suffix)
|
|
96
|
+
if (!bestStable || compareVersions(ver, bestStable) > 0) {
|
|
97
|
+
bestStable = ver;
|
|
98
|
+
}
|
|
89
99
|
}
|
|
90
100
|
}
|
|
91
|
-
if (bestRc) latestRc = bestRc.full;
|
|
92
101
|
}
|
|
102
|
+
if (!latestRc && bestRc) latestRc = bestRc.full;
|
|
103
|
+
|
|
104
|
+
// Use dist-tags latest only if it's a stable version, otherwise fall back
|
|
105
|
+
// to the highest stable version found in the registry
|
|
106
|
+
const isRc = distLatest?.includes('-');
|
|
107
|
+
const latest = isRc ? bestStable || distLatest : distLatest;
|
|
108
|
+
|
|
93
109
|
return { latest, latestRc };
|
|
94
110
|
} catch {
|
|
95
111
|
return nullResult;
|
|
@@ -144,13 +160,48 @@ export async function fetchPyPIVersions(packageName) {
|
|
|
144
160
|
}
|
|
145
161
|
}
|
|
146
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Get git describe info for a repo: commits ahead of tag + dirty state.
|
|
165
|
+
* @param {string} repoPath
|
|
166
|
+
* @param {string} tagPrefix - e.g. 'worca-cc-v' or 'worca-ui-v'
|
|
167
|
+
* @returns {{ ahead: number, dirty: boolean } | null}
|
|
168
|
+
*/
|
|
169
|
+
function getGitDevStatus(repoPath, tagPrefix) {
|
|
170
|
+
try {
|
|
171
|
+
const desc = execFileSync(
|
|
172
|
+
'git',
|
|
173
|
+
['describe', '--tags', '--long', '--match', `${tagPrefix}*`],
|
|
174
|
+
{ cwd: repoPath, encoding: 'utf8', timeout: 3000 },
|
|
175
|
+
).trim();
|
|
176
|
+
// Format: tagPrefix0.10.0-3-gabcdef
|
|
177
|
+
const m = desc.match(/-(\d+)-g[0-9a-f]+$/);
|
|
178
|
+
const ahead = m ? parseInt(m[1], 10) : 0;
|
|
179
|
+
|
|
180
|
+
const status = execFileSync('git', ['status', '--porcelain'], {
|
|
181
|
+
cwd: repoPath,
|
|
182
|
+
encoding: 'utf8',
|
|
183
|
+
timeout: 3000,
|
|
184
|
+
}).trim();
|
|
185
|
+
const dirty = status.length > 0;
|
|
186
|
+
|
|
187
|
+
return { ahead, dirty };
|
|
188
|
+
} catch {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
147
193
|
/**
|
|
148
194
|
* Read versions from local dev path.
|
|
149
195
|
* @param {string} sourceRepo - path to local worca-cc repo
|
|
150
|
-
* @returns {{ worcaCc: string|null, worcaUi: string|null }}
|
|
196
|
+
* @returns {{ worcaCc: string|null, worcaUi: string|null, worcaCcDev: object|null, worcaUiDev: object|null }}
|
|
151
197
|
*/
|
|
152
198
|
export function getDevPathVersions(sourceRepo) {
|
|
153
|
-
const result = {
|
|
199
|
+
const result = {
|
|
200
|
+
worcaCc: null,
|
|
201
|
+
worcaUi: null,
|
|
202
|
+
worcaCcDev: null,
|
|
203
|
+
worcaUiDev: null,
|
|
204
|
+
};
|
|
154
205
|
if (!sourceRepo) return result;
|
|
155
206
|
try {
|
|
156
207
|
const pyproject = readFileSync(join(sourceRepo, 'pyproject.toml'), 'utf8');
|
|
@@ -167,6 +218,10 @@ export function getDevPathVersions(sourceRepo) {
|
|
|
167
218
|
} catch {
|
|
168
219
|
// package.json not found or unreadable
|
|
169
220
|
}
|
|
221
|
+
|
|
222
|
+
result.worcaCcDev = getGitDevStatus(sourceRepo, 'worca-cc-v');
|
|
223
|
+
result.worcaUiDev = getGitDevStatus(sourceRepo, 'worca-ui-v');
|
|
224
|
+
|
|
170
225
|
return result;
|
|
171
226
|
}
|
|
172
227
|
|
|
@@ -246,9 +301,12 @@ export async function getVersionInfo({ prefsPath, worcaVersion, force } = {}) {
|
|
|
246
301
|
path: sourceRepo,
|
|
247
302
|
worcaCc: devVersions.worcaCc,
|
|
248
303
|
worcaUi: devVersions.worcaUi,
|
|
304
|
+
worcaCcDev: devVersions.worcaCcDev,
|
|
305
|
+
worcaUiDev: devVersions.worcaUiDev,
|
|
249
306
|
}
|
|
250
307
|
: null,
|
|
251
308
|
activeWorcaCc: devVersions?.worcaCc || installedCc,
|
|
309
|
+
installDir: INSTALL_DIR,
|
|
252
310
|
cachedAt: new Date().toISOString(),
|
|
253
311
|
};
|
|
254
312
|
|