Comparing version 0.2.0 to 0.2.1
39
index.js
'use strict'; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const branchName = require('branch-name'); | ||
const buildVersion = require('build-version'); | ||
const realpath = (fp) => { | ||
return new Promise((resolve, reject) => { | ||
fs.realpath(fp, (err, resolvedPath) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
resolve(resolvedPath); | ||
}); | ||
}); | ||
}; | ||
const buildData = (option) => { | ||
@@ -20,2 +34,27 @@ const config = Object.assign({}, option); | ||
buildData.latest = (option) => { | ||
const config = Object.assign( | ||
{ | ||
cwd : '' | ||
}, | ||
option | ||
); | ||
if (config.branch && config.version) { | ||
return Promise.resolve({ | ||
branch : config.branch, | ||
version : config.version | ||
}); | ||
} | ||
const linkPath = config.branch ? path.join('build', config.branch, 'latest') : 'latest-build'; | ||
return realpath(path.join(config.cwd, linkPath)).then((resolvedPath) => { | ||
return { | ||
branch : config.branch || path.basename(path.join(resolvedPath, '..')), | ||
version : config.version || path.basename(resolvedPath) | ||
}; | ||
}); | ||
}; | ||
module.exports = buildData; |
{ | ||
"name": "build-data", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Get metadata for your build.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/sholladay/build-data", |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
20350
51
1