-
Notifications
You must be signed in to change notification settings - Fork 1
/
view.ejs
219 lines (203 loc) · 7.73 KB
/
view.ejs
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
216
217
218
219
<article class="package">
<div class="details">
<header>
<section class="row">
<section class="sixcol">
<h1 class="row">
<%= package.name %> / <%= package.version %>
<% if (package.modified) { %>
<small data-date="<%= package.modified.full %>">
last updated <%= package.modified.ago %>
</small>
<% } %>
<% if (package.created) { %>
<small data-date="<%= package.created.full %>">
created on <%= package.created.human %>
</small>
<% } %>
</h1>
<aside class="row">
<div class="part">
<% if (package.licenses) { %>
<% package.licenses.forEach(function (license) { %>
<% var info = licenses(license) %>
<% if (info && info.url) { %><a href="<%= info.url %>" title="<%= info.full %>" target="_blank"><% } %>
<strong><%= license %></strong>
<% if (info && info.url) { %></a><% } %>
<% }) %>
<% } else { %>
<strong>Unknown</strong>
<% } %>
</div>
<div class="part">
<s class="shift ss-icon ss-standard ss-star"></s>
<%= (package.starred || []).length %>
</div>
<% if ('github' in locals && github) { %>
<div class="part">
<a class="stargazers" href="https://github.com/<%= package.github.user %>/<%= package.github.repo %>/stargazers" target="_blank">
<s class="shift ss-icon ss-social-circle ss-octocat"></s>
<%= github.stargazers_count || 0 %>
</a>
</div>
<% } %>
<% if (package.homepage || package.bugs) { %>
<div class="part">
<% if (package.homepage) { %>
<a class="shift ss-icon ss-standard ss-home" href="<%= package.homepage.url %>" rel="nofollow" target="_blank"></a>
<% } %>
<% if (package.bugs) { %>
<a class="shift ss-icon ss-standard ss-alert" href="<%= package.bugs.url %>" rel="nofollow" target="_blank"></a>
<% } %>
</div>
<% } %>
</aside>
</section>
<section class="sixcol last utility">
<div class="row">
<h3 class="twocol">Install</h3>
<pre class="tencol last">npm install --save <%= package.name %></pre>
</div>
<% if (package.github) { %>
<div class="row">
<h3 class="twocol">Clone</h3>
<pre class="tencol last">git clone [email protected]:<%= package.github.user %>/<%= package.github.repo %>.git</pre>
</div>
<% } %>
</section>
</section>
</header>
<section class="properties row">
<div class="sixcol dependencies">
<h2>
<s class="ss-icon ss-standard ss-grid"></s>
dependencies
<% if (shrinkwrap.length > 5) { %>
<small class="right">
<% var url = dependenciesPagelet ? dependenciesPagelet +'/'+ package.name : '#/more-dependencies' %>
<a href="<%= url %>" class="show-all" data-text="show less">
show all <%= shrinkwrap.length %>
</a>
</small>
<% } %>
</h2>
<% if (shrinkwrap.length) { var sub = false; %>
<table class="more">
<tbody>
<% shrinkwrap.forEach(function (dependency, index) { %>
<% if (dependenciesPagelet && (index >= 5 || dependency.depth !== 0)) return; %>
<tr class="<%= index >= 5 ? ' gone' : '' %>">
<td class="type">
<% if (!index) { %>
<abbr title="The module's main dependencies">main</abbr>
<% } else if (dependency.depth !== 0 && !sub) { sub = true; %>
<abbr title="Dependencies of dependencies">sub</abbr>
<% } %>
</td>
<td>
<s class="status<%= !(dependency.licenses || []).length ? ' missing' : '' %>">
</s>
</td>
<td class="name">
<a href="/package/<%= dependency.name %>"><%= dependency.name %></a>
</td>
<td class="version"><%= dependency.version %></td>
<td class="license right">
<% if (dependency.licenses) { %>
<%-
!(dependency.licenses || []).length ? 'Unknown' : dependency.licenses.map(function (license) {
var info = licenses(license);
return info && info.url
? '<a href="'+ info.url +'" title="'+ info.full +'" target="_blank">'+ license +'</a>'
: license;
}).join(', ')
%>
<% } else { %>
Unknown
<% } %>
</td>
</tr>
<% }) %>
</tbody>
</table>
<% } else { %>
<p class="row">No dependencies listed.</p>
<% } %>
</div>
<div class="sixcol maintainers last">
<h2>
<s class="ss-icon ss-standard ss-users"></s>
maintainers
<% if (package.maintainers.length > 4) { %>
<small class="right">
<a href="#/more-maintainers" class="show-all" data-text="show less">
+<%= package.maintainers.length - 4 %> more
</a>
</small>
<% } %>
</h2>
<% if (package.maintainers.length) { %>
<% package.maintainers.forEach(function (maintainer, index) { %>
<div class="maintainer sixcol<%= index >= 4 ? ' gone' : '' %><%= index % 2 ? ' last' : '' %>">
<% if (maintainer.gravatar) { %>
<img src="<%= maintainer.gravatar %>?s=120" alt="<%= maintainer.name %>" class="gravatar">
<% } %>
<strong class="name"><%= maintainer.name %></strong>
</div>
<% });} else { %>
<p class="row">No maintainers listed.</p>
<% } %>
</div>
<div class="sixcol versions">
<h2>
<s class="ss-icon ss-standard ss-layers"></s>
versions
<% var n = Object.keys(package.releases).length; if (n > 5) { %>
<small class="right">
<a href="#/more-releases" class="show-all" data-text="show less">
<%= n %> total
</a>
</small>
<% } %>
</h2>
<% if (package.time && n) { %>
<table class="more">
<tbody>
<% Object.keys(package.releases).forEach(function (version, i) { %>
<tr class="<%= i >= 5 ? 'gone' : '' %>">
<td class="version"><%= version %></td>
<td class="date">
<%= (package.time[version] || {}).ago || 'unknown' %>
</td>
<td class="releaser right">
<%= (package.releases[version] || {}).name || 'anonymous' %>
</td>
</tr>
<% }); %>
</tbody>
</table>
<% } %>
</div>
<div class="sixcol downloads last">
<div data-pagelet="sparklet" class="graph"></div>
<%= stats.downloads %> Downloads yesterday.
</div>
</section>
</div>
<% if ('readme' in locals) { %>
<section class="readme">
<article class="row markdown">
<div class="twocol last right icon">
<h3>readme</h3>
<s class="ss-icon ss-standard ss-file"></s>
</div>
<%- readme %>
</article>
</section>
<% } %>
</article>
<!--
@TODO table of contents generation?
@TODO twitter and other profile information
@TODO description, current version, gravatar, release date.
-->