Socket
Socket
Sign inDemoInstall

@lerna/describe-ref

Package Overview
Dependencies
2
Maintainers
2
Versions
61
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lerna/describe-ref


Version published
Maintainers
2
Created

Package description

What is @lerna/describe-ref?

@lerna/describe-ref is a utility package that helps in describing the current Git reference in a Lerna-managed monorepo. It provides information about the current Git branch, tag, or commit, which can be useful for versioning and release management in monorepos.

What are @lerna/describe-ref's main functionalities?

Describe the current Git reference

This feature allows you to get a description of the current Git reference, including branch name, tag, or commit hash. The `describeRef` function returns an object with details about the current Git state.

const { describeRef } = require('@lerna/describe-ref');

async function getGitRef() {
  const ref = await describeRef();
  console.log(ref);
}

getGitRef();

Custom base ref

This feature allows you to specify a custom base reference to compare against. The `describeRef` function can take an options object where you can set the `baseRef` to a specific branch or tag.

const { describeRef } = require('@lerna/describe-ref');

async function getCustomBaseRef(baseRef) {
  const ref = await describeRef({ baseRef });
  console.log(ref);
}

getCustomBaseRef('main');

Include distance from base ref

This feature includes the distance (number of commits) from the base reference in the description. The `includeDistance` option can be set to `true` to get this additional information.

const { describeRef } = require('@lerna/describe-ref');

async function getRefWithDistance() {
  const ref = await describeRef({ includeDistance: true });
  console.log(ref);
}

getRefWithDistance();

Other packages similar to @lerna/describe-ref

Changelog

Source

4.0.0 (2021-02-10)

