bjira 0.0.26 → 0.0.27
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/LICENSE.md +1 -1
- package/package.json +1 -1
- package/src/adf.js +53 -0
- package/src/ask.js +1 -1
- package/src/attachment.js +1 -1
- package/src/command.js +1 -1
- package/src/comment.js +3 -47
- package/src/create.js +3 -2
- package/src/errorhandler.js +1 -1
- package/src/field.js +1 -1
- package/src/index.js +1 -1
- package/src/init.js +1 -1
- package/src/issue.js +3 -2
- package/src/jira.js +1 -1
- package/src/label.js +1 -1
- package/src/open.js +1 -1
- package/src/preset.js +1 -1
- package/src/project.js +1 -1
- package/src/query.js +1 -1
- package/src/run.js +1 -1
- package/src/set.js +1 -1
- package/src/sprint.js +1 -1
- package/src/table.js +1 -1
- package/src/user.js +1 -1
- package/src/utils.js +1 -1
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2021-
|
|
3
|
+
Copyright (c) 2021-2026 Andrea Marchesini <baku@bnode.dev>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/package.json
CHANGED
package/src/adf.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2021-2026 Andrea Marchesini <baku@bnode.dev>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
// Implements the Atlassian Document Format (ADF) helper.
|
|
5
|
+
|
|
6
|
+
class ADF {
|
|
7
|
+
static create(text) {
|
|
8
|
+
return {
|
|
9
|
+
content: [{
|
|
10
|
+
content: [{
|
|
11
|
+
text,
|
|
12
|
+
"type": "text"
|
|
13
|
+
}],
|
|
14
|
+
type: "paragraph"
|
|
15
|
+
}],
|
|
16
|
+
type: "doc",
|
|
17
|
+
version: 1
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static show(obj) {
|
|
22
|
+
if (typeof obj === "string") return obj;
|
|
23
|
+
|
|
24
|
+
switch (obj.type) {
|
|
25
|
+
case 'doc':
|
|
26
|
+
case 'paragraph':
|
|
27
|
+
return obj.content.map(a => ADF.show(a)).join("");
|
|
28
|
+
|
|
29
|
+
case 'text':
|
|
30
|
+
return obj.text;
|
|
31
|
+
|
|
32
|
+
case 'inlineCard':
|
|
33
|
+
return obj.attrs.url;
|
|
34
|
+
|
|
35
|
+
case 'status':
|
|
36
|
+
case 'mention':
|
|
37
|
+
case 'emoji':
|
|
38
|
+
return obj.attrs.text;
|
|
39
|
+
|
|
40
|
+
case 'hardBreak':
|
|
41
|
+
return '\n';
|
|
42
|
+
|
|
43
|
+
case 'date':
|
|
44
|
+
const date = new Date(obj.attrs.timestamp * 1000);
|
|
45
|
+
return date.toLocaleString();
|
|
46
|
+
|
|
47
|
+
default:
|
|
48
|
+
return '';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default ADF;
|
package/src/ask.js
CHANGED
package/src/attachment.js
CHANGED
package/src/command.js
CHANGED
package/src/comment.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
// SPDX-FileCopyrightText: 2021-
|
|
1
|
+
// SPDX-FileCopyrightText: 2021-2026 Andrea Marchesini <baku@bnode.dev>
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: MIT
|
|
4
4
|
|
|
5
5
|
import Command from './command.js';
|
|
6
6
|
import Jira from './jira.js';
|
|
7
7
|
import Utils from './utils.js';
|
|
8
|
+
import ADF from './adf.js';
|
|
8
9
|
|
|
9
10
|
class Comment extends Command {
|
|
10
11
|
addOptions(program) {
|
|
@@ -24,54 +25,9 @@ class Comment extends Command {
|
|
|
24
25
|
|
|
25
26
|
const jira = new Jira(program);
|
|
26
27
|
|
|
27
|
-
await jira.spin('Adding the comment...', jira.api.addComment(id,
|
|
28
|
+
await jira.spin('Adding the comment...', jira.api.addComment(id, ADF.create(comment)));
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
createComment(comment) {
|
|
32
|
-
return {
|
|
33
|
-
content: [{
|
|
34
|
-
content: [{
|
|
35
|
-
text: comment,
|
|
36
|
-
"type": "text"
|
|
37
|
-
}],
|
|
38
|
-
type: "paragraph"
|
|
39
|
-
}],
|
|
40
|
-
type: "doc",
|
|
41
|
-
version: 1
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static showComment(obj) {
|
|
46
|
-
if (typeof obj === "string") return obj;
|
|
47
|
-
|
|
48
|
-
switch (obj.type) {
|
|
49
|
-
case 'doc':
|
|
50
|
-
case 'paragraph':
|
|
51
|
-
return obj.content.map(a => Comment.showComment(a)).join("");
|
|
52
|
-
|
|
53
|
-
case 'text':
|
|
54
|
-
return obj.text;
|
|
55
|
-
|
|
56
|
-
case 'inlineCard':
|
|
57
|
-
return obj.attrs.url;
|
|
58
|
-
|
|
59
|
-
case 'status':
|
|
60
|
-
case 'mention':
|
|
61
|
-
case 'emoji':
|
|
62
|
-
return obj.attrs.text;
|
|
63
|
-
|
|
64
|
-
case 'hardBreak':
|
|
65
|
-
return '\n';
|
|
66
|
-
|
|
67
|
-
case 'date':
|
|
68
|
-
const date = new Date(obj.attrs.timestamp * 1000);
|
|
69
|
-
return date.toLocaleString();
|
|
70
|
-
|
|
71
|
-
default:
|
|
72
|
-
return '';
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
31
|
};
|
|
76
32
|
|
|
77
33
|
export default Comment;
|
package/src/create.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-FileCopyrightText: 2021-
|
|
1
|
+
// SPDX-FileCopyrightText: 2021-2026 Andrea Marchesini <baku@bnode.dev>
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: MIT
|
|
4
4
|
|
|
@@ -6,6 +6,7 @@ import color from 'chalk';
|
|
|
6
6
|
|
|
7
7
|
import Ask from './ask.js';
|
|
8
8
|
import Command from './command.js';
|
|
9
|
+
import ADF from './adf.js';
|
|
9
10
|
import Field from './field.js';
|
|
10
11
|
import Jira from './jira.js';
|
|
11
12
|
import Issue from './issue.js';
|
|
@@ -50,7 +51,7 @@ class Create extends Command {
|
|
|
50
51
|
if (await Ask.askBoolean('Do you want to write a description?')) {
|
|
51
52
|
const description = await Utils.writeInTempFile();
|
|
52
53
|
if (description) {
|
|
53
|
-
newIssue.fields.description = description;
|
|
54
|
+
newIssue.fields.description = ADF.create(description);
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
|
package/src/errorhandler.js
CHANGED
package/src/field.js
CHANGED
package/src/index.js
CHANGED
package/src/init.js
CHANGED
package/src/issue.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
// SPDX-FileCopyrightText: 2021-
|
|
1
|
+
// SPDX-FileCopyrightText: 2021-2026 Andrea Marchesini <baku@bnode.dev>
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: MIT
|
|
4
4
|
|
|
5
5
|
import Command from './command.js';
|
|
6
6
|
import Comment from './comment.js';
|
|
7
|
+
import ADF from './adf.js';
|
|
7
8
|
import Field from './field.js';
|
|
8
9
|
import Jira from './jira.js';
|
|
9
10
|
import Project from './project.js';
|
|
@@ -189,7 +190,7 @@ class Issue extends Command {
|
|
|
189
190
|
'Updated on', comment['Updated']
|
|
190
191
|
],
|
|
191
192
|
[
|
|
192
|
-
'Body',
|
|
193
|
+
'Body', ADF.show(comment.body)
|
|
193
194
|
],
|
|
194
195
|
]);
|
|
195
196
|
});
|
package/src/jira.js
CHANGED
package/src/label.js
CHANGED
package/src/open.js
CHANGED
package/src/preset.js
CHANGED
package/src/project.js
CHANGED
package/src/query.js
CHANGED
package/src/run.js
CHANGED
package/src/set.js
CHANGED
package/src/sprint.js
CHANGED
package/src/table.js
CHANGED
package/src/user.js
CHANGED
package/src/utils.js
CHANGED