@@ -173,11 +173,11 @@ class IssueContentParser {
173
173
.map(x => (0, utils_1.parseIssueUrl)(x))
174
174
.filter((x) => x !== null);
175
175
}
176
- extractIssueDependencies(issue) {
176
+ extractIssueDependencies(issue, repoRef ) {
177
177
const contentLines = issue.body?.split("\n") ?? [];
178
178
return contentLines
179
179
.filter(x => this.isDependencyLine(x))
180
- .map(x => (0, utils_1.parseIssuesUrls)(x))
180
+ .map(x => (0, utils_1.parseIssuesUrls)(x, repoRef ))
181
181
.flat()
182
182
.filter((x) => x !== null);
183
183
}
@@ -291,7 +291,7 @@ const run = async () => {
291
291
for (const issueRef of rootIssueTasklist) {
292
292
const issue = await githubApiClient.getIssue(issueRef);
293
293
const issueDetails = mermaid_node_1.MermaidNode.createFromGitHubIssue(issue);
294
- const issueDependencies = issueContentParser.extractIssueDependencies(issue);
294
+ const issueDependencies = issueContentParser.extractIssueDependencies(issue, issueRef );
295
295
graphBuilder.addIssue(issueRef, issueDetails);
296
296
issueDependencies.forEach(x => graphBuilder.addDependency(x, issueRef));
297
297
}
@@ -330,35 +330,24 @@ run();
330
330
/***/ }),
331
331
332
332
/***/ 235:
333
- /***/ ((__unused_webpack_module, exports) => {
333
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__ ) => {
334
334
335
335
"use strict";
336
336
337
337
Object.defineProperty(exports, "__esModule", ({ value: true }));
338
338
exports.MermaidNode = void 0;
339
+ const utils_1 = __nccwpck_require__(918);
339
340
class MermaidNode {
340
341
constructor(nodeId, title, status, url) {
341
342
this.nodeId = nodeId;
342
343
this.title = title;
343
344
this.status = status;
344
345
this.url = url;
345
346
}
346
- getWrappedTitle() {
347
- const maxWidth = 40;
348
- const words = this.title.split(/\s+/);
349
- let result = words[0];
350
- let lastLength = result.length;
351
- for (let wordIndex = 1; wordIndex < words.length; wordIndex++) {
352
- if (lastLength + words[wordIndex].length >= maxWidth) {
353
- result += "\n";
354
- lastLength = 0;
355
- }
356
- else {
357
- result += " ";
358
- }
359
- result += words[wordIndex];
360
- lastLength += words[wordIndex].length;
361
- }
347
+ getFormattedTitle() {
348
+ let result = this.title;
349
+ result = result.replaceAll('"', "'");
350
+ result = (0, utils_1.wrapString)(result, 40);
362
351
return result;
363
352
}
364
353
static createFromGitHubIssue(issue) {
@@ -447,7 +436,7 @@ ${renderedGraphIssues}
447
436
`;
448
437
}
449
438
renderIssue(issue) {
450
- const title = issue.getWrappedTitle ();
439
+ const title = issue.getFormattedTitle ();
451
440
const linkedTitle = issue.url
452
441
? `<a href='${issue.url}' style='text-decoration:none;color: inherit;'>${title}</a>`
453
442
: title;
@@ -478,9 +467,10 @@ exports.MermaidRender = MermaidRender;
478
467
"use strict";
479
468
480
469
Object.defineProperty(exports, "__esModule", ({ value: true }));
481
- exports.parseIssuesUrls = exports.parseIssueUrl = void 0;
470
+ exports.wrapString = exports. parseIssuesUrls = exports.parseIssueNumber = exports.parseIssueUrl = void 0;
482
471
const issueUrlRegex = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)$/i;
483
- const issueUrlsRegex = /github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)/gi;
472
+ const issueNumberRegex = /^#(\d+)$/;
473
+ const issueUrlsRegex = /https:\/\/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)|#\d+/gi;
484
474
const parseIssueUrl = (str) => {
485
475
const found = str.trim().match(issueUrlRegex);
486
476
if (!found) {
@@ -493,18 +483,47 @@ const parseIssueUrl = (str) => {
493
483
};
494
484
};
495
485
exports.parseIssueUrl = parseIssueUrl;
496
- const parseIssuesUrls = (str) => {
486
+ const parseIssueNumber = (str, repoRef) => {
487
+ const found = str.trim().match(issueNumberRegex);
488
+ if (!found) {
489
+ return null;
490
+ }
491
+ return {
492
+ repoOwner: repoRef.repoOwner,
493
+ repoName: repoRef.repoName,
494
+ issueNumber: parseInt(found[1]),
495
+ };
496
+ };
497
+ exports.parseIssueNumber = parseIssueNumber;
498
+ const parseIssuesUrls = (str, repoRef) => {
497
499
const result = [];
498
500
for (const match of str.matchAll(issueUrlsRegex)) {
499
- result.push({
500
- repoOwner: match[1],
501
- repoName: match[2],
502
- issueNumber: parseInt(match[3]),
503
- });
501
+ const parsedIssue = (0, exports.parseIssueUrl)(match[0]) || (0, exports.parseIssueNumber)(match[0], repoRef);
502
+ if (parsedIssue) {
503
+ result.push(parsedIssue);
504
+ }
504
505
}
505
506
return result;
506
507
};
507
508
exports.parseIssuesUrls = parseIssuesUrls;
509
+ const wrapString = (str, maxWidth) => {
510
+ const words = str.split(/\s+/);
511
+ let result = words[0];
512
+ let lastLength = result.length;
513
+ for (let wordIndex = 1; wordIndex < words.length; wordIndex++) {
514
+ if (lastLength + words[wordIndex].length >= maxWidth) {
515
+ result += "\n";
516
+ lastLength = 0;
517
+ }
518
+ else {
519
+ result += " ";
520
+ }
521
+ result += words[wordIndex];
522
+ lastLength += words[wordIndex].length;
523
+ }
524
+ return result;
525
+ };
526
+ exports.wrapString = wrapString;
508
527
509
528
510
529
/***/ }),
0 commit comments