show-a-license 2.0.4 → 2.0.5
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/LICENSE +1 -1
- package/README.md +10 -122
- package/lib/index.js +33 -32
- package/package.json +1 -2
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2015-
|
|
3
|
+
Copyright (c) 2015-26 Ionică Bizău <bizauionica@gmail.com> (https://ionicabizau.net)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,41 +1,13 @@
|
|
|
1
1
|
<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. -->
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
3
|
# show-a-license
|
|
21
4
|
|
|
22
5
|
[![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [](https://github.com/IonicaBizau/ama) [](https://www.npmjs.com/package/show-a-license) [](https://www.npmjs.com/package/show-a-license) [](https://www.codementor.io/@johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github)
|
|
23
6
|
|
|
24
7
|
<a href="https://www.buymeacoffee.com/H96WwChMy" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png" alt="Buy Me A Coffee"></a>
|
|
25
8
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
9
|
> A site to provide an easy way to show licenses and their human-readable explanations.
|
|
33
10
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
11
|
## Your help is needed! :heart:
|
|
40
12
|
|
|
41
13
|
|
|
@@ -59,33 +31,7 @@ Whether you just want to show a license or see its human-readable explanation, y
|
|
|
59
31
|
- In the end, run in parallel `npm run watch` and `npm start`
|
|
60
32
|
- Open in your browser [http://localhost:9000/index.html](http://localhost:9000/index.html).
|
|
61
33
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
34
|
[](#)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
35
|
|
|
90
36
|
## Examples
|
|
91
37
|
|
|
@@ -95,65 +41,34 @@ Whether you just want to show a license or see its human-readable explanation, y
|
|
|
95
41
|
- To set the starting copyright year use the `year` parameter: https://ionicabizau.github.io/show-a-license?year=2013&fullname=Alice#license-mit
|
|
96
42
|
- To hide the explanations column, you have to use `hide_explanations=true`: https://ionicabizau.github.io/show-a-license?hide_explanations=true&year=2013&fullname=Alice#license-mit
|
|
97
43
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
44
|
## :question: Get Help
|
|
106
45
|
|
|
107
|
-
There are few ways to get help:
|
|
108
|
-
|
|
109
|
-
|
|
46
|
+
There are a few ways to get help:
|
|
110
47
|
|
|
111
|
-
1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.
|
|
48
|
+
1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long as you add a link to your Stack Overflow question.
|
|
112
49
|
2. For bug reports and feature requests, open issues. :bug:
|
|
113
50
|
3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket:
|
|
114
51
|
|
|
52
|
+
## :yum: How to Contribute
|
|
115
53
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
## :yum: How to contribute
|
|
133
54
|
Have an idea? Found a bug? See [how to contribute][contributing].
|
|
134
55
|
|
|
56
|
+
## :sparkling_heart: Support My Projects
|
|
135
57
|
|
|
136
|
-
|
|
137
|
-
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously,
|
|
138
|
-
this takes time. You can integrate and use these projects in your applications *for free*! You can even change the source code and redistribute (even resell it).
|
|
139
|
-
|
|
140
|
-
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:
|
|
58
|
+
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications *for free*! You can even change the source code and redistribute it (even resell it).
|
|
141
59
|
|
|
60
|
+
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are a few ways you can do it:
|
|
142
61
|
|
|
143
62
|
- Starring and sharing the projects you like :rocket:
|
|
144
|
-
- [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you
|
|
63
|
+
- [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you for years if you buy me one. :grin: :book:
|
|
145
64
|
- [![PayPal][badge_paypal]][paypal-donations]—You can make one-time donations via PayPal. I'll probably buy a ~~coffee~~ tea. :tea:
|
|
146
65
|
- [![Support me on Patreon][badge_patreon]][patreon]—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).
|
|
147
|
-
- **Bitcoin**—You can send me bitcoins at this address (or scanning the code below): `1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6`
|
|
148
|
-
|
|
149
|
-

|
|
66
|
+
- **Bitcoin**—You can send me bitcoins at this address (or by scanning the code below): `1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6`
|
|
150
67
|
|
|
68
|
+

|
|
151
69
|
|
|
152
70
|
Thanks! :heart:
|
|
153
71
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
72
|
### Explaining a license
|
|
158
73
|
|
|
159
74
|
|
|
@@ -180,42 +95,15 @@ If the license you're searching for is missing, make sure you add it.
|
|
|
180
95
|
4. Add yourself as contributor in [`package.json`](/package.json).
|
|
181
96
|
5. Raise a pull request! :tada:
|
|
182
97
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
98
|
## :cake: Thanks
|
|
190
99
|
|
|
191
100
|
- [github/choosealicense.com](https://github.com/github/choosealicense.com)–a good inspiration source (some ideas and CSS were taken from here) :sparkle:
|
|
192
101
|
- [**@Cerberus-tm**](https://github.com/Cerberus-tm)–who had the idea for the site name :cake:
|
|
193
102
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
103
|
## :scroll: License
|
|
211
104
|
|
|
212
105
|
[MIT][license] © [Ionică Bizău][website]
|
|
213
106
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
107
|
[license]: /LICENSE
|
|
220
108
|
[website]: https://ionicabizau.net
|
|
221
109
|
[contributing]: /CONTRIBUTING.md
|
|
@@ -225,5 +113,5 @@ If the license you're searching for is missing, make sure you add it.
|
|
|
225
113
|
[badge_paypal]: https://ionicabizau.github.io/badges/paypal.svg
|
|
226
114
|
[badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg
|
|
227
115
|
[patreon]: https://www.patreon.com/ionicabizau
|
|
228
|
-
[amazon]:
|
|
116
|
+
[amazon]: https://amzn.eu/hRo9sIZ
|
|
229
117
|
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW
|
package/lib/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
// Dependencies
|
|
4
|
-
var $ = require("elm-select")
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
var $ = require("elm-select")
|
|
3
|
+
, _fetch = require("whatwg-fetch")
|
|
4
|
+
, sameTime = require("same-time")
|
|
5
|
+
, barbe = require("barbe")
|
|
6
|
+
, Err = require("err")
|
|
7
|
+
, yearRange = require("year-range")
|
|
8
|
+
;
|
|
10
9
|
|
|
11
10
|
// Constants
|
|
12
11
|
var HASH_PREFIX = "#license-";
|
|
13
12
|
|
|
14
13
|
// Get the elements
|
|
15
|
-
var licenseTable = $(".license-view table")[0]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
form = $('form')[0]
|
|
14
|
+
var licenseTable = $(".license-view table")[0]
|
|
15
|
+
, tableTbody = $("tbody", licenseTable)[0]
|
|
16
|
+
, viewExplanationsEl = $("tfoot", licenseTable)[0]
|
|
17
|
+
, searchLicenseEl = $("input.search-license-name.awesomplete")[0]
|
|
18
|
+
, linkLicenseEl = $("input.link-license-name.awesomplete")[0]
|
|
19
|
+
form = $('form')[0]
|
|
20
|
+
;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
let licenses = _licenses.join(",");
|
|
23
23
|
|
|
24
24
|
searchLicenseEl.setAttribute("data-list", licenses);
|
|
25
25
|
linkLicenseEl.setAttribute("data-list", licenses);
|
|
@@ -54,7 +54,7 @@ function checkExplanationState() {
|
|
|
54
54
|
viewExplanationsEl.addEventListener("click", function (e) {
|
|
55
55
|
e.preventDefault();
|
|
56
56
|
Url.updateSearchParam("hide_explanations", showExplanations ? "true" : undefined);
|
|
57
|
-
location.reload()
|
|
57
|
+
location.reload()
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
function showNormalView() {
|
|
@@ -65,11 +65,13 @@ function showNormalView() {
|
|
|
65
65
|
elm.classList.remove("hide");
|
|
66
66
|
});
|
|
67
67
|
searchLicenseEl.focus();
|
|
68
|
+
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
function renderInfo(c) {
|
|
71
|
-
var data = {}
|
|
72
|
-
|
|
72
|
+
var data = {}
|
|
73
|
+
, startYear = parseInt(Url.queryString("year"))
|
|
74
|
+
;
|
|
73
75
|
|
|
74
76
|
data.year = startYear;
|
|
75
77
|
data.fullname = Url.queryString("fullname");
|
|
@@ -104,16 +106,17 @@ function doRequest(url) {
|
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
function getLicense(license, fn) {
|
|
107
|
-
sameTime([
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
sameTime([
|
|
110
|
+
doRequest("https://ionicabizau.github.io/show-a-license/licenses/" + license + ".txt")
|
|
111
|
+
, doRequest("https://ionicabizau.github.io/show-a-license/explanations/" + license + ".txt")
|
|
112
|
+
], function (err, data) {
|
|
113
|
+
if (err) { return fn(err); }
|
|
111
114
|
data = data.map(function (c) {
|
|
112
115
|
return c.split("\n\n");
|
|
113
116
|
});
|
|
114
117
|
fn(null, {
|
|
115
|
-
license: data[0]
|
|
116
|
-
|
|
118
|
+
license: data[0]
|
|
119
|
+
, explanation: data[1]
|
|
117
120
|
});
|
|
118
121
|
});
|
|
119
122
|
}
|
|
@@ -121,10 +124,10 @@ function getLicense(license, fn) {
|
|
|
121
124
|
function showError(err) {
|
|
122
125
|
err = err[0] || err;
|
|
123
126
|
var sweetErr = {
|
|
124
|
-
title: "Oops..."
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
title: "Oops..."
|
|
128
|
+
, text: err.toString()
|
|
129
|
+
, type: "error"
|
|
130
|
+
, html: true
|
|
128
131
|
};
|
|
129
132
|
|
|
130
133
|
// License not found
|
|
@@ -182,13 +185,11 @@ function showLicenseView(license) {
|
|
|
182
185
|
|
|
183
186
|
function checkHash() {
|
|
184
187
|
var hash = location.hash;
|
|
185
|
-
if (hash.indexOf(HASH_PREFIX) !== 0) {
|
|
186
|
-
return showNormalView();
|
|
187
|
-
}
|
|
188
|
+
if (hash.indexOf(HASH_PREFIX) !== 0) { return showNormalView(); }
|
|
188
189
|
var license = hash.substring(HASH_PREFIX.length).toLowerCase();
|
|
189
190
|
showLicenseView(license);
|
|
190
191
|
checkExplanationState();
|
|
191
192
|
}
|
|
192
193
|
|
|
193
194
|
window.addEventListener("hashchange", checkHash);
|
|
194
|
-
window.addEventListener("load", checkHash);
|
|
195
|
+
window.addEventListener("load", checkHash);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "show-a-license",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "A site to provide an easy way to show licenses and their human-readable explanations.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -142,7 +142,6 @@
|
|
|
142
142
|
"cli.js",
|
|
143
143
|
"index.js",
|
|
144
144
|
"index.d.ts",
|
|
145
|
-
"package-lock.json",
|
|
146
145
|
"bloggify.js",
|
|
147
146
|
"bloggify.json",
|
|
148
147
|
"bloggify/"
|