spec-up-t 1.0.58 → 1.0.59
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/src/get-xrefs-data.js +7 -2
- package/src/json-key-validator.js +6 -6
- package/src/references.js +19 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.59",
|
|
4
4
|
"description": "Technical specification drafting tool that generates rich specification documents from markdown. Forked from https://github.com/decentralized-identity/spec-up by Daniel Buchner (https://github.com/csuwildcat)",
|
|
5
5
|
"main": "./index",
|
|
6
6
|
"repository": {
|
package/src/get-xrefs-data.js
CHANGED
|
@@ -86,15 +86,20 @@ function getXrefsData(GITHUB_API_TOKEN) {
|
|
|
86
86
|
|
|
87
87
|
// Function to extend xref objects with additional information, such as repository URL and directory information.
|
|
88
88
|
function extendXrefs(config, xrefs) {
|
|
89
|
+
if (config.specs[0].external_specs_repos) {
|
|
90
|
+
console.log("\n SPEC-UP-T: PLEASE NOTE: Your specs.json file is outdated (not your fault, we changed something). Use this one: https://github.com/trustoverip/spec-up-t-starter-pack/blob/main/spec-up-t-starterpack/specs.json or e-mail kor@dwarshuis.com for help. \n");
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
89
94
|
xrefs.forEach(xref => {
|
|
90
95
|
config.specs.forEach(spec => {
|
|
91
|
-
// Loop through "
|
|
96
|
+
// Loop through "external_specs" to find the repository URL for each xref
|
|
92
97
|
xref.repoUrl = null;
|
|
93
98
|
xref.terms_dir = null;
|
|
94
99
|
xref.owner = null;
|
|
95
100
|
xref.repo = null;
|
|
96
101
|
|
|
97
|
-
spec.
|
|
102
|
+
spec.external_specs.forEach(repo => {
|
|
98
103
|
if (repo.external_spec === xref.externalSpec) {
|
|
99
104
|
xref.repoUrl = repo.url;
|
|
100
105
|
xref.terms_dir = repo.terms_dir;
|
|
@@ -61,8 +61,7 @@ function runJsonKeyValidatorSync() {
|
|
|
61
61
|
"logo",
|
|
62
62
|
"logo_link",
|
|
63
63
|
"source",
|
|
64
|
-
"external_specs"
|
|
65
|
-
"external_specs_repos",
|
|
64
|
+
"external_specs"
|
|
66
65
|
// "assets" // Commented out: We no longer check for 'assets' in the specs object
|
|
67
66
|
],
|
|
68
67
|
source: [
|
|
@@ -70,7 +69,8 @@ function runJsonKeyValidatorSync() {
|
|
|
70
69
|
"account",
|
|
71
70
|
"repo"
|
|
72
71
|
],
|
|
73
|
-
|
|
72
|
+
external_specs: [
|
|
73
|
+
"gh-page",
|
|
74
74
|
"external_spec",
|
|
75
75
|
"url",
|
|
76
76
|
"terms_dir"
|
|
@@ -95,9 +95,9 @@ function runJsonKeyValidatorSync() {
|
|
|
95
95
|
checkKeysSync(spec.source, expectedKeys.source, `specs[${index}].source`);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
// Check for keys inside the '
|
|
99
|
-
if (spec.
|
|
100
|
-
checkKeysSync(spec.
|
|
98
|
+
// Check for keys inside the 'external_specs' array, if present
|
|
99
|
+
if (spec.external_specs) {
|
|
100
|
+
checkKeysSync(spec.external_specs, expectedKeys.external_specs, `specs[${index}].external_specs`);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// The assets check is no longer necessary and has been commented out
|
package/src/references.js
CHANGED
|
@@ -35,8 +35,8 @@ function findExternalSpecByKey(config, key) {
|
|
|
35
35
|
for (const spec of config.specs) {
|
|
36
36
|
if (spec.external_specs) {
|
|
37
37
|
for (const externalSpec of spec.external_specs) {
|
|
38
|
-
if (externalSpec
|
|
39
|
-
return externalSpec
|
|
38
|
+
if (externalSpec.external_spec === key) {
|
|
39
|
+
return externalSpec;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -44,21 +44,33 @@ function findExternalSpecByKey(config, key) {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
async function fetchExternalSpecs(spec){
|
|
47
|
+
async function fetchExternalSpecs(spec) {
|
|
48
48
|
try {
|
|
49
49
|
let results = await Promise.all(
|
|
50
50
|
spec.external_specs.map(s => {
|
|
51
|
-
const url =
|
|
51
|
+
const url = s["gh-page"]; // Access the "gh-page" URL directly
|
|
52
52
|
return axios.get(url);
|
|
53
53
|
})
|
|
54
54
|
);
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
|
|
56
|
+
results = results
|
|
57
|
+
.map((r, index) =>
|
|
58
|
+
r.status === 200
|
|
59
|
+
? { [spec.external_specs[index].external_spec]: r.data }
|
|
60
|
+
: null
|
|
61
|
+
)
|
|
62
|
+
.filter(r => r); // Remove null values
|
|
63
|
+
|
|
64
|
+
return results.map(r =>
|
|
65
|
+
createNewDLWithTerms(Object.keys(r)[0], Object.values(r)[0])
|
|
66
|
+
);
|
|
57
67
|
} catch (e) {
|
|
58
|
-
|
|
68
|
+
console.log("\n SPEC-UP-T: " + e + "\n");
|
|
69
|
+
return []; // Return an empty array in case of errors
|
|
59
70
|
}
|
|
60
71
|
}
|
|
61
72
|
|
|
73
|
+
|
|
62
74
|
function createNewDLWithTerms(title, html) {
|
|
63
75
|
const dom = new JSDOM(html);
|
|
64
76
|
const document = dom.window.document;
|