Bug Fixes

  • version: Ensure --create-release environment variables are present during initialization (2d0a97a)
  • Improve accuracy of JSDoc type annotations (1ec69f0)
  • create: Use main as default Github branch (1a951e9)
  • import: Better handling of "Patch is empty" (#2588) (0497bc7)

Code Refactoring

  • describe-ref: Add JSDoc types, remove test-only export (e5cf30c)
  • package: Move Package.lazy() to static method (e52108e)

Features

  • child-process: Add JSDoc types (1840492)
  • collect-uncommitted: Remove figgy-pudding (621b382)
  • collect-updates: Add JSDoc type annotations to primary export (a4e7c78)
  • conventional-commits: Add JSDoc types to named exports (81a591c)
  • deps: @evocateur/libnpmaccess -> libnpmaccess@^4.0.1 (7974b35)
  • deps: @evocateur/libnpmpublish -> libnpmpublish@^4.0.0 (341146e)
  • deps: @evocateur/npm-registry-fetch -> npm-registry-fetch@^9.0.0 (6df42f2)
  • deps: @evocateur/pacote -> pacote@^11.1.13 (99b4217)
  • deps: @octokit/rest@^18.0.9 (f064a55)
  • deps: @zkochan/cmd-shim -> cmd-shim@^4.0.2 (179e2c3)
  • deps: Bump dependencies (affed1c)
  • deps: byte-size@^7.0.0 (a1b2555)
  • deps: camelcase -> yargs-parser/camelCase (d966e8b)
  • deps: chalk@^4.1.0 (d2a9ed5)
  • deps: conventional-changelog-core@^4.2.1 (54e2b98)
  • deps: conventional-recommended-bump@^6.0.11 (4ff481c)
  • deps: cosmiconfig@^7.0.0 (2958fe6)
  • deps: dot-prop@^6.0.0 (5f31d3b)
  • deps: execa@^4.1.0 (9051dca)
  • deps: execa@^5.0.0 (d8100fd)
  • deps: fs-extra@^9.0.1 (2f6f4e0)
  • deps: get-port@^5.1.1 (b1b2275)
  • deps: get-stream@^6.0.0 (ddf2ab5)
  • deps: globby@^11.0.1 (6cb5bbe)
  • deps: import-local@^3.0.2 (e0e74d4)
  • deps: init-package-json@^2.0.1 (4042e8e)
  • deps: inquirer@^7.3.3 (0b37795)
  • deps: load-json-file@^6.2.0 (239f54b)
  • deps: multimatch@^5.0.0 (0172526)
  • deps: npm-package-arg@^8.1.0 (12c8923)
  • deps: npm-packlist@^2.1.4 (c63fabd)
  • deps: p-finally -> Promise.prototype.finally() (028db04)
  • deps: p-finally@^2.0.1 (165e47e)
  • deps: p-map-series@^2.1.0 (7f68076)
  • deps: p-map@^4.0.0 (92b1364)
  • deps: p-pipe@^3.1.0 (489f59e)
  • deps: p-queue@^6.6.2 (ed76cdd)
  • deps: p-reduce@^2.1.0 (fd4289a)
  • deps: p-waterfall@^2.1.0 (7b7ea50)
  • deps: path-exists@^4.0.0 (3fb6304)
  • deps: pify@^5.0.0 (6b34452)
  • deps: read-cmd-shim@^2.0.0 (9f78eee)
  • deps: read-package-json@^3.0.0 (2a02865)
  • deps: read-package-tree@^5.3.1 (3311780)
  • deps: resolve-from@^5.0.0 (d414462)
  • deps: rimraf@^3.0.2 (cda2e18)
  • deps: semver@^7.3.2 (003ad66)
  • deps: slash@^3.0.0 (5dec383)
  • deps: ssri@^8.0.0 (41729b4)
  • deps: tar@^6.0.5 (fce3e77)
  • deps: temp-write@^4.0.0 (7bbfb70)
  • deps: upath@^2.0.1 (28ecc48)
  • deps: whatwg-url@^8.4.0 (5dfb7f0)
  • deps: write-file-atomic@^3.0.3 (61f341b)
  • deps: write-json-file@^4.3.0 (d552c53)
  • deps: write-pkg@^4.0.0 (34db21c)
  • deps: yargs@^16.1.1 (53d432b)
  • filter-options: Remove figgy-pudding (7d90289)
  • has-npm-version: Remove unused makePredicate() export (56cba2f)
  • npm-dist-tag: Remove figgy-pudding (1158f8e)
  • npm-publish: Remove figgy-pudding (bdc162d)
  • otplease: Remove figgy-pudding (45ee52e)
  • pack-directory: Remove figgy-pudding (640faa5)
  • package: Improve JSDoc-inferred types, encapsulation (4d80c38)
  • package-graph: Improve JSDoc-inferred types, encapsulation (fae9e8d)
  • prerelease-id-from-version: Add JSDoc types (53cdad9)
  • profiler: Remove figgy-pudding (69d4704)
  • project: Add JSDoc type annotations to primary export (8443ad3)
  • prompt: Add JSDoc types (0406568)
  • prompt: Add unambiguous exports (46fa111)
  • prompt: Remove ambiguous exports (42ab453)
  • Consume named exports of sibling modules (63499e3)
  • Expose named export (c1303f1)
  • Remove default export (e2f1ec3)
  • publish: Remove figgy-pudding (caf823e)
  • query-graph: Remove figgy-pudding (3b0e2fe)
  • run-lifecycle: Remove figgy-pudding (1093f87)
  • run-topologically: Remove figgy-pudding (f3a73db)
  • Drop support for Node v6.x & v8.x (ff4bb4d)

BREAKING CHANGES

  • prompt: The ambiguous 'confirm', 'select', and 'input' exports have been removed. Please use the renamed exports 'promptConfirmation', 'promptSelectOne', and 'promptTextInput' (respectively).
  • has-npm-version: The makePredicate() export has been removed, memoization is now the responsibility of the caller.
  • The default export has been removed, please use a named export instead.
  • describe-ref: The test-only 'parse()' export has been removed.
  • package: The lazy named export is now a proper static method of Package.
  • Node v6.x & v8.x are no longer supported. Please upgrade to the latest LTS release.

Here's the gnarly one-liner I used to make these changes:

npx lerna exec --concurrency 1 --stream -- 'json -I -f package.json -e '"'"'this.engines=this.engines||{};this.engines.node=">= 10.18.0"'"'"

(requires npm i -g json beforehand)

Readme

Source

@lerna/describe-ref

Parse git describe output for lerna-related tags

Usage

const { describe } = require("@lerna/describe-ref");

(async () => {
  const { lastTagName, lastVersion, refCount, sha, isDirty } = await describe();
})();

// values listed here are their defaults
const options = {
  cwd: process.cwd(),
  // pass a glob to match tag name, e.g. "v*.*.*"
  match: undefined,
  // if true, omit --first-parent option
  includeMergedTags: false,
};

const { lastTagName, lastVersion, refCount, sha, isDirty } = describe.sync(options);

const result = describe.parse("v1.0.0-5-gdeadbeef");
// { lastTagName, lastVersion, refCount, sha, isDirty }

Install lerna for access to the lerna CLI.

Keywords

FAQs

Last updated on 10 Feb 2021

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc