How to use git-rev-sync - 10 common examples

To help you get started, we’ve selected a few git-rev-sync 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 turt2live / matrix-dimension / src / version.ts View on Github external
import * as git from "git-rev-sync";

let version = "Unknown";
let gitHash = null;

try {
    version = "v" + require("../../package.json").version;
} catch (error) {
    // The log service isn't set up by the time we require this file
    console.error("version", error);
}

try {
    gitHash = git.short();
} catch (error) {
    // The log service isn't set up by the time we require this file
    console.error("version", error);
}

export const CURRENT_VERSION = version + (gitHash ? "-" + gitHash : "");
github 4minitz / 4minitz / server / gitversioninfo.js View on Github external
gitVersionInfoUpdate: function () {
        try {
            var git = require('git-rev-sync');
            GIT_VERSION_INFO.commitshort = git.short();
            GIT_VERSION_INFO.commitlong = git.long();
            GIT_VERSION_INFO.branch = git.branch();
            GIT_VERSION_INFO.tag = git.tag();
            if (GIT_VERSION_INFO.tag == GIT_VERSION_INFO.commitlong) {  // no tag found!
                delete GIT_VERSION_INFO.tag;
            }

            console.log("git version:"+JSON.stringify(GIT_VERSION_INFO, null, 4));

        } catch (e) {
            console.log("No git-rev-sync installed? Do 'meteor npm install' before launch of meteor!");
            console.log(e);
        }
    }
});
github OpenNeuroOrg / openneuro / server / server.js View on Github external
import config from './config'
import routes from './routes'
import bodyParser from 'body-parser'
import morgan from 'morgan'
import mongo from './libs/mongo'
import { connect as redis_connect } from './libs/redis'
import { connect as resque_connect } from './libs/queue'
import notifications from './libs/notifications'
import git from 'git-rev-sync'
import aws from './libs/aws'
// import events lib to instantiate CRN Emitter
import events from './libs/events'

// configuration ---------------------------------------------------
const ravenConfig = {
  release: git.long(),
  tags: { branch: git.branch() },
  environment: config.sentry.ENVIRONMENT,
  autoBreadcrumbs: true,
}
Raven.config(config.sentry.DSN, ravenConfig).install()

mongo.connect(config.mongo.url)

