spec-up-t 1.0.89 → 1.0.90
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-xtrefs-data.js +19 -17
- package/src/utils/doesUrlExist.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.90",
|
|
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-xtrefs-data.js
CHANGED
|
@@ -24,11 +24,10 @@ const externalSpecsRepos = config.specs[0].external_specs;
|
|
|
24
24
|
// Check if the URLs for the external specs repositories are valid, and prompt the user to abort if they are not.
|
|
25
25
|
externalSpecsRepos.forEach(repo => {
|
|
26
26
|
// Construct the URL for the terms directory of the repository
|
|
27
|
-
const termsDirUrl = `${repo.url}/blob/main/${repo.terms_dir}`;
|
|
28
27
|
|
|
29
|
-
doesUrlExist(
|
|
28
|
+
doesUrlExist(repo.url, repo.terms_dir).then(exists => {
|
|
30
29
|
if (!exists) {
|
|
31
|
-
const userInput = readlineSync.question(`\n SPEC-UP-T: This external reference is not a valid URL:\n ${
|
|
30
|
+
const userInput = readlineSync.question(`\n SPEC-UP-T: This external reference is not a valid URL:\n Repository: ${repo.url},\n Terms directory: ${repo.terms_dir}\n Do you want to stop? (yes/no): `);
|
|
32
31
|
if (userInput.toLowerCase() === 'yes' || userInput.toLowerCase() === 'y') {
|
|
33
32
|
console.log('Stopping...');
|
|
34
33
|
process.exit(1);
|
|
@@ -185,20 +184,23 @@ function updateXTrefs(GITHUB_API_TOKEN, skipExisting) {
|
|
|
185
184
|
try {
|
|
186
185
|
for (let xtref of allXTrefs.xtrefs) {
|
|
187
186
|
const fetchedData = await searchGitHubCode(GITHUB_API_TOKEN, xtref.term, xtref.owner, xtref.repo, xtref.terms_dir);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
xtref
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
187
|
+
if (fetchedData.data.items.length === 0) {
|
|
188
|
+
xtref.commitHash = "not found";
|
|
189
|
+
xtref.content = "This term was not found in the external repository.";
|
|
190
|
+
} else {
|
|
191
|
+
fetchedData.data.items.forEach(item => {
|
|
192
|
+
// If the term is found according to the matchTerm function (in the first line, line should start with “[[def:), etc) add the commit hash and content to the xtref object
|
|
193
|
+
if (matchTerm(item.content, xtref.term)) {
|
|
194
|
+
xtref.commitHash = item.sha;
|
|
195
|
+
xtref.content = item.content;
|
|
196
|
+
console.log(`\n SPEC-UP-T: Match found for term: ${xtref.term} in ${xtref.externalSpec};`);
|
|
197
|
+
} else {
|
|
198
|
+
xtref.commitHash = "not found";
|
|
199
|
+
xtref.content = "This term was not found in the external repository.";
|
|
200
|
+
console.log(`\n SPEC-UP-T: No match found for term: ${xtref.term} in ${xtref.externalSpec};`);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
202
204
|
}
|
|
203
205
|
|
|
204
206
|
const allXTrefsStr = JSON.stringify(allXTrefs, null, 2);
|