spec-up-t 1.6.14 → 1.6.16
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.6.
|
|
3
|
+
"version": "1.6.16",
|
|
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": {
|
|
@@ -131,8 +131,10 @@ jobs:
|
|
|
131
131
|
git commit -m "Collect external references" || echo "No changes to commit"
|
|
132
132
|
;;
|
|
133
133
|
freeze)
|
|
134
|
-
# snapshots/ is tracked in git
|
|
135
|
-
#
|
|
134
|
+
# snapshots/ is tracked in git and will be committed.
|
|
135
|
+
# Note: a GITHUB_TOKEN push does NOT automatically trigger other workflows
|
|
136
|
+
# (GitHub security restriction). render-and-deploy.yml is dispatched
|
|
137
|
+
# explicitly in the "Deploy frozen snapshots to GitHub Pages" step below.
|
|
136
138
|
git commit -m "Freeze specification" || echo "No changes to commit"
|
|
137
139
|
;;
|
|
138
140
|
custom-update)
|
|
@@ -146,6 +148,23 @@ jobs:
|
|
|
146
148
|
# Push changes
|
|
147
149
|
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:${{ github.ref_name }}
|
|
148
150
|
|
|
151
|
+
# After a freeze commit, render-and-deploy.yml must be dispatched explicitly.
|
|
152
|
+
# GitHub blocks other workflow runs triggered by GITHUB_TOKEN pushes (security
|
|
153
|
+
# restriction), so the push in "Commit and push changes" alone is not enough
|
|
154
|
+
# to propagate the new snapshot to the gh-pages branch.
|
|
155
|
+
# Dispatching render-and-deploy.yml here ensures:
|
|
156
|
+
# 1. The full render pipeline runs (including snapshots/ → docs/versions/ sync).
|
|
157
|
+
# 2. The updated docs/ (with the new frozen version) is deployed to gh-pages.
|
|
158
|
+
- name: Deploy frozen snapshots to GitHub Pages
|
|
159
|
+
if: success() && github.event.inputs.action_type == 'freeze'
|
|
160
|
+
run: |
|
|
161
|
+
curl -s -X POST \
|
|
162
|
+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
163
|
+
-H "Accept: application/vnd.github+json" \
|
|
164
|
+
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/render-and-deploy.yml/dispatches" \
|
|
165
|
+
-d "{\"ref\":\"${{ github.ref_name }}\"}"
|
|
166
|
+
echo "render-and-deploy.yml dispatched — frozen snapshots will be deployed to gh-pages"
|
|
167
|
+
|
|
149
168
|
- name: Clean up
|
|
150
169
|
if: always()
|
|
151
170
|
run: |
|
|
@@ -18,6 +18,34 @@ const fs = require('fs-extra');
|
|
|
18
18
|
const path = require('path');
|
|
19
19
|
const Logger = require('../utils/logger');
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Extracts snapshot labels from a hand-edited docs/versions/index.html.
|
|
23
|
+
* Parses every anchor whose href points to a version directory (e.g. "v1/")
|
|
24
|
+
* and maps the directory name to the visible link text.
|
|
25
|
+
*
|
|
26
|
+
* Example input: <a href="v1/">KERI Release 1.0</a>
|
|
27
|
+
* Example output: { "v1": "KERI Release 1.0" }
|
|
28
|
+
*
|
|
29
|
+
* The "Latest version" link (href="../") is intentionally ignored.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} indexHtmlPath - Absolute path to docs/versions/index.html.
|
|
32
|
+
* @returns {Object} Map of version directory names to label strings.
|
|
33
|
+
*/
|
|
34
|
+
function extractLabelsFromIndexHtml(indexHtmlPath) {
|
|
35
|
+
const labels = {};
|
|
36
|
+
const html = fs.readFileSync(indexHtmlPath, 'utf8');
|
|
37
|
+
// Match: href="v1/" or href="v1" (with or without trailing slash)
|
|
38
|
+
const linkPattern = /href="(v\d+)\/?">([^<]+)<\/a>/g;
|
|
39
|
+
let match = linkPattern.exec(html);
|
|
40
|
+
while (match !== null) {
|
|
41
|
+
const dirName = match[1];
|
|
42
|
+
const linkText = match[2].trim();
|
|
43
|
+
labels[dirName] = linkText;
|
|
44
|
+
match = linkPattern.exec(html);
|
|
45
|
+
}
|
|
46
|
+
return labels;
|
|
47
|
+
}
|
|
48
|
+
|
|
21
49
|
/**
|
|
22
50
|
* Migrates frozen snapshots from docs/versions/ to snapshots/.
|
|
23
51
|
* @param {string} outputPath - The output directory defined in specs.json (e.g. './docs').
|
|
@@ -57,21 +85,29 @@ function migrateVersionsToSnapshots(outputPath) {
|
|
|
57
85
|
});
|
|
58
86
|
|
|
59
87
|
// Always keep labels.json up to date in snapshots/.
|
|
88
|
+
// Priority order (highest wins):
|
|
89
|
+
// 1. Labels already in snapshots/labels.json (from previous migrations or freezes)
|
|
90
|
+
// 2. Labels extracted from hand-edited docs/versions/index.html
|
|
91
|
+
// 3. Labels from docs/versions/labels.json (auto-generated source)
|
|
60
92
|
const srcLabels = path.join(src, 'labels.json');
|
|
93
|
+
const srcIndexHtml = path.join(src, 'index.html');
|
|
61
94
|
const destLabels = path.join(dest, 'labels.json');
|
|
62
95
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
96
|
+
// Start from labels.json if it exists
|
|
97
|
+
const legacyLabels = fs.existsSync(srcLabels) ? fs.readJsonSync(srcLabels) : {};
|
|
98
|
+
|
|
99
|
+
// Overlay with labels parsed from index.html — these may be hand-edited
|
|
100
|
+
const htmlLabels = fs.existsSync(srcIndexHtml)
|
|
101
|
+
? extractLabelsFromIndexHtml(srcIndexHtml)
|
|
102
|
+
: {};
|
|
103
|
+
|
|
104
|
+
// Existing snapshots/labels.json wins on any conflict
|
|
105
|
+
const existingDestLabels = fs.existsSync(destLabels) ? fs.readJsonSync(destLabels) : {};
|
|
106
|
+
|
|
107
|
+
const merged = { ...legacyLabels, ...htmlLabels, ...existingDestLabels };
|
|
108
|
+
|
|
109
|
+
if (Object.keys(merged).length > 0) {
|
|
110
|
+
fs.writeJsonSync(destLabels, merged, { spaces: 2 });
|
|
75
111
|
}
|
|
76
112
|
|
|
77
113
|
if (migratedCount > 0) {
|