-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
334 lines (318 loc) · 20.6 KB
/
index.html
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Depbud</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<style type="text/css">
.navbar-depbud {
background-color: rgba(0,0,0,.03);
border: 1px solid rgba(0,0,0,.125);
border-radius: 3px;
margin: 20px 0;
}
.card-depbud {
margin-top: 12px;
}
.table {
table-layout:fixed;
}
.table td {
white-space: nowrap;
overflow: auto;
}
.table td pre {
font-size: 70%;
margin-bottom: 0;
}
</style>
</head>
<body>
<div class="container">
<nav class="navbar navbar-light navbar-depbud">
<a href="#" class="navbar-brand">
<img src="depbud.svg" alt="depbud" class="d-inline-block align-top" width="30" height="30">
Depbud
</a>
<a href="#help" class="btn btn-outline-primary" data-toggle="modal" data-target="#help">
Help! What is this?
</a>
</nav>
<div class="modal fade" id="help" tabindex="-1" role="dialog" aria-labelledby="helpLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="helpLabel">Help! What is this?</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p>This is Depbud! (like <a href="https://en.wikipedia.org/wiki/300_(film)" target="_blank">Leonidas</a> would have said it)</p>
<p>Ok, bad joke. Depbud is a nifty little dashboard that helps you manage your npm dependencies. There are two main features in Depbud; a quick overview of the version status of your dependencies and showing you in which files these dependencies are used.</p>
<p>The first thing to notice is the navigation. You have 5 available tabs. Under here is a brief explanation on what can be found under them: </p>
<ul>
<li>
<strong>Dependencies and Dev Dependencies</strong>
<p>From here you can see a list of all your dependencies as they are stated in our package.json file.</p>
<p>Before each dependency there's a little badge. They each represent the state that your dependency is in from looking at which version you're relying on and comparing that to the newest stable version available on NPM.</p>
<p><span class="badge badge-pill badge-danger"> </span> Says that there's a newer major version available.</p>
<p><span class="badge badge-pill badge-warning"> </span> Says that there's a newer minor or patch version available.</p>
<p><span class="badge badge-pill badge-success"> </span> Says that there's you're aligned with the newest version available.</p>
<p>If you expand a dependency you'll see some meta data on that dependency, link to NPM, author, description and some more along with a list of all the files where that dependency is required from.</p>
<p>This makes it easier to know where you're using that, in the event of breaking changes because of an update.</p>
</li>
<li>
<strong>Unused Dependencies and Unused Dev Dependencies:</strong>
<p>From here you'll get a list of all the dependencies stated in your package.json file, which you're not using in your codebase.</p>
<p>The tabs also include a "quick-fix" command you can fire off, if you want to clean up your package.json file.</p>
<p><strong>Note: Use the "quick-fix" command with caution, as there could be false positives.</strong></p>
</li>
<li>
<strong>Missing Dependencies:</strong>
<p>Here you'll get a list of requried dependencies in your codebase, which was not found in you package.json file</p>
<p>This helps you consider which dependencies you might want to add to you package.json file.</p>
<p><strong>Note: This is still being worked on, so there could be some false positives here</strong></p>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs" role="tablist" id="tabs">
<li class="nav-item">
<a href="#deps" class="nav-link active" id="deps-tab" data-toggle="tab" role="tab" aria-controls="deps" aria-expanded="true">
Dependencies
</a>
</li>
<li class="nav-item">
<a href="#dev-deps" class="nav-link" id="dev-deps-tab" data-toggle="tab" role="tab" aria-controls="dev-deps">
Dev Dependencies
</a>
</li>
<li class="nav-item">
<a href="#unused" class="nav-link" id="unused-tab" data-toggle="tab" role="tab" aria-controls="unused">
Unused Dependencies
</a>
</li>
<li class="nav-item">
<a href="#unused-dev" class="nav-link" id="unused-dev-tab" data-toggle="tab" role="tab" aria-controls="unused-dev">
Unused Dev Dependencies
</a>
</li>
<li class="nav-item">
<a href="#missing" class="nav-link" id="missing-tab" data-toggle="tab" role="tab" aria-controls="missing">
Missing Dependencies
</a>
</li>
</ul>
</div>
<div class="card-body">
<div class="tab-content" id="tabsContent">
<div class="tab-pane fade show active" id="deps">
<ul class="list-group">
<% _.forIn(david.deps, function(value, key) { %>
<li class="list-group-item">
<a href="#<%= key.replace('.', '♥') %>" class="btn btn-light btn-block text-left" data-toggle="collapse">
<% if (value.diff === 'major') { %>
<span class="badge badge-pill badge-danger"> </span>
<% } else if (value.diff === 'minor' || value.diff === 'patch') { %>
<span class="badge badge-pill badge-warning"> </span>
<% } else { %>
<span class="badge badge-pill badge-success"> </span>
<% } %>
<%= key %>
<span class="badge badge-secondary float-right">Used in <strong><%= _.size(value.using) %></strong> files</span>
</a>
<div class="collapse" id="<%= key.replace('.', '♥') %>">
<div class="card card-depbud">
<div class="card-body">
<a href="https://www.npmjs.com/package/" target="_blank">
<h4 class="card-title"> </h4>
</a>
<a href="https://www.npmjs.com/~" target="_blank">
<h6 class="card-subtitle mb-2 text-muted"> </h6>
</a>
<p class="card-text"> </p>
<% if (value.diff === 'major') { %>
<div class="alert alert-danger" role="alert">
<strong>Whoa!</strong> There is a newer major version available.
The required version is <strong><%= value.required %></strong>, but the newest stable is <strong><%= value.stable %></strong>
</div>
<% } else if (value.diff === 'minor' || value.diff === 'patch') { %>
<div class="alert alert-warning" role="alert">
<strong>Hmm!</strong> There is a newer minor or patch version available.
The required version is <strong><%= value.required %></strong>, but the newest stable is <strong><%= value.stable %></strong>
</div>
<% } else { %>
<div class="alert alert-success" role="alert">
<strong>Sweet!</strong> You're on the latest stable.
The required version is <strong><%= value.required %></strong>, and the newest stable is <strong><%= value.stable %></strong>
</div>
<% } %>
</div>
<table class="table table-sm table-striped table-hover table-responsive">
<thead class="thead-inverse">
<tr>
<th>Path</th>
</tr>
</thead>
<tbody>
<% _.forIn(value.using, function(v, k) { %>
<tr>
<td>
<pre><%= v %></pre>
</td>
</tr>
<% }) %>
</tbody>
</table>
</div>
</div>
</li>
<% }) %>
</ul>
</div>
<div class="tab-pane fade" id="dev-deps">
<ul class="list-group">
<% _.forIn(david.devDeps, function(value, key) { %>
<li class="list-group-item">
<a href="#<%= key.replace('.', '♥') %>" class="btn btn-light btn-block text-left" data-toggle="collapse">
<% if (value.diff === 'major') { %>
<span class="badge badge-pill badge-danger"> </span>
<% } else if (value.diff === 'minor' || value.diff === 'patch') { %>
<span class="badge badge-pill badge-warning"> </span>
<% } else { %>
<span class="badge badge-pill badge-success"> </span>
<% } %>
<%= key %>
</a>
<div class="collapse" id="<%= key.replace('.', '♥') %>">
<div class="card card-depbud">
<div class="card-body">
<a href="https://www.npmjs.com/package/" target="_blank">
<h4 class="card-title"> </h4>
</a>
<a href="https://www.npmjs.com/~" target="_blank">
<h6 class="card-subtitle mb-2 text-muted"> </h6>
</a>
<p class="card-text"> </p>
<% if (value.diff === 'major') { %>
<div class="alert alert-danger" role="alert">
<strong>Whoa!</strong> There is a newer major version available.
The required version is <strong><%= value.required %></strong>, but the newest stable is <strong><%= value.stable %></strong>
</div>
<% } else if (value.diff === 'minor' || value.diff === 'patch') { %>
<div class="alert alert-warning" role="alert">
<strong>Hmm!</strong> There is a newer minor or patch version available.
The required version is <strong><%= value.required %></strong>, but the newest stable is <strong><%= value.stable %></strong>
</div>
<% } else { %>
<div class="alert alert-success" role="alert">
<strong>Sweet!</strong> You're on the latest stable.
The required version is <strong><%= value.required %></strong>, and the newest stable is <strong><%= value.stable %></strong>
</div>
<% } %>
</div>
<table class="table table-sm table-striped table-hover table-responsive">
<thead class="thead-inverse">
<tr>
<th>Path</th>
</tr>
</thead>
<tbody>
<% _.forIn(value.using, function(v, k) { %>
<tr>
<td>
<pre><%= v %></pre>
</td>
</tr>
<% }) %>
</tbody>
</table>
</div>
</div>
</li>
<% }) %>
</ul>
</div>
<div class="tab-pane fade" id="unused">
<ul class="list-group">
<li class="list-group-item list-group-item-primary">
<strong>Quick-fix:</strong>
<code>
npm uninstall --save
<% _.forIn(depcheck.dependencies, function(value, key) { %>
<%= value %>
<% }) %>
</code>
</li>
<% _.forIn(depcheck.dependencies, function(value, key) { %>
<li class="list-group-item">
<a href="https://www.npmjs.com/package/<%= value %>" target="_blank">
<%= value %>
</a>
</li>
<% }) %>
</ul>
</div>
<div class="tab-pane fade" id="unused-dev">
<ul class="list-group">
<li class="list-group-item list-group-item-primary">
<strong>Quick-fix:</strong>
<code>
npm uninstall --save-dev
<% _.forIn(depcheck.devDependencies, function(value, key) { %>
<%= value %>
<% }) %>
</code>
</li>
<% _.forIn(depcheck.devDependencies, function(value, key) { %>
<li class="list-group-item">
<a href="https://www.npmjs.com/package/<%= value %>" target="_blank">
<%= value %>
</a>
</li>
<% }) %>
</ul>
</div>
<div class="tab-pane fade" id="missing">
<ul class="list-group">
<% _.forIn(depcheck.missing, function(value, key) { %>
<li class="list-group-item">
<%= key %>
</li>
<% }) %>
</ul>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
<script>
$(function() {
$('.collapse').on('show.bs.collapse', function(event) {
var packageId = event.currentTarget.id;
$.get('/api/info/' + packageId.replace('♥', '.'), function(data) {
$('#' + packageId).find('.card-title').text(data.name)
$('#' + packageId).find('.card-title').parent().attr('href', 'https://www.npmjs.com/package/' + data.name)
$('#' + packageId).find('.card-subtitle').text(data._npmUser.name)
$('#' + packageId).find('.card-subtitle').parent().attr('href', 'https://www.npmjs.com/~' + data._npmUser.name)
$('#' + packageId).find('.card-text').text(data.description)
})
})
})
</script>
</body>
</html>