How to use ci-info - 10 common examples

To help you get started, we’ve selected a few ci-info 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 zeit / pkg / test / test-79-npm / update-notifier / update-notifier.js View on Github external
'use strict';

// anyway testing in ci
require('ci-info').isCI = false;

var spawnWasCalled;
var save = require('child_process').spawn;
require('child_process').spawn = function () {
  spawnWasCalled = true;
  return save.apply(this, arguments); // eslint-disable-line prefer-rest-params
};

var updateNotifier = require('update-notifier');
var pjson = { name: 'pkg', version: '3.0.0' };
var notifier;

function runNotifier () {
  notifier = updateNotifier({
    pkg: pjson,
    updateCheckInterval: 0
github zeit / next.js / packages / next / build / index.ts View on Github external
const { target } = config
  const buildId = await generateBuildId(config.generateBuildId, nanoid)
  const distDir = path.join(dir, config.distDir)
  const rewrites = []
  const redirects = []

  if (typeof config.experimental.redirects === 'function') {
    redirects.push(...(await config.experimental.redirects()))
    checkCustomRoutes(redirects, 'redirect')
  }
  if (typeof config.experimental.rewrites === 'function') {
    rewrites.push(...(await config.experimental.rewrites()))
    checkCustomRoutes(rewrites, 'rewrite')
  }

  if (ciEnvironment.isCI) {
    const cacheDir = path.join(distDir, 'cache')
    const hasCache = await fsAccess(cacheDir)
      .then(() => true)
      .catch(() => false)

    if (!hasCache) {
      // Intentionally not piping to stderr in case people fail in CI when
      // stderr is detected.
      console.log(
        chalk.bold.yellow(`Warning: `) +
          chalk.bold(
            `No build cache found. Please configure build caching for faster rebuilds. Read more: https://err.sh/next.js/no-cache`
          )
      )
      console.log('')
    }
github netlify / cli / src / utils / telemetry / index.js View on Github external
const path = require('path')
const { spawn } = require('child_process')
const isValidEventName = require('./validation')
const globalConfig = require('@netlify/cli-utils/src/global-config')
const ci = require('ci-info')

const IS_INSIDE_CI = ci.isCI

const DEBUG = false

function send(type, payload) {
  const requestFile = path.join(__dirname, 'request.js')
  const options = JSON.stringify({
    data: payload,
    type: type
  })

  if (DEBUG) {
    console.log(`${type} call`, payload)
    return Promise.resolve()
  }

  // spawn detached child process to handle send
github alibaba / funcraft / lib / visitor.js View on Github external
async function getVisitor(returnFakeIfMissingConfig = false) {

  if (!visitor) {
    const profile = await getProfileFromFile();

    // use fake if it is in a ci environment or has never been configured
    if (_.isEmpty(profile)) {

      if (detectMocha()) {
        return fakeMocha;
      }

      if (ci.isCI) {
        real.pageview(`/downloaded/ci/${ci.name}`).send();
      }

      return fake;
    }

    if (profile.report === undefined) {
      if (returnFakeIfMissingConfig) { return fake; }

      if (detectMocha()) {
        return fakeMocha;
      }

      visitor = real;
    }
github pangolinjs / core / lib / config / base.js View on Github external
.loader('file-loader')
        .options(generateFileLoaderOptions('fonts'))

  // Plugins

  config
    .plugin('env')
    .use(webpack.EnvironmentPlugin, [
      'NODE_ENV',
      'PANGOLIN_ENV'
    ])

  const progressConfig = {
    color: '#ff721f',
    name: 'Pangolin.js',
    reporters: ci.isCI ? ['basic'] : ['fancy']
  }

  if (process.env.PANGOLIN_ENV.startsWith('build')) {
    progressConfig.name = options.modern ? 'Modern' : 'Legacy'
    progressConfig.reporters.push('stats')
  }

  config
    .plugin('progress')
    .use(WebpackBar, [progressConfig])

  /**
   * Additional config for non-modern build
   */
  if (!options.modern) {
    config.entry('main')
github gucong3000 / gulp-reporter / lib / ci-reporter.js View on Github external
if (result[error.fileName]) {
			result[error.fileName].push(error);
		} else {
			result[error.fileName] = [error];
		}
	});
	return result;
}

function reduceErrors (files) {
	return files.reduce((errors, file) => (
		errors.concat(file.report.errors)
	), []).filter(Boolean);
}

if (ci.isCI && (ci.APPVEYOR || ci.CIRCLE || ci.JENKINS)) {
	appveyorApiUrl = process.env.APPVEYOR_API_URL;
	if (appveyorApiUrl) {
		// eslint-disable-next-line node/no-deprecated-api
		appveyorApiUrl = url.resolve(appveyorApiUrl, 'api/build/compilationmessages');
	}
	module.exports = function (files) {
		const errors = reduceErrors(files);
		if (!errors.length) {
			return noop();
		}
		let result;
		if (appveyorApiUrl) {
			result = appveyor(errors);
		} else {
			const errorSet = getErrorsByFile(errors);
			if (ci.CIRCLE) {
github gucong3000 / gulp-reporter / scripts / shorturl.js View on Github external
'use strict';
// process.env.HTTP_PROXY = 'http://127.0.0.1:1080/';
const JSDOM = require('jsdom').JSDOM;
const stringify = require('json-stable-stringify');
const fs = require('fs-extra');
const got = require('got');
const googl = require('goo.gl');
const pkg = require('../package.json');
const isCI = require('ci-info').isCI;
const http = require('http');
const https = require('https');
// Set a developer key (_required by Google_; see http://goo.gl/4DvFk for more info.)
googl.setKey('AIzaSyACqNSi3cybDvDfWMaPyXZEzQ6IeaPehLE');

function awaitArray (arr) {
	return Promise.all(arr.map(item => {
		if (Array.isArray(item)) {
			return awaitArray(item);
		} else {
			return item;
		}
	}));
}

function expandArray (arr, result) {
github serverless / serverless / lib / classes / Utils.js View on Github external
numberOfEventsPerType,
            eventNamesPerFunction,
          },
          general: {
            userId,
            context,
            invocationId,
            timestamp: new Date().getTime(),
            timezone: new Date().toString().match(/([A-Z]+[+-][0-9]+)/)[1],
            operatingSystem: process.platform,
            userAgent: process.env.SERVERLESS_DASHBOARD ? 'dashboard' : 'cli',
            serverlessVersion: serverless.version,
            nodeJsVersion: process.version,
            isDockerContainer: isDockerContainer(),
            isCISystem: ci.isCI,
            ciSystem: ci.name,
            isStandaloneExecutable: serverless.isStandaloneExecutable,
          },
        },
      };

      if (config.userId && data.properties && data.properties.general) {
        // add platformId to segment call
        data.properties.general.platformId = config.userId;
      }

      if (provider && provider.name && provider.name.toUpperCase() === 'AWS' && data.properties) {
        data.properties.aws = {
          hasIAMAuthorizer,
          hasCustomAuthorizer,
          hasCognitoAuthorizer,
        };
github alibaba / funcraft / lib / visitor.js View on Github external
async function getVisitor(returnFakeIfMissingConfig = false) {

  if (!visitor) {
    const profile = await getProfileFromFile();

    // use fake if it is in a ci environment or has never been configured
    if (_.isEmpty(profile)) {

      if (detectMocha()) {
        return fakeMocha;
      }

      if (ci.isCI) {
        real.pageview(`/downloaded/ci/${ci.name}`).send();
      }

      return fake;
    }

    if (profile.report === undefined) {
      if (returnFakeIfMissingConfig) { return fake; }

      if (detectMocha()) {
        return fakeMocha;
      }

      visitor = real;
    }

    if (profile.report === true) {
github gucong3000 / gulp-reporter / lib / get-options.js View on Github external
function getOptions (file) {
		if (typeof options === 'function') {
			options = options(file);
		}
		options = Object.assign({
			maxLineLength: 512,
			browser: false,
			output: !(ci.isCI && (ci.APPVEYOR || ci.CIRCLE || (ci.JENKINS && hasCheckstyle))),
			blame: true,
			fail: true,
			sort: true,
		}, options);
		return Promise.resolve(options.blame && getAuthor(file.cwd)).then(author => {
			options = Object.assign({
				author,
			}, options);

			if (typeof options.author === 'string') {
				if (/@/.test(options.author)) {
					options.author = {
						email: options.author,
					};
				} else {
					options.author = {

ci-info

Get details about the current Continuous Integration environment

MIT
Latest version published 1 month ago

Package Health Score

86 / 100
Full package analysis