hale-commenting-system 3.3.1 → 3.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hale-commenting-system",
3
- "version": "3.3.1",
3
+ "version": "3.4.0",
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);