How to use the git-rev-sync.long function in git-rev-sync

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 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 devilesk / dota-interactive-map / gulpfile.js View on Github external
gulp.task('rollbar:sourcemap', () => {
    if (process.env.ROLLBAR_SERVER_TOKEN && process.env.ROLLBAR_SOURCE_MAPPING_URL_PREFIX) {
        return gulp.src('build/**/*.min.js')
            .pipe(sourcemaps.init({ loadMaps: true }))
            .pipe(rollbar({
                accessToken: process.env.ROLLBAR_SERVER_TOKEN,
                version: git.long(),
                sourceMappingURLPrefix: process.env.ROLLBAR_SOURCE_MAPPING_URL_PREFIX,
            }));
    }
    console.log('No rollbar config.');
});
github topheman / react-es6-redux / common.js View on Github external
function getInfos() {
  const gitActive = projectIsGitManaged();
  const gitRev = require('git-rev-sync');
  const moment = require('moment');
  const pkg = require('./package.json');
  const infos = {
    pkg: pkg,
    today: moment(new Date()).format('DD/MM/YYYY'),
    year: new Date().toISOString().substr(0, 4),
    gitRevisionShort: gitActive ? gitRev.short() : null,
    gitRevisionLong: gitActive ? gitRev.long() : null,
    author: (pkg.author && pkg.author.name) ? pkg.author.name : (pkg.author || null),
    urlToCommit: null
  };
  infos.urlToCommit = gitActive ? _getUrlToCommit(pkg, infos.gitRevisionLong) : null;
  return infos;
}
github LulumiProject / lulumi-browser / .electron-vue / build.js View on Github external
fs.readFile(constants, 'utf8', (err, data) => {
    if (err) {
      console.error(err)
    } else {
      try {
        const result = data.replace(/lulumiRev: ['a-z0-9]*,/, `lulumiRev: '${require('git-rev-sync').long('.')}',`)
        fs.writeFile(constants, result, 'utf8', (err) => {
          if (err) {
            console.error(err)
          } else build()
        });
      } catch (err) {
        console.error(err)
        fs.writeFile(constants, '0000000000000000000000000000000000000000', 'utf8', (err) => {
          if (err) {
            console.error(err)
          } else build()
        });
        build()
      }
    }
  })
github cloudwan / gohan_webui / webpack.config.js View on Github external
function version() {
  return {
    hash: gitSync.long(),
    tag: gitSync.tag(),
    version: process.env.npm_package_version
  };
}
github khartec / waltz / waltz-ng / webpack.config.js View on Github external
ignored: /node_modules/,
        aggregateTimeout: 800
        //poll: 1000
    },
    plugins: [
        new CleanWebpackPlugin(),
        new HtmlWebpackPlugin({
            title: "Waltz",
            filename: "index.html",
            template: "index.ejs",
            favicon: path.join(basePath, "images", "favicon.ico"),
            hash: true,
        }),
        new webpack.DefinePlugin({
            "__ENV__": JSON.stringify(process.env.BUILD_ENV || "dev"),
            "__REVISION__": JSON.stringify(git.long()),
        }),
        new Visualizer()
    ],
    module: {
        rules: [
            {
                test: /\.jsx?$/,
                use: ["babel-loader"],
                exclude: /node_modules/
            }, {
                test: /\.scss$/,
                use: [
                    {
                        loader: "thread-loader",
                        options: {
                            workerParallelJobs: 2
github drupal-graphql / drupal-decoupled-app / server / server.dev.js View on Github external
app.get('*', (req, res) => {

    const template = path.resolve(process.cwd(), 'build', 'views', 'index.ejs');
    const string = fs.readFileSync(template).toString();

    const data = {
      initialState    : JSON.stringify({}),
      preloadedData   : JSON.stringify([]),
      renderedContent : '',
      htmlAttributes  : '',
      htmlHead        : '',
      bodyClassName   : '',
      revision        : `${gitRevSync.branch()}/${gitRevSync.long()}`,
      buildDate       : (new Date()).toString(),
      webpackDll      : true,
    };

    res.send(ejs.render(string, data, {
      rmWhitespace : false,
    }));

  });
github TF2Stadium / Frontend / webpack.config.js View on Github external
extractVendorStyles,
    new CommonsChunkPlugin({
      name: 'vendor',
      filename: 'vendor.js',
      chunks: ['app', 'vendor'],
    }),
    new CommonsChunkPlugin({
      name: 'admin',
      filename: 'admin.js',
      chunks: ['admin'],
    }),
    new DefinePlugin({
      'process.env': JSON.stringify(_.pick(process.env, 'NODE_ENV')),
      '__BUILD_STATS__': JSON.stringify({
        gitCommit: {
          hash: gitRev.long() + '',
          branch: gitRev.branch() + '',
        },
        host: os.hostname(),
        time: +(new Date()),
      }),
    }),
    new HtmlWebpackPlugin({
      template: 'maintenance.html',
      filename: 'maintenance.html',
      hash: true,
      minify: {
        collapseWhitespace: true,
        minifyCSS: true,
        minifyJS: true,
      },
      inject: false,

git-rev-sync

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

MIT
Latest version published 2 years ago

Package Health Score

50 / 100
Full package analysis

Similar packages