aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/github-from-package
diff options
context:
space:
mode:
authorpack <pack@packgekko.xyz>2026-08-09 10:37:07 +0000
committerpack <pack@packgekko.xyz>2026-08-09 10:37:07 +0000
commit55a4f1fc869e41aca748c63d3018f0448b1606e0 (patch)
treed132d1d01772b6d53faee3e63c534dea5706b78a /node_modules/github-from-package
downloadcrud-55a4f1fc869e41aca748c63d3018f0448b1606e0.tar.gz
first commit
Diffstat (limited to 'node_modules/github-from-package')
-rw-r--r--node_modules/github-from-package/.travis.yml4
-rw-r--r--node_modules/github-from-package/LICENSE18
-rw-r--r--node_modules/github-from-package/example/package.json8
-rw-r--r--node_modules/github-from-package/example/url.js3
-rw-r--r--node_modules/github-from-package/index.js17
-rw-r--r--node_modules/github-from-package/package.json30
-rw-r--r--node_modules/github-from-package/readme.markdown53
-rw-r--r--node_modules/github-from-package/test/a.json8
-rw-r--r--node_modules/github-from-package/test/b.json5
-rw-r--r--node_modules/github-from-package/test/c.json5
-rw-r--r--node_modules/github-from-package/test/d.json7
-rw-r--r--node_modules/github-from-package/test/e.json5
-rw-r--r--node_modules/github-from-package/test/url.js19
13 files changed, 182 insertions, 0 deletions
diff --git a/node_modules/github-from-package/.travis.yml b/node_modules/github-from-package/.travis.yml
new file mode 100644
index 0000000..895dbd3
--- /dev/null
+++ b/node_modules/github-from-package/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.6
+ - 0.8
diff --git a/node_modules/github-from-package/LICENSE b/node_modules/github-from-package/LICENSE
new file mode 100644
index 0000000..ee27ba4
--- /dev/null
+++ b/node_modules/github-from-package/LICENSE
@@ -0,0 +1,18 @@
+This software is released under the MIT license:
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/github-from-package/example/package.json b/node_modules/github-from-package/example/package.json
new file mode 100644
index 0000000..03494f4
--- /dev/null
+++ b/node_modules/github-from-package/example/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "beep-boop",
+ "version": "1.2.3",
+ "repository" : {
+ "type" : "git",
+ "url": "git@github.com:substack/beep-boop.git"
+ }
+}
diff --git a/node_modules/github-from-package/example/url.js b/node_modules/github-from-package/example/url.js
new file mode 100644
index 0000000..138fb8a
--- /dev/null
+++ b/node_modules/github-from-package/example/url.js
@@ -0,0 +1,3 @@
+var github = require('../');
+var url = github(require('./package.json'));
+console.log(url);
diff --git a/node_modules/github-from-package/index.js b/node_modules/github-from-package/index.js
new file mode 100644
index 0000000..3d1d657
--- /dev/null
+++ b/node_modules/github-from-package/index.js
@@ -0,0 +1,17 @@
+module.exports = function (pkg) {
+ var m;
+ if (m = match(JSON.stringify(pkg.repository))) {
+ return m;
+ }
+ else if (m = match(JSON.stringify(pkg))) {
+ return m;
+ }
+ return undefined;
+};
+
+function match (str) {
+ var m = /\bgithub.com[:\/]([^\/"]+)\/([^\/"]+)/.exec(str);
+ if (m) {
+ return 'https://github.com/' + m[1] + '/' + m[2].replace(/\.git$/, '');
+ }
+}
diff --git a/node_modules/github-from-package/package.json b/node_modules/github-from-package/package.json
new file mode 100644
index 0000000..a3e240f
--- /dev/null
+++ b/node_modules/github-from-package/package.json
@@ -0,0 +1,30 @@
+{
+ "name" : "github-from-package",
+ "version" : "0.0.0",
+ "description" : "return the github url from a package.json file",
+ "main" : "index.js",
+ "devDependencies" : {
+ "tap" : "~0.3.0",
+ "tape" : "~0.1.5"
+ },
+ "scripts" : {
+ "test" : "tap test/*.js"
+ },
+ "repository" : {
+ "type" : "git",
+ "url" : "git://github.com/substack/github-from-package.git"
+ },
+ "homepage" : "https://github.com/substack/github-from-package",
+ "keywords" : [
+ "github",
+ "package.json",
+ "npm",
+ "repository"
+ ],
+ "author" : {
+ "name" : "James Halliday",
+ "email" : "mail@substack.net",
+ "url" : "http://substack.net"
+ },
+ "license" : "MIT"
+}
diff --git a/node_modules/github-from-package/readme.markdown b/node_modules/github-from-package/readme.markdown
new file mode 100644
index 0000000..5ba397d
--- /dev/null
+++ b/node_modules/github-from-package/readme.markdown
@@ -0,0 +1,53 @@
+# github-from-package
+
+return the github url from a package.json file
+
+[![build status](https://secure.travis-ci.org/substack/github-from-package.png)](http://travis-ci.org/substack/github-from-package)
+
+# example
+
+For the `./package.json` file:
+
+``` json
+{
+ "name": "beep-boop",
+ "version": "1.2.3",
+ "repository" : {
+ "type" : "git",
+ "url": "git@github.com:substack/beep-boop.git"
+ }
+}
+```
+
+``` js
+var github = require('github-from-package');
+var url = github(require('./package.json'));
+console.log(url);
+```
+
+```
+https://github.com/substack/beep-boop
+```
+
+# methods
+
+``` js
+var github = require('github-from-package')
+```
+
+## var url = github(pkg)
+
+Return the most likely github url from the package.json contents `pkg`. If no
+github url can be determined, return `undefined`.
+
+# install
+
+With [npm](https://npmjs.org) do:
+
+```
+npm install github-from-package
+```
+
+# license
+
+MIT
diff --git a/node_modules/github-from-package/test/a.json b/node_modules/github-from-package/test/a.json
new file mode 100644
index 0000000..03494f4
--- /dev/null
+++ b/node_modules/github-from-package/test/a.json
@@ -0,0 +1,8 @@
+{
+ "name": "beep-boop",
+ "version": "1.2.3",
+ "repository" : {
+ "type" : "git",
+ "url": "git@github.com:substack/beep-boop.git"
+ }
+}
diff --git a/node_modules/github-from-package/test/b.json b/node_modules/github-from-package/test/b.json
new file mode 100644
index 0000000..0209325
--- /dev/null
+++ b/node_modules/github-from-package/test/b.json
@@ -0,0 +1,5 @@
+{
+ "name": "beep-boop",
+ "version": "1.2.3",
+ "repository" : "git@github.com:substack/beep-boop.git"
+}
diff --git a/node_modules/github-from-package/test/c.json b/node_modules/github-from-package/test/c.json
new file mode 100644
index 0000000..65f6dda
--- /dev/null
+++ b/node_modules/github-from-package/test/c.json
@@ -0,0 +1,5 @@
+{
+ "name": "beep-boop",
+ "version": "1.2.3",
+ "repository" : "https://github.com/substack/beep-boop.git"
+}
diff --git a/node_modules/github-from-package/test/d.json b/node_modules/github-from-package/test/d.json
new file mode 100644
index 0000000..c61f3cd
--- /dev/null
+++ b/node_modules/github-from-package/test/d.json
@@ -0,0 +1,7 @@
+{
+ "name": "beep-boop",
+ "version": "1.2.3",
+ "repository" : {
+ "url": "https://github.com/substack/beep-boop"
+ }
+}
diff --git a/node_modules/github-from-package/test/e.json b/node_modules/github-from-package/test/e.json
new file mode 100644
index 0000000..770b438
--- /dev/null
+++ b/node_modules/github-from-package/test/e.json
@@ -0,0 +1,5 @@
+{
+ "name": "beep-boop",
+ "version": "1.2.3",
+ "homepage": "https://github.com/substack/beep-boop/issues"
+}
diff --git a/node_modules/github-from-package/test/url.js b/node_modules/github-from-package/test/url.js
new file mode 100644
index 0000000..d5a0a66
--- /dev/null
+++ b/node_modules/github-from-package/test/url.js
@@ -0,0 +1,19 @@
+var test = require('tape');
+var github = require('../');
+var packages = {
+ a : require('./a.json'),
+ b : require('./b.json'),
+ c : require('./c.json'),
+ d : require('./d.json'),
+ e : require('./e.json')
+};
+
+test(function (t) {
+ t.plan(5);
+ var url = 'https://github.com/substack/beep-boop';
+ t.equal(url, github(packages.a), 'a.json comparison');
+ t.equal(url, github(packages.b), 'b.json comparison');
+ t.equal(url, github(packages.c), 'c.json comparison');
+ t.equal(url, github(packages.d), 'd.json comparison');
+ t.equal(url, github(packages.e), 'e.json comparison');
+});