Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "git-rev-sync in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'git-rev-sync' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

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 : "");
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);
        }
    }
});
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()
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)
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);
        }
    }
});
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) {
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',
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),
{
            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
// 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$/,

Is your System Free of Underlying Vulnerabilities?
Find Out Now