spec-up-t 1.0.60 → 1.0.71
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.71",
|
|
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
|
@@ -30,12 +30,13 @@ const outputPathJS = 'output/xrefs-data.js';
|
|
|
30
30
|
const outputPathJSTimeStamped = 'output/xrefs-history/xrefs-data-' + Date.now() + '.js';
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
function
|
|
33
|
+
function addAllXrefs(GITHUB_API_TOKEN) {
|
|
34
34
|
// Set headers for GitHub API requests. Include an authorization token if provided.
|
|
35
35
|
const fetchHeaders = {
|
|
36
36
|
'Accept': 'application/vnd.github.v3+json'
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
+
// If GITHUB_API_TOKEN is present, it adds an Authorization header to the fetchHeaders object with the value set to token ${GITHUB_API_TOKEN}. This header is used to authenticate requests to the GitHub API, allowing the user to make authenticated requests which have higher rate limits compared to unauthenticated requests.
|
|
39
40
|
if (GITHUB_API_TOKEN) {
|
|
40
41
|
fetchHeaders['Authorization'] = `token ${GITHUB_API_TOKEN}`;
|
|
41
42
|
} else {
|
|
@@ -110,7 +111,7 @@ function getXrefsData(GITHUB_API_TOKEN) {
|
|
|
110
111
|
});
|
|
111
112
|
|
|
112
113
|
// Loop through "external_specs" to find the site URL for each xref
|
|
113
|
-
|
|
114
|
+
|
|
114
115
|
xref.site = null;
|
|
115
116
|
if (spec.external_specs) {
|
|
116
117
|
spec.external_specs.forEach(externalSpec => {
|
|
@@ -204,6 +205,11 @@ function getXrefsData(GITHUB_API_TOKEN) {
|
|
|
204
205
|
const stringReadyForFileWrite = `const allXrefs = ${allXrefsStr};`;
|
|
205
206
|
fs.writeFileSync(outputPathJS, stringReadyForFileWrite, 'utf8');
|
|
206
207
|
fs.writeFileSync(outputPathJSTimeStamped, stringReadyForFileWrite, 'utf8');
|
|
208
|
+
|
|
209
|
+
// Run the render function to update the HTML file
|
|
210
|
+
require('../index.js')({ nowatch: true });
|
|
211
|
+
}).catch(err => {
|
|
212
|
+
console.error('Error:', err);
|
|
207
213
|
});
|
|
208
214
|
}
|
|
209
215
|
|
|
@@ -241,16 +247,21 @@ function removeXref(term, externalSpec) {
|
|
|
241
247
|
fs.writeFileSync(outputPathJS, stringReadyForFileWrite, 'utf8');
|
|
242
248
|
|
|
243
249
|
messages.push(`\n SPEC-UP-T: Entry with term "${term}" and externalSpec "${externalSpec}" removed.\n`);
|
|
250
|
+
|
|
251
|
+
// Run the render function to update the HTML file
|
|
252
|
+
require('../index.js')({ nowatch: true });
|
|
253
|
+
|
|
244
254
|
} catch (error) {
|
|
245
255
|
messages.push(`\n SPEC-UP-T: An error occurred - ${error.message}\n`);
|
|
246
256
|
}
|
|
247
257
|
|
|
248
258
|
// TODO: messages are not used at the moment, since they apparently are not returned to the calling script. Fix this.
|
|
259
|
+
|
|
249
260
|
return messages;
|
|
250
261
|
}
|
|
251
262
|
|
|
252
|
-
// Export the
|
|
263
|
+
// Export the addAllXrefs and removeXref functions for use in other modules.
|
|
253
264
|
module.exports = {
|
|
254
|
-
|
|
265
|
+
addAllXrefs,
|
|
255
266
|
removeXref
|
|
256
267
|
}
|
package/src/references.js
CHANGED
|
@@ -48,7 +48,7 @@ async function fetchExternalSpecs(spec) {
|
|
|
48
48
|
try {
|
|
49
49
|
let results = await Promise.all(
|
|
50
50
|
spec.external_specs.map(s => {
|
|
51
|
-
const url = s["
|
|
51
|
+
const url = s["gh_page"]; // Access the "gh_page" URL directly
|
|
52
52
|
return axios.get(url);
|
|
53
53
|
})
|
|
54
54
|
);
|