pressship 0.2.0 → 0.2.1

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/assets/web/app.js CHANGED
@@ -1311,8 +1311,9 @@ function renderRemote() {
1311
1311
  }
1312
1312
 
1313
1313
  function remoteCard(plugin) {
1314
- const inLibrary = state.local.find((entry) => entry.slug === plugin.slug);
1315
- const primaryLabel = inLibrary ? "Open in Studio" : "Open in Library";
1314
+ const localState = remotePluginLocalState(plugin);
1315
+ const inLibrary = localState.entry;
1316
+ const primaryLabel = inLibrary ? "Open in Studio" : "Clone to Local";
1316
1317
  const primaryAction = inLibrary
1317
1318
  ? `data-action="studio" data-scope="local" data-id="${escapeAttr(inLibrary.id)}"`
1318
1319
  : `data-action="open-in-library" data-slug="${escapeAttr(plugin.slug)}"`;
@@ -1321,7 +1322,7 @@ function remoteCard(plugin) {
1321
1322
  const description = plugin.author ? `By ${plugin.author}` : "WordPress.org plugin";
1322
1323
 
1323
1324
  return `
1324
- <article class="ps-plugin-card${inLibrary ? " is-in-library" : ""}" data-slug="${escapeAttr(plugin.slug)}">
1325
+ <article class="ps-plugin-card${inLibrary ? " is-in-library" : " is-not-cloned"}" data-slug="${escapeAttr(plugin.slug)}">
1325
1326
  <header class="ps-plugin-card-header">
1326
1327
  <span class="ps-plugin-card-icon" aria-hidden="true">${escapeHtml(initials)}</span>
1327
1328
  <div class="ps-plugin-card-title">
@@ -1345,6 +1346,13 @@ function remoteCard(plugin) {
1345
1346
  <dd>${roleBadges}</dd>
1346
1347
  </div>
1347
1348
  </dl>
1349
+ <div class="ps-plugin-card-status ps-plugin-card-local-state" title="${escapeAttr(localState.title)}">
1350
+ <span class="badge badge-${escapeAttr(localState.tone)}">
1351
+ <span class="dashicons ${escapeAttr(localState.icon)}" aria-hidden="true"></span>
1352
+ ${escapeHtml(localState.label)}
1353
+ </span>
1354
+ <small>${escapeHtml(localState.note)}</small>
1355
+ </div>
1348
1356
  <footer class="ps-plugin-card-footer">
1349
1357
  <button type="button" class="button button-primary ps-plugin-card-primary" ${primaryAction}>
1350
1358
  <span class="dashicons ${inLibrary ? "dashicons-editor-code" : "dashicons-download"}" aria-hidden="true"></span>
@@ -1358,6 +1366,55 @@ function remoteCard(plugin) {
1358
1366
  `;
1359
1367
  }
1360
1368
 
1369
+ function remotePluginLocalState(plugin) {
1370
+ const matches = state.local.filter((entry) => entry.slug === plugin.slug);
1371
+ const cloned = matches.find((entry) => entry.source === "clone" && entry.exists !== false);
1372
+ const tracked = matches.find((entry) => entry.exists !== false);
1373
+ const missing = matches.find((entry) => entry.exists === false);
1374
+
1375
+ if (cloned) {
1376
+ return {
1377
+ entry: cloned,
1378
+ label: "Cloned locally",
1379
+ note: cloned.path || "SVN checkout is tracked in Studio.",
1380
+ title: cloned.path || "This WordPress.org plugin has a local SVN checkout.",
1381
+ tone: "soft-success",
1382
+ icon: "dashicons-yes-alt"
1383
+ };
1384
+ }
1385
+
1386
+ if (tracked) {
1387
+ return {
1388
+ entry: tracked,
1389
+ label: "Tracked locally",
1390
+ note: tracked.path || "Matching local folder is tracked in Studio.",
1391
+ title: tracked.path || "A matching local plugin folder is tracked in Studio.",
1392
+ tone: "soft-success",
1393
+ icon: "dashicons-admin-site-alt3"
1394
+ };
1395
+ }
1396
+
1397
+ if (missing) {
1398
+ return {
1399
+ entry: null,
1400
+ label: "Local path missing",
1401
+ note: "Clone to recreate the local checkout.",
1402
+ title: missing.path || "The previous local folder is no longer available.",
1403
+ tone: "soft-warning",
1404
+ icon: "dashicons-warning"
1405
+ };
1406
+ }
1407
+
1408
+ return {
1409
+ entry: null,
1410
+ label: "Not cloned",
1411
+ note: "Clone this WordPress.org plugin to work on it locally.",
1412
+ title: "This WordPress.org plugin is not cloned into the local library.",
1413
+ tone: "soft-warning",
1414
+ icon: "dashicons-download"
1415
+ };
1416
+ }
1417
+
1361
1418
  function remoteRoleChips(roles = []) {
1362
1419
  const safeRoles = Array.isArray(roles) ? roles : [];
1363
1420
  if (!safeRoles.length) {
@@ -1400,6 +1457,9 @@ async function loadLocal() {
1400
1457
  state.local.map((plugin, index) => [plugin.id, versionStates[index]])
1401
1458
  );
1402
1459
  renderLocal();
1460
+ if (!state.remoteLoading && state.remote.length) {
1461
+ renderRemote();
1462
+ }
1403
1463
  } catch (error) {
1404
1464
  state.localError = error.message;
1405
1465
  els.local.innerHTML = emptyState({
@@ -7331,14 +7391,14 @@ function escapeAttr(value) {
7331
7391
  }
7332
7392
 
7333
7393
  /* ===================================================================
7334
- * Open in Library — clones from WordPress.org SVN or jumps to existing
7394
+ * Clone to Local — clones from WordPress.org SVN or jumps to existing
7335
7395
  * =================================================================== */
7336
7396
 
7337
7397
  async function openInLibrary(slug) {
7338
7398
  if (!slug) {
7339
7399
  return;
7340
7400
  }
7341
- const existing = state.local.find((entry) => entry.slug === slug);
7401
+ const existing = remotePluginLocalState({ slug }).entry;
7342
7402
  if (existing) {
7343
7403
  await openStudio("local", existing.id);
7344
7404
  return;
@@ -6712,6 +6712,27 @@ td code {
6712
6712
  gap: 5px;
6713
6713
  }
6714
6714
 
6715
+ .ps-plugin-card-local-state {
6716
+ align-items: center;
6717
+ gap: 8px;
6718
+ min-height: 24px;
6719
+ }
6720
+
6721
+ .ps-plugin-card-local-state .badge {
6722
+ flex: 0 0 auto;
6723
+ }
6724
+
6725
+ .ps-plugin-card-local-state small {
6726
+ color: var(--wp-text-muted);
6727
+ display: block;
6728
+ flex: 1 1 auto;
6729
+ font-size: 12px;
6730
+ min-width: 0;
6731
+ overflow: hidden;
6732
+ text-overflow: ellipsis;
6733
+ white-space: nowrap;
6734
+ }
6735
+
6715
6736
  .ps-plugin-card-meta {
6716
6737
  display: grid;
6717
6738
  gap: 8px 16px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pressship",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Submit and release WordPress.org plugins from the command line.",
5
5
  "homepage": "https://pressship.org",
6
6
  "bin": {