parse-app-info
Advanced tools
Comparing version 1.0.0 to 1.0.1
34
index.js
@@ -5,3 +5,28 @@ const readPkgUp = require('read-pkg-up'); | ||
/** | ||
* Information about the app | ||
* A safe way to query for git infos. | ||
* | ||
* @return {object|undefined} Returns {hash, gitTag} or undefined in case of an error | ||
*/ | ||
async function getLastCommit() { | ||
try { | ||
const lastCommitLog = new LastCommitLog(); | ||
const { hash, gitTag } = await lastCommitLog.getLastCommit(); | ||
// Add gitTag only when it exists | ||
const result = { | ||
hash | ||
}; | ||
/* istanbul ignore if */ | ||
if (gitTag) { | ||
result.tag = gitTag; | ||
} | ||
return result; | ||
} catch (err) {} | ||
} | ||
/** | ||
* Information about the app. | ||
* | ||
* The git infos can be missing if the project has no commit yet | ||
* or is not connected to a git repo. | ||
* | ||
* @typedef {Object} AppInfo | ||
@@ -25,7 +50,5 @@ * @property {string} name The name of the app | ||
async function parseAppInfo() { | ||
const lastCommitLog = new LastCommitLog(); | ||
const [packageInfo, lastCommit] = await Promise.all([ | ||
readPkgUp(), | ||
lastCommitLog.getLastCommit() | ||
getLastCommit() | ||
]); | ||
@@ -39,4 +62,3 @@ | ||
node: process.version, | ||
hash: lastCommit.hash, | ||
tag: lastCommit.gitTag, | ||
...lastCommit, | ||
environment: /* istanbul ignore next */ NODE_ENV || 'development', | ||
@@ -43,0 +65,0 @@ hostname: /* istanbul ignore next */ HOSTNAME || require('os').hostname(), |
{ | ||
"name": "parse-app-info", | ||
"description": "parse information about an application process", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Philipp Kursawe <phil.kursawe@gmail.com> (https://pke.github.io)", | ||
@@ -6,0 +6,0 @@ "ava": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7686
71
1