How to use the std-env.ci function in std-env

To help you get started, we’ve selected a few std-env 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 nuxt / consola / src / node.js View on Github external
function createConsola () {
  // Log level
  let level = env.debug ? 4 : 3
  if (process.env.CONSOLA_LEVEL) {
    level = parseInt(process.env.CONSOLA_LEVEL) || level
  }

  // Create new consola instance
  const consola = new Consola({
    level,
    reporters: [
      (env.ci || env.test)
        ? new BasicReporter()
        : new FancyReporter()
    ]
  })

  // Expose constructors
  consola.Consola = Consola
  consola.BasicReporter = BasicReporter
  consola.FancyReporter = FancyReporter
  consola.JSONReporter = JSONReporter
  consola.WinstonReporter = WinstonReporter

  return consola
}
github nuxt / nuxt.js / lib / common / nuxt.config.js View on Github external
buildDir: '.nuxt',
  nuxtDir,
  nuxtAppDir: path.resolve(nuxtDir, 'lib', 'app'),
  modulesDir: ['node_modules'], // ~> relative to options.rootDir

  // Ignore
  ignorePrefix: '-',
  ignore: [
    '**/*.test.*',
    '**/*.spec.*'
  ],

  extensions: [],

  build: {
    quiet: Boolean(env.ci || env.test),
    analyze: false,
    profile: process.argv.includes('--profile'),
    extractCSS: false,
    cssSourceMap: undefined,
    ssr: undefined,
    parallel: false,
    cache: false,
    publicPath: '/_nuxt/',
    filenames: {
      // { isDev, isClient, isServer }
      app: ({ isDev }) => isDev ? '[name].js' : '[chunkhash].js',
      chunk: ({ isDev }) => isDev ? '[name].js' : '[chunkhash].js',
      css: ({ isDev }) => isDev ? '[name].js' : '[contenthash].css',
      img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[hash:7].[ext]',
      font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[hash:7].[ext]',
      video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[hash:7].[ext]'
github nuxt / nuxt.js / packages / config / src / config / build.js View on Github external
export default () => ({
  quiet: Boolean(env.ci || env.test),
  analyze: false,
  profile: process.argv.includes('--profile'),
  extractCSS: false,
  crossorigin: undefined,
  cssSourceMap: undefined,
  ssr: undefined,
  parallel: false,
  cache: false,
  standalone: false,
  publicPath: '/_nuxt/',
  filenames: {
    // { isDev, isClient, isServer }
    app: ({ isDev, isModern }) => isDev ? `${isModern ? 'modern-' : ''}[name].js` : '[chunkhash].js',
    chunk: ({ isDev, isModern }) => isDev ? `${isModern ? 'modern-' : ''}[name].js` : '[chunkhash].js',
    css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
    img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[hash:7].[ext]',
github nuxt / press / jest.config.js View on Github external
setupFilesAfterEnv: ['./test/utils/setup'],

  coverageDirectory: './coverage',

  collectCoverageFrom: [
    'packages/**/*.js',
    '!**/blueprint/**',
    '!**/test/**'
  ],

  moduleNameMapper: {
    "@/(.*)$": "/test/$1",
    "~/(.*)$": "/src/$1",
    // TODO: enable this again when we re-introduce a build step
    "^pressModule$": false && stdEnv.ci ? "/" : "/distributions/nuxt-press/src"
  },

  transform: {
    '^.+\\.js$': 'babel-jest',
    '^.+\\.vue$': 'vue-jest'
  },

  moduleFileExtensions: [
    'js',
    'json'
  ],

  reporters: [
    'default',
    // ['jest-junit', { outputDirectory: 'reports/junit' }]
  ]
github nuxt / vue-meta / test / utils / build.js View on Github external
import { template } from 'lodash'
import webpack from 'webpack'
import CopyWebpackPlugin from 'copy-webpack-plugin'
import VueLoaderPlugin from 'vue-loader/lib/plugin'
import { createRenderer } from 'vue-server-renderer'
import stdEnv from 'std-env'

const renderer = createRenderer()

export { default as getPort } from 'get-port'

export function _import (moduleName) {
  return import(moduleName).then(m => m.default || m)
}

export const useDist = stdEnv.test && stdEnv.ci

export function getVueMetaPath (browser) {
  if (useDist) {
    return path.resolve(__dirname, `../..${browser ? '/dist/vue-meta.min.js' : ''}`)
  }

  process.server = !browser
  return path.resolve(__dirname, `../../src`)
}

export function webpackRun (config) {
  const compiler = webpack(config)

  return new Promise((resolve, reject) => {
    compiler.run((err, stats) => {
      if (err) {
github facebook / docusaurus / packages / docusaurus / src / webpack / utils.ts View on Github external
export function getCacheLoader(
  isServer: boolean,
  cacheOptions?: {},
): Loader | null {
  if (env.ci || env.test) {
    return null;
  }

  return {
    loader: require.resolve('cache-loader'),
    options: Object.assign(
      {
        cacheIdentifier: `cache-loader:${cacheLoaderVersion}${isServer}`,
      },
      cacheOptions,
    ),
  };
}

std-env

Runtime agnostic JS utils

MIT
Latest version published 11 days ago

Package Health Score

85 / 100
Full package analysis

Similar packages