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

buildstamp

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buildstamp

Buildstamp

  • 1.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
65
increased by51.16%
Maintainers
1
Weekly downloads
 
Created
Source

buildstamp

Utility for gathering build details

Installation

yarn add buildstamp
npm i buildstamp

Usage

CLI

buildstamp --out.path=some/path/b.json --git --docker.imageTag=foo --date.format=iso

Output in some/path/b.json:

{
  "git": {
    "commitId": "007b8f715eb5670662d90f90cd1916398d1dfe98",
    "repoUrl": "https://github.com/qiwi/buildstamp.git",
    "repoName": "qiwi/buildstamp"
  },
  "docker": {
    "imageTag": "foo"
  },
  "date": "2020-11-05T15:16:35.904Z"
}

Flags

Output is always printed to stdout

OptionDescriptionDefault
--out.pathpath to generated fileoutput is not written to a file
--out.jsonSeparatorone of tab, space, double-space, no-spacetab
--gitadd git data to outputgit data is omitted
--docker.imageTagdocker image tag, will be added to output, if existsdocker info is omitted
--date.formatadd date to output, one of iso or instantdate is omitted
--date.valueany valid input for Date constructorDate.now()
--cwdworking directoryprocess.cwd()

API

API functions accept the same options as cli

execute(options, env)

Creates and returns buildstamp

Get buildstamp

import { execute } from 'buildstamp'

const stamp = execute({
    git: true,
    date: { format: 'iso' },
    docker: { imageTag: 'foo', bar: 'bar'}
})
/*
{
  "git": {
    "commitId": "007b8f715eb5670662d90f90cd1916398d1dfe98",
    "repoUrl": "https://github.com/qiwi/buildstamp.git",
    "repoName": "qiwi/buildstamp"
  },
  "docker": {
    "imageTag": "foo".
    "bar": "bar"
  },
  "date": "2020-11-05T15:16:35.904Z"
}
*/

Write buildstamp to file

import { execute } from 'buildstamp'

execute({
    git: true,
    date: { format: 'iso' },
    docker: { imageTag: 'foo', bar: 'bar'},
    out: {
      path: 'some/path/stamp.json'
    }
})

Output in some/path/stamp.json:

{
	"git": {
		"commitId": "19128459495e461b3c2b64704566f6aaac193ce1",
		"repoUrl": "https://github.com/qiwi/buildstamp.git",
		"repoName": "qiwi/buildstamp"
	},
	"docker": {
		"imageTag": "foo",
		"bar": "bar"
	},
	"date": "2020-09-04T19:53:03.790Z"
}

readBuildstamp(path)

Safely parses and returns buildstamp by given path. Returns undefined on error.

import { readBuildstamp } from 'buildstamp'

const stamp = getBuildstamp('some/path')

Keywords

FAQs

Package last updated on 09 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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