This repository was archived by the owner on Jul 22, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
215 lines (205 loc) · 7.27 KB
/
Copy pathindex.html
File metadata and controls
215 lines (205 loc) · 7.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ASU Webspark Composer Packages</title>
<style>
:root {
--maroon: #8c1d40;
--gold: #ffc627;
--ink: #191919;
--muted: #5c5c5c;
--line: #e3e3e3;
--bg: #fafafa;
--gray2: #484848;
--code-bg: #f4f4f4;
}
* { box-sizing: border-box; }
body {
margin: 0;
font-family: Arial, sans-serif;
color: var(--ink);
background: var(--bg);
line-height: 1.5;
}
header {
background: var(--maroon);
color: #fff;
padding: 1.5rem 1.25rem;
border-bottom: 4px solid var(--gold);
}
header h1 { margin: 0 0 .25rem; font-size: 1.4rem; }
header p { margin: 0; opacity: .9; font-size: .95rem; }
main { max-width: 920px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
section { margin-bottom: 2rem; }
h2 { font-size: 1.1rem; border-bottom: 1px solid var(--line); padding-bottom: .35rem; }
h3 { font-size: 1rem; border-bottom: 1px solid var(--line); padding-bottom: .35rem; color: var(--gray2); }
code, pre {
font-family: "SF Mono", Menlo, Consolas, monospace;
font-size: .88rem;
}
pre {
background: var(--code-bg);
border: 1px solid var(--line);
border-radius: 6px;
padding: 1rem;
overflow-x: auto;
}
.pkg {
background: #fff;
border: 1px solid var(--line);
border-radius: 8px;
padding: 1rem 1.1rem;
margin-bottom: .85rem;
}
.pkg h3 { margin: 0 0 .15rem; font-size: 1rem; }
.pkg .type {
display: inline-block;
font-size: .72rem;
text-transform: uppercase;
letter-spacing: .03em;
color: var(--muted);
border: 1px solid var(--line);
border-radius: 999px;
padding: .05rem .5rem;
margin-left: .4rem;
vertical-align: middle;
}
.versions { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.ver {
font-family: "SF Mono", Menlo, Consolas, monospace;
font-size: .8rem;
background: var(--code-bg);
border: 1px solid var(--line);
border-radius: 4px;
padding: .1rem .45rem;
}
.ver.dev { border-color: var(--gold); background: #fff8e1; }
/* Tags that are links: keep the tag look, not the default link look. */
a.ver {
color: var(--ink);
text-decoration: none;
cursor: pointer;
transition: border-color .12s ease, background-color .12s ease;
}
a.ver:hover, a.ver:focus {
border-color: var(--maroon);
background: #fff;
text-decoration: none;
}
a.ver.dev:hover, a.ver.dev:focus { border-color: var(--gold); background: #fff3cd; }
.require { margin-top: .5rem; font-size: .85rem; color: var(--muted); }
.require strong { color: var(--ink); font-weight: 600; }
.status { color: var(--muted); font-style: italic; }
.error { color: var(--maroon); }
footer { color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); padding-top: 1rem; }
a { color: var(--maroon); }
</style>
</head>
<body>
<header>
<h1>ASU Webspark Composer Packages</h1>
<p>A static Composer repository served via GitHub Pages.</p>
</header>
<main>
<section>
<h2>Add this repository</h2>
<p>Add the following to your project's <code>composer.json</code>, then require packages as normal:</p>
<pre>{
"repositories": [
{ "type": "composer", "url": "https://asuwebplatforms.github.io/composer-packages-test/" }
]
}</pre>
<h3>Require a package</h3>
<pre>composer require asuwebplatforms/asu_brand</pre>
</section>
<section>
<h2>Available packages</h2>
<div id="packages"><p class="status">Loading packages…</p></div>
</section>
<footer>
<p>
Source of truth: each package's own <code>composer.json</code>.
Artifacts are stored as GitHub Release assets; this metadata is
generated automatically on publish. View
<a href="packages.json">packages.json</a>.
</p>
</footer>
</main>
<script>
(function () {
var container = document.getElementById("packages");
function esc(s) {
return String(s).replace(/[&<>"']/g, function (c) {
return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c];
});
}
// Sort versions: stable (desc) first, dev-* last.
function sortVersions(a, b) {
var aDev = /^dev-/.test(a), bDev = /^dev-/.test(b);
if (aDev !== bDev) return aDev ? 1 : -1;
return b.localeCompare(a, undefined, { numeric: true });
}
fetch("packages.json", { cache: "no-store" })
.then(function (r) {
if (!r.ok) throw new Error("HTTP " + r.status);
return r.json();
})
.then(function (data) {
var packages = (data && data.packages) || {};
var names = Object.keys(packages).sort();
if (names.length === 0) {
container.innerHTML = '<p class="status">No packages published yet.</p>';
return;
}
container.innerHTML = "";
names.forEach(function (name) {
var versionsObj = packages[name] || {};
var versions = Object.keys(versionsObj).sort(sortVersions);
// Use the newest version entry for type/require display.
var latest = versionsObj[versions[0]] || {};
var type = latest.type || "library";
var require = latest.require || {};
var verHtml = versions.map(function (v) {
var cls = /^dev-/.test(v) ? "ver dev" : "ver";
var entry = versionsObj[v] || {};
var dist = entry.dist && entry.dist.url;
var url = dist
? dist.replace(/\/releases\/download\/([^/]+)\/[^/]+$/, "/releases/tag/$1")
: null;
if (url) {
// Link the tag to its release page; keep the .ver styling by
// applying the class to the anchor itself.
return '<a class="' + cls + '" href="' + esc(url) + '"' +
' title="View release ' + esc(v) + " of " + esc(name) + '">' +
esc(v) + "</a>";
}
// No dist URL available: render a non-link tag.
return '<span class="' + cls + '">' + esc(v) + "</span>";
}).join("");
var reqKeys = Object.keys(require);
var reqHtml = "";
if (reqKeys.length) {
reqHtml = '<div class="require"><strong>requires:</strong> ' +
reqKeys.map(function (k) {
return esc(k) + " " + esc(require[k]);
}).join(", ") + "</div>";
}
var el = document.createElement("div");
el.className = "pkg";
el.innerHTML =
"<h3>" + esc(name) + '<span class="type">' + esc(type) + "</span></h3>" +
'<div class="versions">' + verHtml + "</div>" +
reqHtml;
container.appendChild(el);
});
})
.catch(function (err) {
container.innerHTML =
'<p class="error">Could not load packages.json (' + esc(err.message) + ").</p>";
});
})();
</script>
</body>
</html>