const redisConnect = async () => {
  try {
    const redis = await redis_connect(config.redis)
    await resque_connect(redis)
    console.log('Resque connected')
    // start background tasks
    notifications.initCron()
    aws.batch.initCron()
github OpenNeuroOrg / openneuro / server / server.js View on Github external
import routes from './routes'
import bodyParser from 'body-parser'
import morgan from 'morgan'
import mongo from './libs/mongo'
import { connect as redis_connect } from './libs/redis'
import { connect as resque_connect } from './libs/queue'
import notifications from './libs/notifications'
import git from 'git-rev-sync'
import aws from './libs/aws'
// import events lib to instantiate CRN Emitter
import events from './libs/events'

// configuration ---------------------------------------------------
const ravenConfig = {
  release: git.long(),
  tags: { branch: git.branch() },
  environment: config.sentry.ENVIRONMENT,
  autoBreadcrumbs: true,
}
Raven.config(config.sentry.DSN, ravenConfig).install()

mongo.connect(config.mongo.url)

const redisConnect = async () => {
  try {
    const redis = await redis_connect(config.redis)
    await resque_connect(redis)
    console.log('Resque connected')
    // start background tasks
    notifications.initCron()
    aws.batch.initCron()
    aws.cloudwatch.initEvents().then(aws.batch.initQueue)
github 4minitz / 4minitz / server / gitversioninfo.js View on Github external
gitVersionInfoUpdate: function () {
        try {
            var git = require('git-rev-sync');
            GIT_VERSION_INFO.commitshort = git.short();
            GIT_VERSION_INFO.commitlong = git.long();
            GIT_VERSION_INFO.branch = git.branch();
            GIT_VERSION_INFO.tag = git.tag();
            if (GIT_VERSION_INFO.tag == GIT_VERSION_INFO.commitlong) {  // no tag found!
                delete GIT_VERSION_INFO.tag;
            }

            console.log("git version:"+JSON.stringify(GIT_VERSION_INFO, null, 4));

        } catch (e) {
            console.log("No git-rev-sync installed? Do 'meteor npm install' before launch of meteor!");
            console.log(e);
        }
    }
});
github mozilla / blurts-server / controllers / dockerflow.js View on Github external
const AppConstants = require("../app-constants");
const mozlog = require("../log");
const {version, homepage} = require("../package.json");


const log = mozlog("controllers.dockerflow");
const versionJsonPath = path.join(__dirname, "..", "version.json");

// If the version.json file already exists (e.g., created by circle + docker),
// don't need to generate it
if (!fs.existsSync(versionJsonPath)) {
  log.info("generating");
  let commit;
  try {
    commit = require("git-rev-sync").short();
  } catch (err) {
    log.error("generating", {err: err});
  }

  const versionJson = {
    commit,
    source: homepage,
    version,
    languages: AppConstants.SUPPORTED_LOCALES,
  };

  fs.writeFileSync(versionJsonPath, JSON.stringify(versionJson, null, 2) + "\n");
}


function vers (req, res) {
github Leaflet / Leaflet.markercluster / build / rollup-config.js View on Github external
import rollupGitVersion from 'rollup-plugin-git-version'
import json from 'rollup-plugin-json'

import gitRev from 'git-rev-sync'


let version = require('../package.json').version;
let release;

// Skip the git branch+rev in the banner when doing a release build
if (process.env.NODE_ENV === 'release') {
	release = true;
} else {
	release = false;
	const branch = gitRev.branch();
	const rev = gitRev.short();
	version += '+' + branch + '.' + rev;
}

const banner = `/*
 * Leaflet.markercluster ` + version + `,
 * Provides Beautiful Animated Marker Clustering functionality for Leaflet, a JS library for interactive maps.
 * https://github.com/Leaflet/Leaflet.markercluster
 * (c) 2012-2017, Dave Leaver, smartrak
 */`;

export default {
	input: 'src/index.js',
	output: {
		banner,
		file: 'dist/leaflet.markercluster-src.js',
		format: 'umd',
github imyelo / pokequest-wiki / vue.config.js View on Github external
const rev = require('git-rev-sync')
const CACHEABLE_DIRECTORY = 'static'

const version = rev.isTagDirty() ? `${rev.tag()}-${rev.short('.')}` : rev.tag()

module.exports = {
  assetsDir: CACHEABLE_DIRECTORY, // cacheable dir

  chainWebpack (config) {
    let images = config.module.rule('images')

    images.uses.clear()
    images
      .use('file-loader')
        .loader('file-loader')
        .options(config.module.rule('svg').use('file-loader').get('options'))

    config.plugin('define-version')
      .use(require('webpack/lib/DefinePlugin'), [{
        'DEFINED_VERSION': JSON.stringify(version),
github gxchain / gxchain-light / web / webpack.config.js View on Github external
{
            loader: "sass-loader",
            options: {
                outputStyle: "expanded"
            }
        }
    ];

    // OUTPUT PATH
    var outputPath = path.join(root_dir, "assets");

    // COMMON PLUGINS
    var plugins = [
        new webpack.optimize.OccurrenceOrderPlugin(),
        new webpack.DefinePlugin({
            APP_VERSION: JSON.stringify(git.tag()),
            __ELECTRON__: !!env.electron,
            __HASH_HISTORY__: !!env.hash,
            __BASE_URL__: JSON.stringify("baseUrl" in env ? env.baseUrl : "/"),
            __TESTNET__: !!env.testnet
        })
    ];

    // test environment
    plugins.push(new webpack.DefinePlugin({
        __TEST__: !!env.test
    }))

    var isProd = env.prod || env.test || env.testnet

    if (isProd) {
        // PROD OUTPUT PATH
github bitshares / bitshares-ui / webpack.config.js View on Github external
// COMMON PLUGINS
    const baseUrl = env.electron ? "" : "baseUrl" in env ? env.baseUrl : "/";

    /*
    * moment and react-intl include tons of locale files, use a regex and
    * ContextReplacementPlugin to only include certain locale files
    */
    let regexString = "";
    locales.forEach((l, i) => {
        regexString = regexString + (l + (i < locales.length - 1 ? "|" : ""));
    });
    const localeRegex = new RegExp(regexString);
    var plugins = [
        new webpack.optimize.OccurrenceOrderPlugin(),
        new webpack.DefinePlugin({
            APP_VERSION: JSON.stringify(git.tag()),
            __ELECTRON__: !!env.electron,
            __HASH_HISTORY__: !!env.hash,
            __BASE_URL__: JSON.stringify(baseUrl),
            __UI_API__: JSON.stringify(
                env.apiUrl || "https://ui.bitshares.eu/api"
            ),
            __TESTNET__: !!env.testnet,
            __DEPRECATED__: !!env.deprecated,
            __TEST__: false
        }),
        new webpack.ContextReplacementPlugin(
            /moment[\/\\]locale$/,
            localeRegex
        ),
        new webpack.ContextReplacementPlugin(
            /react-intl[\/\\]locale-data$/,

git-rev-sync

Synchronously get the current git commit hash, tag, or branch

MIT
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis

Similar packages