How to use the ci-info.isCI function in ci-info

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 / 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 watson / is-ci / index.js View on Github external
'use strict'

module.exports = require('ci-info').isCI
github graalvm / graaljs / deps / npm / bin / npm-cli.js View on Github external
npm.load(conf, function (er) {
    if (er) return errorHandler(er)
    if (
      !isGlobalNpmUpdate &&
      npm.config.get('update-notifier') &&
      !unsupported.checkVersion(process.version).unsupported
    ) {
      const pkg = require('../package.json')
      let notifier = require('update-notifier')({pkg})
      const isCI = require('ci-info').isCI
      if (
        notifier.update &&
        notifier.update.latest !== pkg.version &&
        !isCI
      ) {
        const color = require('ansicolors')
        const useColor = npm.config.get('color')
        const useUnicode = npm.config.get('unicode')
        const old = notifier.update.current
        const latest = notifier.update.latest
        let type = notifier.update.type
        if (useColor) {
          switch (type) {
            case 'major':
              type = color.red(type)
              break
github gucong3000 / gulp-reporter / lib / get-options.js View on Github external
module.exports = function (options) {
	const authorCache = {};
	const termColumns = ci.isCI
		? 160
		: Math.max(termSize().columns, 80);

	function getAuthor (cwd) {
		return authorCache[cwd] || (authorCache[cwd] = gitAuthor(cwd));
	}

	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,

ci-info

Get details about the current Continuous Integration environment

MIT
Latest version published 6 months ago

Package Health Score

79 / 100
Full package analysis