npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

esbuild-plugin-git-describe

v1.0.0

Published

ESBuild pligin to provide git-describe information at build time.

Downloads

34

Readme

esbuild-plugin-git-describe

An esbuild plugin to expose git-describe as a module in your application.

GitHub npm

This plugin was inspired by esbuild-plugin-version-injector.

Description

This plugin allows you to expose versioning information based on the results of git-describe at build time as a module that can be imported into front-end code.

For example:

import { hash, tag, raw } from 'git-describe';

console.log("App Version: ", { hash, tag, raw });

/* Will be something like:
 * {
 *   hash: "g8b914ab",
 *   raw: "v0.1.0-0-g8b914ab-dirty",
 *   tag: "v0.1.0"
 * }
 */

This git-describe object is generated by the plugin at compile time so there is no version management needed beyond git tags. See the git-describe example output for the list of available properties.

Installation

This plugin is available on npm as esbuild-plugin-git-describe and can be installed using npm with:

npm install --save-dev esbuild-plugin-git-describe

Usage

Add the plugin to your esbuild script. For example:

import * as esbuild from 'esbuild';
import { esbuildPluginGitDescribe } from 'esbuild-plugin-git-describe';

await esbuild.build({
  entryPoints: [resolve(__dirname, './src/index.ts'],
  plugins: [ esbuildPluginGitDescribe() ]
});

Configuration Options:

You can pass a configuration object to esbuildPluginGetDescribe() which accepts the following values:

| Property Name | Property Type | Description | | ------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | dirtyMark | string | From git-describe, the dirty mark to use if repo state is dirty (see git describe's --dirty). Defaults to '-dirty'. | | dirtySemver | boolean | From git-describe, appends the dirty mark to semverString if repo state is dirty. Defaults to true. | | long | boolean | From git-describe, always adds commit distance and hash to raw, suffix and .toString() (matches the behaviour of git describe's --long). Defaults to true. | | longSemver | boolean | From git-describe, always adds commit distance and hash to semverString (similar to git describe's --long, but for semver). Defaults to false. | | requireAnnotated | boolean | From git-describe, uses --tags if false, so that simple git tags are allowed. Defaults to false. | | match | string | From git-describe, uses --match to filter tag names. By default only tags resembling a version number are considered. Defaults to 'v[0-9]*'. | | customArguments | Array<string> | From git-describe, array of additional arguments to pass to git describe. Not all arguments are useful and some may even break the library, but things like --abbrev and --candidates should be safe to add. Defaults to []. | | namespace | string | Namespace to use as the source of the git-describe variables exposed to the application. Defaults to git-describe. |