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.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
53
increased by10.42%
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:

{
	"timestamp": "2020-08-27T15:12:07.699Z",
	"gitInfo": {
		"commitId": "cd9660293d69a5ca7559197aedd1fa5de1a939fe",
		"repoName": "qiwi/buildstamp.git"
	}
}

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-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: 'fc6e78b11ef4c7db1c8b89fa6b0d9b3ad4ad481d',
    repoName: 'qiwi/buildstamp.git'
  },
  docker: { imageTag: 'foo', bar: 'bar' },
  date: '2020-08-27T20:47:41.958Z'
}
*/

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')
/*
{
  git: {
    commitId: 'fc6e78b11ef4c7db1c8b89fa6b0d9b3ad4ad481d',
    repoName: 'qiwi/buildstamp.git'
  },
  docker: { imageTag: 'foo', bar: 'bar' },
  date: '2020-08-27T20:47:41.958Z'
}
*/

Keywords

FAQs

Package last updated on 30 Oct 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