Gathering detailed insights and metrics for get-pkg-repo
Gathering detailed insights and metrics for get-pkg-repo
Gathering detailed insights and metrics for get-pkg-repo
Gathering detailed insights and metrics for get-pkg-repo
Get repository user and project information from package.json file contents.
npm install get-pkg-repo
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
17 Stars
106 Commits
13 Forks
3 Watching
20 Branches
19 Contributors
Updated on 10 Dec 2023
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
2.2%
539,300
Compared to previous day
Last week
6.4%
2,965,103
Compared to previous week
Last month
34.9%
10,942,569
Compared to previous month
Last year
-1.4%
104,195,936
Compared to previous year
Get repository SCM platform, domain, user, and project information from package.json file contents.
Extracts information from the repository
field contained in the content of a package.json
file using @hutson/parse-repository-url
and hosted-git-info
.
browse
function that returns URL usable in a browser. (Similar to hosted-git-info
)domain
property containing the fully qualified domain name and port.project
property.type
property indicating the SCM host, such as github
or gitlab
.user
property.*Note: Returns
null
for any property where the information could not be extracted from the repository URL.
To install the get-pkg-repo
tool please run the following command:
1yarn [global] add [--dev] get-pkg-repo
There are two ways to use get-pkg-repo
, either as a CLI tool, or programmatically.
Programmatically
Package data must be passed as an object to get-pkg-repo
function. If the contents of the package.json
are a string, please pass it through JSON.parse
first.
1const getPkgRepo = require(`get-pkg-repo`); 2 3/* Assume the `package.json` file contains the following: 4{ 5 "repository": { 6 "url": `https://github.com/conventional-changelog/get-pkg-repo` 7 } 8} 9*/ 10fs.readFile(`package.json`, (err, packageData) => { 11 if (err) { 12 ... 13 } 14 15 // {domain: `github.com`, project: `get-pkg-repo`, type: `github`, user: `conventional-changelog`} 16 const repository = getPkgRepo(JSON.parse(packageData)); 17 18 repository.browse(); // https://github.com/conventional-changelog/get-pkg-repo 19});
CLI Tool
After you've installed get-pkg-repo
, you can call the tool based on whether you installed it globally or locally:
Globally
1get-pkg-repo package.json
Locally
1$(yarn bin)/get-pkg-repo package.json
1$ get-pkg-repo package.json 2 3{ 4 domain: `github.com`, 5 project: `get-pkg-repo`, 6 type: `github`, 7 user: `conventional-changelog` 8}
The contents of the package.json
can also be piped to get-pkg-repo
:
$ cat package.json | get-pkg-repo
{
domain: `github.com`,
project: `get-pkg-repo`,
type: `github`,
user: `conventional-changelog`
}
To assist users of get-pkg-repo
with debugging the behavior of this module we use the debug utility package to print information about the publish process to the console. To enable debug message printing, the environment variable DEBUG
, which is the variable used by the debug
package, must be set to a value configured by the package containing the debug messages to be printed.
To print debug messages on a unix system set the environment variable DEBUG
with the name of this package prior to executing get-pkg-repo
:
1DEBUG=get-pkg-repo get-pkg-repo
On the Windows command line you may do:
1set DEBUG=get-pkg-repo 2get-pkg-repo
We only support Long-Term Support versions of Node.
We specifically limit our support to LTS versions of Node, not because this package won't work on other versions, but because we have a limited amount of time, and supporting LTS offers the greatest return on that investment.
It's possible this package will work correctly on newer versions of Node. It may even be possible to use this package on older versions of Node, though that's more unlikely as we'll make every effort to take advantage of features available in the oldest LTS version we support.
As each Node LTS version reaches its end-of-life we will remove that version from the node
engines
property of our package's package.json
file. Removing a Node version is considered a breaking change and will entail the publishing of a new major version of this package. We will not accept any requests to support an end-of-life version of Node. Any merge requests or issues supporting an end-of-life version of Node will be closed.
We will accept code that allows this package to run on newer, non-LTS, versions of Node. Furthermore, we will attempt to ensure our own changes work on the latest version of Node. To help in that commitment, our continuous integration setup runs against all LTS versions of Node in addition the most recent Node release; called current.
JavaScript package managers should allow you to install this package with any version of Node, with, at most, a warning if your version of Node does not fall within the range specified by our node
engines
property. If you encounter issues installing this package, please report the issue to your package manager.
Please read our contributing guide on how you can help improve this project.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
Found 1/17 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
46 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More