hale-commenting-system 3.3.1 → 3.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hale-commenting-system",
3
- "version": "3.3.1",
3
+ "version": "3.4.1",
4
4
  "description": "A commenting system for PatternFly React applications that allows designers and developers to add comments directly on design pages, sync with GitHub Issues, and link Jira tickets.",
5
5
  "homepage": "https://www.npmjs.com/package/hale-commenting-system",
6
6
  "license": "MIT",
@@ -409,15 +409,34 @@ VITE_JIRA_BASE_URL=
409
409
  `;
410
410
  }
411
411
 
412
- // Check if .env exists and append or create
412
+ // Check if .env exists and update or create
413
413
  if (fs.existsSync(envPath)) {
414
- const existing = fs.readFileSync(envPath, 'utf-8');
415
- // Only add if not already present
416
- if (!existing.includes('VITE_GITHUB_CLIENT_ID')) {
417
- fs.appendFileSync(envPath, '\n' + envContent);
414
+ let existing = fs.readFileSync(envPath, 'utf-8');
415
+
416
+ if (existing.includes('VITE_GITHUB_CLIENT_ID')) {
417
+ // Update existing values
418
+ const lines = existing.split('\n');
419
+ const updatedLines = lines.map(line => {
420
+ if (line.startsWith('VITE_GITHUB_CLIENT_ID=')) {
421
+ return `VITE_GITHUB_CLIENT_ID=${config.github?.clientId || ''}`;
422
+ }
423
+ if (line.startsWith('VITE_GITHUB_OWNER=')) {
424
+ return `VITE_GITHUB_OWNER=${config.owner || ''}`;
425
+ }
426
+ if (line.startsWith('VITE_GITHUB_REPO=')) {
427
+ return `VITE_GITHUB_REPO=${config.repo || ''}`;
428
+ }
429
+ if (line.startsWith('VITE_JIRA_BASE_URL=')) {
430
+ return `VITE_JIRA_BASE_URL=${config.jira?.baseUrl || ''}`;
431
+ }
432
+ return line;
433
+ });
434
+ fs.writeFileSync(envPath, updatedLines.join('\n'));
418
435
  console.log(' ✅ Updated .env file');
419
436
  } else {
420
- console.log(' ⚠️ .env already contains commenting system config');
437
+ // Append if commenting system config not present
438
+ fs.appendFileSync(envPath, '\n' + envContent);
439
+ console.log(' ✅ Updated .env file');
421
440
  }
422
441
  } else {
423
442
  fs.writeFileSync(envPath, envContent);
@@ -481,12 +500,29 @@ JIRA_API_TOKEN=
481
500
  }
482
501
 
483
502
  if (fs.existsSync(envServerPath)) {
484
- const existing = fs.readFileSync(envServerPath, 'utf-8');
485
- if (!existing.includes('GITHUB_CLIENT_SECRET')) {
486
- fs.appendFileSync(envServerPath, '\n' + envServerContent);
503
+ let existing = fs.readFileSync(envServerPath, 'utf-8');
504
+
505
+ if (existing.includes('GITHUB_CLIENT_SECRET')) {
506
+ // Update existing values
507
+ const lines = existing.split('\n');
508
+ const updatedLines = lines.map(line => {
509
+ if (line.startsWith('GITHUB_CLIENT_SECRET=')) {
510
+ return `GITHUB_CLIENT_SECRET=${config.github?.clientSecret || ''}`;
511
+ }
512
+ if (line.startsWith('JIRA_API_TOKEN=')) {
513
+ return `JIRA_API_TOKEN=${config.jira?.apiToken || ''}`;
514
+ }
515
+ if (line.startsWith('JIRA_EMAIL=')) {
516
+ return `JIRA_EMAIL=${config.jira?.email || ''}`;
517
+ }
518
+ return line;
519
+ });
520
+ fs.writeFileSync(envServerPath, updatedLines.join('\n'));
487
521
  console.log(' ✅ Updated .env.server file');
488
522
  } else {
489
- console.log(' ⚠️ .env.server already contains commenting system config');
523
+ // Append if commenting system config not present
524
+ fs.appendFileSync(envServerPath, '\n' + envServerContent);
525
+ console.log(' ✅ Updated .env.server file');
490
526
  }
491
527
  } else {
492
528
  fs.writeFileSync(envServerPath, envServerContent);
@@ -72,10 +72,13 @@ export const CommentOverlay: React.FunctionComponent = () => {
72
72
  position: 'absolute',
73
73
  top: 0,
74
74
  left: 0,
75
+ right: 0,
76
+ bottom: 0,
75
77
  width: '100%',
76
78
  height: '100%',
77
79
  pointerEvents: 'none',
78
80
  zIndex: 999,
81
+ overflow: 'visible', // Ensure pins can be visible even if slightly outside
79
82
  }}
80
83
  >
81
84
  {currentThreads.map((thread) => (
@@ -463,14 +463,18 @@ export const CommentProvider: React.FunctionComponent<{ children: React.ReactNod
463
463
  };
464
464
  });
465
465
 
466
+ // Track which issue numbers were returned from GitHub
467
+ const githubIssueNumbers = new Set(ghThreads.map(gt => gt.issueNumber).filter((n): n is number => !!n));
468
+
466
469
  // Keep local threads on this route/version that:
467
470
  // 1. Don't have an issueNumber yet, OR
468
- // 2. Are actively syncing (prevents race condition where issue was created but GitHub API hasn't returned it yet)
471
+ // 2. Are actively syncing (prevents race condition where issue was created but GitHub API hasn't returned it yet), OR
472
+ // 3. Have an issueNumber but GitHub didn't return it (preserve existing threads even if GitHub API fails or issue is hidden)
469
473
  const localUnlinked = prev.filter(
470
474
  (t) =>
471
475
  t.route === route &&
472
476
  (t.version ?? '1') === (version ?? '1') &&
473
- (!t.issueNumber || t.syncStatus === 'syncing'),
477
+ (!t.issueNumber || t.syncStatus === 'syncing' || !githubIssueNumbers.has(t.issueNumber)),
474
478
  );
475
479
 
476
480
  // Remove duplicates: if a thread is both in localUnlinked and merged, prefer the merged version