hale-commenting-system 3.2.0 → 3.3.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 +129 -43
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hale-commenting-system",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.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
|
@@ -1378,57 +1378,143 @@ async function main() {
|
|
|
1378
1378
|
}
|
|
1379
1379
|
|
|
1380
1380
|
if (ghAvailable) {
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1381
|
+
let ghLoopComplete = false;
|
|
1382
|
+
|
|
1383
|
+
while (!ghLoopComplete) {
|
|
1384
|
+
const useGh = await prompt([
|
|
1385
|
+
{
|
|
1386
|
+
type: 'confirm',
|
|
1387
|
+
name: 'use',
|
|
1388
|
+
message: 'GitHub CLI (gh) detected. Would you like to select or create a repository? (required for tracking issues)',
|
|
1389
|
+
default: true
|
|
1390
|
+
}
|
|
1391
|
+
]);
|
|
1389
1392
|
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1393
|
+
if (useGh.use) {
|
|
1394
|
+
try {
|
|
1395
|
+
console.log(' Fetching your repositories...');
|
|
1396
|
+
const reposJson = execSync('gh repo list --json name,owner --limit 100', {
|
|
1397
|
+
encoding: 'utf-8',
|
|
1398
|
+
timeout: 10000,
|
|
1399
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
1400
|
+
});
|
|
1398
1401
|
|
|
1399
|
-
|
|
1402
|
+
const repos = JSON.parse(reposJson);
|
|
1400
1403
|
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1404
|
+
if (repos && repos.length > 0) {
|
|
1405
|
+
const repoChoices = repos.map(r => ({
|
|
1406
|
+
name: `${r.owner.login}/${r.name}`,
|
|
1407
|
+
value: { owner: r.owner.login, repo: r.name, action: 'select' }
|
|
1408
|
+
}));
|
|
1406
1409
|
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1410
|
+
// Add option to create new repo
|
|
1411
|
+
repoChoices.push({
|
|
1412
|
+
name: '→ Create a new repository',
|
|
1413
|
+
value: { action: 'create' }
|
|
1414
|
+
});
|
|
1412
1415
|
|
|
1413
|
-
|
|
1414
|
-
{
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1416
|
+
// Add option to enter manually
|
|
1417
|
+
repoChoices.push({
|
|
1418
|
+
name: '→ Enter repository manually',
|
|
1419
|
+
value: { action: 'manual' }
|
|
1420
|
+
});
|
|
1421
|
+
|
|
1422
|
+
// Add option to go back
|
|
1423
|
+
repoChoices.push({
|
|
1424
|
+
name: '← Go back',
|
|
1425
|
+
value: { action: 'back' }
|
|
1426
|
+
});
|
|
1421
1427
|
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1428
|
+
const selected = await prompt([
|
|
1429
|
+
{
|
|
1430
|
+
type: 'list',
|
|
1431
|
+
name: 'repo',
|
|
1432
|
+
message: 'Select a repository:',
|
|
1433
|
+
choices: repoChoices
|
|
1434
|
+
}
|
|
1435
|
+
]);
|
|
1436
|
+
|
|
1437
|
+
if (selected.repo.action === 'select') {
|
|
1438
|
+
targetOwner = selected.repo.owner;
|
|
1439
|
+
targetRepo = selected.repo.repo;
|
|
1440
|
+
console.log(` ✓ Selected: ${targetOwner}/${targetRepo}\n`);
|
|
1441
|
+
ghLoopComplete = true;
|
|
1442
|
+
} else if (selected.repo.action === 'create') {
|
|
1443
|
+
// Create new repository
|
|
1444
|
+
console.log('\n📦 Creating a new GitHub repository...\n');
|
|
1445
|
+
|
|
1446
|
+
const newRepoDetails = await prompt([
|
|
1447
|
+
{
|
|
1448
|
+
type: 'input',
|
|
1449
|
+
name: 'name',
|
|
1450
|
+
message: 'Repository name:',
|
|
1451
|
+
validate: (input) => {
|
|
1452
|
+
if (!input.trim()) return 'Repository name is required';
|
|
1453
|
+
if (!/^[a-zA-Z0-9_.-]+$/.test(input)) return 'Invalid repository name (use letters, numbers, dashes, underscores, or periods)';
|
|
1454
|
+
return true;
|
|
1455
|
+
}
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
type: 'list',
|
|
1459
|
+
name: 'visibility',
|
|
1460
|
+
message: 'Repository visibility:',
|
|
1461
|
+
choices: [
|
|
1462
|
+
{ name: 'Public', value: 'public' },
|
|
1463
|
+
{ name: 'Private', value: 'private' }
|
|
1464
|
+
],
|
|
1465
|
+
default: 'private'
|
|
1466
|
+
},
|
|
1467
|
+
{
|
|
1468
|
+
type: 'input',
|
|
1469
|
+
name: 'description',
|
|
1470
|
+
message: 'Repository description (optional):',
|
|
1471
|
+
default: 'Comments and issues for design collaboration'
|
|
1472
|
+
}
|
|
1473
|
+
]);
|
|
1474
|
+
|
|
1475
|
+
try {
|
|
1476
|
+
console.log(` Creating repository: ${newRepoDetails.name}...`);
|
|
1477
|
+
const createCmd = `gh repo create ${newRepoDetails.name} --${newRepoDetails.visibility}${newRepoDetails.description ? ` --description "${newRepoDetails.description}"` : ''}`;
|
|
1478
|
+
const createResult = execSync(createCmd, {
|
|
1479
|
+
encoding: 'utf-8',
|
|
1480
|
+
stdio: ['ignore', 'pipe', 'pipe']
|
|
1481
|
+
});
|
|
1482
|
+
|
|
1483
|
+
// Get the authenticated user to determine owner
|
|
1484
|
+
const userJson = execSync('gh api user --jq ".login"', {
|
|
1485
|
+
encoding: 'utf-8',
|
|
1486
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
1487
|
+
}).trim();
|
|
1488
|
+
|
|
1489
|
+
targetOwner = userJson;
|
|
1490
|
+
targetRepo = newRepoDetails.name;
|
|
1491
|
+
console.log(` ✅ Repository created: ${targetOwner}/${targetRepo}\n`);
|
|
1492
|
+
ghLoopComplete = true;
|
|
1493
|
+
} catch (error) {
|
|
1494
|
+
console.error(` ❌ Failed to create repository: ${error.message}`);
|
|
1495
|
+
console.log(' Please create the repository manually and run the setup again.\n');
|
|
1496
|
+
rl.close();
|
|
1497
|
+
process.exit(1);
|
|
1498
|
+
}
|
|
1499
|
+
} else if (selected.repo.action === 'back') {
|
|
1500
|
+
// Go back to previous question - loop will restart
|
|
1501
|
+
console.log('');
|
|
1502
|
+
continue;
|
|
1503
|
+
} else if (selected.repo.action === 'manual') {
|
|
1504
|
+
// Exit loop to use manual entry
|
|
1505
|
+
ghLoopComplete = true;
|
|
1506
|
+
}
|
|
1507
|
+
} else {
|
|
1508
|
+
console.log(' No repositories found. Using manual entry.\n');
|
|
1509
|
+
ghLoopComplete = true;
|
|
1426
1510
|
}
|
|
1427
|
-
}
|
|
1428
|
-
console.log('
|
|
1511
|
+
} catch (error) {
|
|
1512
|
+
console.log(' ⚠️ Error fetching repositories. Using manual entry.\n');
|
|
1513
|
+
ghLoopComplete = true;
|
|
1429
1514
|
}
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1515
|
+
} else {
|
|
1516
|
+
// User chose not to use gh CLI
|
|
1517
|
+
ghLoopComplete = true;
|
|
1432
1518
|
}
|
|
1433
1519
|
}
|
|
1434
1520
|
}
|