Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

build-data

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

build-data - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

47

index.js

@@ -5,2 +5,3 @@ 'use strict';

const path = require('path');
const { promisify } = require('util');
const branchName = require('branch-name');

@@ -10,31 +11,20 @@ const buildVersion = require('build-version');

const realpath = (filePath) => {
return new Promise((resolve, reject) => {
fs.realpath(filePath, (err, resolvedPath) => {
if (err) {
reject(err);
return;
}
resolve(resolvedPath);
});
});
};
const realpath = promisify(fs.realpath);
const buildData = (option) => {
const buildData = async (option) => {
const config = Object.assign({}, option);
const { cwd } = config;
return Promise.all([
const [branch, version] = await Promise.all([
config.branch || branchName.assumeMaster({ cwd }),
config.version || buildVersion({ cwd })
])
.then((data) => {
return {
branch : data[0],
version : data[1]
};
});
]);
return {
branch,
version
};
};
buildData.latest = (option) => {
buildData.latest = async (option) => {
const config = Object.assign({}, option);

@@ -44,6 +34,6 @@ const { branch, version, cwd } = config;

if (branch && version) {
return Promise.resolve({
return {
branch,
version
});
};
}

@@ -58,10 +48,9 @@

return realpath(path.join(cwd || '', linkPath)).then((resolvedPath) => {
return {
branch : branch || path.basename(path.join(resolvedPath, '..')),
version : version || path.basename(resolvedPath)
};
});
const resolvedPath = await realpath(path.join(cwd || '', linkPath));
return {
branch : branch || path.basename(path.join(resolvedPath, '..')),
version : version || path.basename(resolvedPath)
};
};
module.exports = buildData;
{
"name": "build-data",
"version": "0.3.1",
"description": "Get metadata for your build.",
"homepage": "https://github.com/sholladay/build-data",
"main": "index.js",
"author": {
"name": "Seth Holladay",
"url": "http://seth-holladay.com",
"email": "me@seth-holladay.com"
},
"scripts": {
"test": "xo"
},
"repository": {
"type": "git",
"url": "git@github.com:sholladay/build-data.git"
},
"bugs": {
"url": "https://github.com/sholladay/build-data/issues",
"email": "me@seth-holladay.com"
},
"engines": {
"node": ">=6"
},
"license": "MPL-2.0",
"files": [
"index.js"
],
"dependencies": {
"branch-name": "^0.1.4",
"build-path": "^0.1.0",
"build-version": "^0.2.0"
},
"devDependencies": {
"eslint-config-tidy": "^0.3.0",
"xo": "^0.16.0"
},
"keywords": [
"package",
"tooling",
"build",
"builds",
"compile",
"current",
"latest",
"head",
"commit",
"commits",
"rev",
"hash",
"version",
"versions",
"git",
"branch",
"name",
"meta",
"data",
"metadata",
"info"
],
"xo": {
"extend": "tidy"
}
"name": "build-data",
"version": "0.4.0",
"description": "Get metadata for your build",
"homepage": "https://github.com/sholladay/build-data",
"main": "index.js",
"author": {
"name": "Seth Holladay",
"url": "https://seth-holladay.com",
"email": "me@seth-holladay.com"
},
"scripts": {
"test": "xo && ava"
},
"repository": {
"type": "git",
"url": "git@github.com:sholladay/build-data.git"
},
"bugs": {
"url": "https://github.com/sholladay/build-data/issues",
"email": "me@seth-holladay.com"
},
"engines": {
"node": ">=8"
},
"license": "MPL-2.0",
"files": [
"index.js"
],
"dependencies": {
"branch-name": "^1.0.0",
"build-path": "^1.0.0",
"build-version": "^1.0.0"
},
"devDependencies": {
"ava": "^0.22.0",
"eslint-config-tidy": "^0.5.0",
"xo": "^0.18.2"
},
"keywords": [
"package",
"tooling",
"build",
"builds",
"compile",
"current",
"latest",
"head",
"commit",
"commits",
"rev",
"hash",
"version",
"versions",
"git",
"branch",
"name",
"meta",
"data",
"metadata",
"info"
],
"xo": {
"extend": "tidy"
}
}

@@ -1,4 +0,4 @@

# build-data [![Build status for build-data on Circle CI.](https://img.shields.io/circleci/project/sholladay/build-data/master.svg "Circle Build Status")](https://circleci.com/gh/sholladay/build-data "Build Data Builds")
# build-data [![Build status for build-data](https://img.shields.io/circleci/project/sholladay/build-data/master.svg "Build Status")](https://circleci.com/gh/sholladay/build-data "Builds")
> Get metadata for your build.
> Get metadata for your build

@@ -86,26 +86,15 @@ ## Why?

### buildDir.link(option)
Takes `cwd`, `branch`, and `version` on the option object.
Within the `cwd`, writes a symlink at `latest-build` pointing to `build/<branch>/latest` and from there to `<version>`.
### buildDir.prepare(option)
Returns a promise for an object with these fields:
- `path` is a newly created temporary directory for you to write the build to.
- `finalize()` moves `path` to its final location and runs `buildDir.link()` on it.
## Related
- [build-version](https://github.com/sholladay/build-version) - Get a version for your build.
- [build-dir](https://github.com/sholladay/build-dir) - Get a place to put your build.
- [build-path](https://github.com/sholladay/build-path) - Get a path for the given build.
- [build-keys](https://github.com/sholladay/build-keys) - Get the paths of files from your build.
- [build-files](https://github.com/sholladay/build-files) - Read the files from your build.
- [delivr](https://github.com/sholladay/delivr) - Build your code and ship it to S3
- [build-files](https://github.com/sholladay/build-files) - Read the files from your build
- [build-keys](https://github.com/sholladay/build-keys) - Get the paths of files from your build
- [build-dir](https://github.com/sholladay/build-dir) - Get a place to put your build
- [build-path](https://github.com/sholladay/build-path) - Get a path for the given build
- [build-version](https://github.com/sholladay/build-version) - Get a version for your build
- [branch-name](https://github.com/sholladay/branch-name) - Get the current branch name
## Contributing
See our [contributing guidelines](https://github.com/sholladay/build-data/blob/master/CONTRIBUTING.md "The guidelines for participating in this project.") for more details.
See our [contributing guidelines](https://github.com/sholladay/build-data/blob/master/CONTRIBUTING.md "Guidelines for participating in this project") for more details.

@@ -116,8 +105,8 @@ 1. [Fork it](https://github.com/sholladay/build-data/fork).

4. Push to the branch: `git push origin my-new-feature`
5. [Submit a pull request](https://github.com/sholladay/build-data/compare "Submit code to this project for review.").
5. [Submit a pull request](https://github.com/sholladay/build-data/compare "Submit code to this project for review").
## License
[MPL-2.0](https://github.com/sholladay/build-data/blob/master/LICENSE "The license for build-data.") © [Seth Holladay](http://seth-holladay.com "Author of build-data.")
[MPL-2.0](https://github.com/sholladay/build-data/blob/master/LICENSE "License for build-data") © [Seth Holladay](https://seth-holladay.com "Author of build-data")
Go make something, dang it.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc