How to use git-describe - 9 common examples

To help you get started, we’ve selected a few git-describe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github swagger-api / swagger-editor / make-webpack-config.js View on Github external
var path = require("path")

var webpack = require("webpack")
var ExtractTextPlugin = require("extract-text-webpack-plugin")
var UglifyJsPlugin = require("uglifyjs-webpack-plugin")
var deepExtend = require("deep-extend")
var autoprefixer = require("autoprefixer")
const {gitDescribeSync} = require("git-describe")

var pkg = require("./package.json")

let gitInfo

try {
  gitInfo = gitDescribeSync(__dirname)
} catch(e) {
  gitInfo = {
    hash: "noGit",
    dirty: false
  }
}

var loadersByExtension = require("./build-tools/loadersByExtension")

module.exports = function(options) {

  // Special options, that have logic in this file
  // ...with defaults
  var specialOptions = deepExtend({}, {
    hot: false,
    separateStylesheets: true,
github colmena / angular-nest-universal-starter / tools / generate-version.ts View on Github external
import { gitDescribeSync } from 'git-describe'
import { join, relative } from 'path'
import { writeFileSync } from 'fs-extra'

const { version, name, description, repository, homepage } = require('../package.json')

// On now we don't have access to .git :/
const git = process.env.NOW
  ? { raw: 'now.sh build'}
  : gitDescribeSync({ dirtyMark: false, dirtySemver: false })

const result = {
  name,
  description,
  repository,
  homepage,
  version,
  ...git,
}

const file = join(process.cwd(), 'libs', 'core', 'src', 'version.ts')

writeFileSync(file,
  `// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
/* tslint:disable */
export const VERSION = ${JSON.stringify(result, null, 4)};
github tidepool-org / uploader / scripts / prepare-qa-build.js View on Github external
const shell = require('shelljs');
const nodegit = require('nodegit');
const {
  gitDescribeSync
} = require('git-describe');

const gitInfo = gitDescribeSync();
if (gitInfo.dirty) {
  console.log('Please start with a clean repo');
  shell.exit(1);
}

const qaVersion = gitInfo.semverString.replace('+', '.');

(async() => {
  const repo = await nodegit.Repository.open('.');
  const index = await repo.refreshIndex();

  const defaultSig = nodegit.Signature.default(repo);

  for (const file of ['package.json', 'app/package.json']) {
    shell.sed('-i', '"version":[ ]*".*",$', `"version": "${qaVersion}",`, file);
    await index.addByPath(file);
github swagger-api / swagger-ui / make-webpack-config.js View on Github external
var path = require("path")

var webpack = require("webpack")
var ExtractTextPlugin = require("extract-text-webpack-plugin")
const CopyWebpackPlugin = require("copy-webpack-plugin")
const UglifyJsPlugin = require("uglifyjs-webpack-plugin")
var deepExtend = require("deep-extend")
const {gitDescribeSync} = require("git-describe")
const os = require("os")

var pkg = require("./package.json")

let gitInfo

try {
  gitInfo = gitDescribeSync(__dirname)
} catch(e) {
  gitInfo = {
    hash: "noGit",
    dirty: false
  }
}

var commonRules = [
  { test: /\.(js(x)?)(\?.*)?$/,
    use: [{
      loader: "babel-loader",
      options: {
        retainLines: true
      }
    }],
    include: [
github hypothesis / browser-extension / tools / settings.js View on Github external
function getVersion(buildType) {
  const gitInfo = gitDescribeSync();

  if (buildType === 'production' && gitInfo.dirty) {
    throw new Error('cannot create production build with dirty git state!');
  }

  const version = `${gitInfo.semver}.${gitInfo.distance}`;
  let versionName = 'Official Build';

  if (buildType !== 'production') {
    versionName = `${gitInfo.hash}${gitInfo.dirty ? '.dirty' : ''}`;
  }

  return {version, versionName};
}
github OpenLiberty / open-liberty / dev / com.ibm.ws.openapi.ui / temp / swagger-ui / make-webpack-config.js View on Github external
var path = require("path")

var webpack = require("webpack")
var ExtractTextPlugin = require("extract-text-webpack-plugin")
const CopyWebpackPlugin = require("copy-webpack-plugin")
const UglifyJsPlugin = require("uglifyjs-webpack-plugin")
var deepExtend = require("deep-extend")
const {gitDescribeSync} = require("git-describe")
const os = require("os")

var pkg = require("./package.json")

let gitInfo

try {
  gitInfo = gitDescribeSync(__dirname)
} catch(e) {
  gitInfo = {
    hash: "noGit",
    dirty: false
  }
}

var commonRules = [
  { test: /\.(js(x)?)(\?.*)?$/,
    use: [{
      loader: "babel-loader",
      options: {
        retainLines: true
      }
    }],
    include: [
github kubernetes / dashboard / aio / scripts / version.js View on Github external
const {gitDescribeSync} = require('git-describe');
const {version} = require('../../package.json');
const {resolve, relative} = require('path');
const {writeFileSync} = require('fs-extra');

const gitInfo = gitDescribeSync({
  dirtyMark: false,
  dirtySemver: false,
  longSemver: true,
});

gitInfo.packageVersion = version;
Object.assign(gitInfo.semver, {
  loose: false,
  options: {
    includePrerelease: false,
    loose: false,
  }
});

const file =
    resolve(__dirname, '..', '..', 'src/', 'app', 'frontend', 'environments', 'version.ts');
github PacktPublishing / Building-Enterprise-JavaScript-Applications / Chapter10 / hobnob / docs / make-webpack-config.js View on Github external
var path = require("path")

var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
var deepExtend = require('deep-extend')
const {gitDescribeSync} = require('git-describe')
const os = require("os")

var pkg = require("./package.json")

let gitInfo

try {
  gitInfo = gitDescribeSync(__dirname)
} catch(e) {
  gitInfo = {
    hash: "noGit",
    dirty: false
  }
}

var commonRules = [
  { test: /\.(js(x)?)(\?.*)?$/,
    use: [{
      loader: "babel-loader",
      options: {
        retainLines: true
      }
    }],
    include: [ path.join(__dirname, "src") ]
github HearthSim / Joust / gulpfile.js View on Github external
gulp.task("env:set-release", function(cb) {
	gitDescribe(__dirname, { match: null }).then(function(gitInfo) {
		var release = gitInfo.semverString;
		if (!release) {
			throw Error("Unable to determine release");
		}
		gutil.log("Setting JOUST_RELEASE to", gutil.colors.green(release));
		process.env.JOUST_RELEASE = release;
		cb();
	});
});

git-describe

Git describe information at runtime, with semver support

MIT
Latest version published 2 years ago

Package Health Score

50 / 100
Full package analysis