hale-commenting-system 3.5.0 → 3.5.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 +1 -1
- package/scripts/integrate.js +20 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hale-commenting-system",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.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",
|
package/scripts/integrate.js
CHANGED
|
@@ -474,6 +474,7 @@ GITHUB_CLIENT_SECRET=
|
|
|
474
474
|
}
|
|
475
475
|
|
|
476
476
|
if (config.jira && config.jira.apiToken) {
|
|
477
|
+
const trimmedToken = String(config.jira.apiToken || '').trim();
|
|
477
478
|
envServerContent += `# Jira API Token (server-only)
|
|
478
479
|
# For Red Hat Jira, generate a Personal Access Token:
|
|
479
480
|
# 1. Visit: https://issues.redhat.com/secure/ViewProfile.jspa
|
|
@@ -481,7 +482,7 @@ GITHUB_CLIENT_SECRET=
|
|
|
481
482
|
# 3. Click "Create token"
|
|
482
483
|
# 4. Give it a name and remove expiration
|
|
483
484
|
# 5. Copy the token
|
|
484
|
-
JIRA_API_TOKEN=${
|
|
485
|
+
JIRA_API_TOKEN=${trimmedToken}
|
|
485
486
|
`;
|
|
486
487
|
} else {
|
|
487
488
|
envServerContent += `# Jira API Token (server-only)
|
|
@@ -496,7 +497,8 @@ JIRA_API_TOKEN=
|
|
|
496
497
|
}
|
|
497
498
|
|
|
498
499
|
if (config.jira && config.jira.email) {
|
|
499
|
-
|
|
500
|
+
const trimmedEmail = String(config.jira.email || '').trim();
|
|
501
|
+
envServerContent += `JIRA_EMAIL=${trimmedEmail}\n`;
|
|
500
502
|
}
|
|
501
503
|
|
|
502
504
|
if (fs.existsSync(envServerPath)) {
|
|
@@ -507,13 +509,16 @@ JIRA_API_TOKEN=
|
|
|
507
509
|
const lines = existing.split('\n');
|
|
508
510
|
const updatedLines = lines.map(line => {
|
|
509
511
|
if (line.startsWith('GITHUB_CLIENT_SECRET=')) {
|
|
510
|
-
|
|
512
|
+
const trimmed = String(config.github?.clientSecret || '').trim();
|
|
513
|
+
return `GITHUB_CLIENT_SECRET=${trimmed}`;
|
|
511
514
|
}
|
|
512
515
|
if (line.startsWith('JIRA_API_TOKEN=')) {
|
|
513
|
-
|
|
516
|
+
const trimmed = String(config.jira?.apiToken || '').trim();
|
|
517
|
+
return `JIRA_API_TOKEN=${trimmed}`;
|
|
514
518
|
}
|
|
515
519
|
if (line.startsWith('JIRA_EMAIL=')) {
|
|
516
|
-
|
|
520
|
+
const trimmed = String(config.jira?.email || '').trim();
|
|
521
|
+
return `JIRA_EMAIL=${trimmed}`;
|
|
517
522
|
}
|
|
518
523
|
return line;
|
|
519
524
|
});
|
|
@@ -573,10 +578,13 @@ function integrateWebpackMiddleware() {
|
|
|
573
578
|
// Note: Requires Node.js 18+ for native fetch() support
|
|
574
579
|
try {
|
|
575
580
|
const dotenv = require('dotenv');
|
|
576
|
-
dotenv.config({ path: path.resolve(__dirname, '.env') });
|
|
577
|
-
dotenv.config({ path: path.resolve(__dirname, '.env.server'), override: true });
|
|
581
|
+
const envResult = dotenv.config({ path: path.resolve(__dirname, '.env') });
|
|
582
|
+
const envServerResult = dotenv.config({ path: path.resolve(__dirname, '.env.server'), override: true });
|
|
583
|
+
if (envServerResult.error && envServerResult.error.code !== 'ENOENT') {
|
|
584
|
+
console.warn('[Commenting System] Warning loading .env.server:', envServerResult.error.message);
|
|
585
|
+
}
|
|
578
586
|
} catch (e) {
|
|
579
|
-
|
|
587
|
+
console.warn('[Commenting System] Warning loading environment files:', e.message);
|
|
580
588
|
}
|
|
581
589
|
|
|
582
590
|
const express = require('express');
|
|
@@ -685,12 +693,13 @@ function integrateWebpackMiddleware() {
|
|
|
685
693
|
if (!key) return res.status(400).json({ message: 'Missing ?key (e.g. ABC-123)' });
|
|
686
694
|
|
|
687
695
|
const baseUrl = (process.env.VITE_JIRA_BASE_URL || 'https://issues.redhat.com').replace(/\\/+$/, '');
|
|
688
|
-
const email = process.env.JIRA_EMAIL;
|
|
689
|
-
const token = process.env.JIRA_API_TOKEN;
|
|
696
|
+
const email = (process.env.JIRA_EMAIL || '').trim();
|
|
697
|
+
const token = (process.env.JIRA_API_TOKEN || '').trim();
|
|
690
698
|
|
|
691
699
|
if (!token) {
|
|
700
|
+
console.error('[Commenting System] JIRA_API_TOKEN is missing or empty. Check .env.server file.');
|
|
692
701
|
return res.status(500).json({
|
|
693
|
-
message: 'Missing JIRA_API_TOKEN. For local dev, put it in .env.server (gitignored).',
|
|
702
|
+
message: 'Missing JIRA_API_TOKEN. For local dev, put it in .env.server (gitignored). Make sure the dev server was restarted after creating/updating .env.server.',
|
|
694
703
|
});
|
|
695
704
|
}
|
|
696
705
|
|