Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_JSON_Dependencies_Linker/Github_JSON_Dependencies_Linker.user.js
// @supportURL https://github.com/jerone/UserScripts/issues
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW
// @version 0.3.0
// @version 0.4.0
// @grant GM_xmlhttpRequest
// @run-at document-end
// @include https://github.com/*/package.json
// @include https://github.com/*/npm-shrinkwrap.json
// @include https://github.com/*/bower.json
// @include https://github.com/*/project.json
// @include https://github.com/*/composer.json
// ==/UserScript==
/* global GM_xmlhttpRequest */

Expand Down Expand Up @@ -48,14 +49,16 @@
}
return false;
})(),
isPackagist = location.pathname.endsWith('/composer.json'),
dependencyKeys = [
'dependencies',
'devDependencies',
'peerDependencies',
'bundleDependencies',
'bundledDependencies',
'packageDependencies',
'optionalDependencies'
'optionalDependencies',
'require'
],
modules = (function() {
var _modules = {};
Expand Down Expand Up @@ -190,6 +193,9 @@
} else if (isNuGet) {
var url = 'https://www.nuget.org/packages/' + module;
linkify(module, url);
} else if (isPackagist && module !== "php") {
var url = 'https://packagist.org/packages/' + module;
linkify(module, url);
}
});
});
Expand Down
7 changes: 6 additions & 1 deletion Github_JSON_Dependencies_Linker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The following JSON schemes are supported:
* [Bower](http://bower.io) - `bower.json`
* [NuGet](https://www.nuget.org) - `project.json`
* [Atom](https://atom.io) - `package.json`
* [Packagist](https://packagist.org) - `composer.json`

In the JSON file it will search for the following dependency keys:
* `dependencies`
Expand All @@ -24,6 +25,7 @@ In the JSON file it will search for the following dependency keys:
* `bundledDependencies`
* `packageDependencies`
* `optionalDependencies`
* `require`


## Screenshot
Expand All @@ -40,8 +42,10 @@ In the JSON file it will search for the following dependency keys:

## Version History

* **0.4.0**
* Added support for Packagist with Composer (fixes [#89](https://github.com/jerone/UserScripts/issues/89));
* **0.3.0**
* Added support for Atom for `packageDependencies`;
* Added support for Atom's `packageDependencies`;
* **0.2.0**
* Module name preceding a colon is never a key;
* Added support for npm-shrinkwrap.json;
Expand All @@ -61,6 +65,7 @@ In the JSON file it will search for the following dependency keys:
* https://github.com/aspnet/MusicStore/blob/master/src/MusicStore.Spa/project.json (ASP.NET project.json with COMMENTS);
* https://github.com/atom/atom/blob/master/package.json (Atom package.json packageDependencies atomShellVersion);
* https://github.com/suda/toolbar-main/blob/master/package.json (Atom package.json packageDependencies engines.atom);
* https://github.com/composer/composer/blob/master/composer.json (Packagist with Composer);


## Dependencies
Expand Down