feat: update std-env to v3 (#10012) [release]

Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
renovate[bot] 2021-11-03 18:46:49 +01:00 committed by GitHub
parent 706e2a523a
commit c7ea13ea9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 52 additions and 51 deletions

View File

@ -33,7 +33,7 @@
"pretty-bytes": "^5.6.0",
"semver": "^7.3.5",
"serve-static": "^1.14.1",
"std-env": "^2.3.1",
"std-env": "^3.0.0",
"upath": "^2.0.1",
"wrap-ansi": "^7.0.0"
},

View File

@ -1,15 +1,15 @@
import consola from 'consola'
import env from 'std-env'
import { isTest, isMinimal } from 'std-env'
import chalk from 'chalk'
import { successBox } from './formatting'
import { getFormattedMemoryUsage } from './memory'
export function showBanner (nuxt, showMemoryUsage = true) {
if (env.test) {
if (isTest) {
return
}
if (env.minimalCLI) {
if (isMinimal) {
for (const listener of nuxt.server.listeners) {
consola.info('Listening on: ' + listener.url)
}

View File

@ -3,12 +3,12 @@ import exit from 'exit'
import { lock } from '@nuxt/utils'
import chalk from 'chalk'
import env from 'std-env'
import { isWindows } from 'std-env'
import { warningBox } from './formatting'
export const eventsMapping = {
add: { icon: '+', color: 'green', action: 'Created' },
change: { icon: env.windows ? '»' : '↻', color: 'blue', action: 'Updated' },
change: { icon: isWindows ? '»' : '↻', color: 'blue', action: 'Updated' },
unlink: { icon: '-', color: 'red', action: 'Removed' }
}

View File

@ -2,8 +2,8 @@ import { consola } from '../utils'
import { showBanner } from '../../src/utils/banner'
jest.mock('std-env', () => ({
test: false,
minimalCLI: true
isTest: false,
isMinimal: true
}))
describe('cli/utils', () => {

View File

@ -8,8 +8,8 @@ import { showMemoryUsage } from '../../src/utils/memory'
import * as fmt from '../../src/utils/formatting'
jest.mock('std-env', () => ({
test: false,
minimalCLI: false
isTest: false,
isMinimal: false
}))
jest.mock('boxen', () => text => `[boxen] ${text}`)

View File

@ -17,7 +17,7 @@
"dotenv": "^10.0.0",
"lodash": "^4.17.21",
"rc9": "^1.2.0",
"std-env": "^2.3.1",
"std-env": "^3.0.0",
"ufo": "^0.7.9"
},
"publishConfig": {

View File

@ -1,11 +1,11 @@
import { capitalize } from 'lodash'
import env from 'std-env'
import { isDevelopment, isTest } from 'std-env'
import { TARGETS } from '@nuxt/utils'
export default () => ({
// Env
dev: Boolean(env.dev),
test: Boolean(env.test),
dev: Boolean(isDevelopment),
test: Boolean(isTest),
debug: undefined, // = dev
env: {},

View File

@ -1,7 +1,7 @@
import env from 'std-env'
import { isCI, isTest } from 'std-env'
export default () => ({
quiet: Boolean(env.ci || env.test),
quiet: Boolean(isCI || isTest),
analyze: false,
profile: process.argv.includes('--profile'),
extractCSS: false,

View File

@ -1,15 +1,15 @@
import { getDefaultNuxtConfig } from '../../src/config'
jest.mock('std-env', () => ({
browser: false,
test: 'test',
dev: false,
production: true,
debug: false,
ci: true,
windows: false,
darwin: false,
linux: true
isBrowser: false,
isTest: true,
isDevelopment: false,
isProduction: true,
isDebug: false,
isCI: true,
isWindows: false,
isMacOS: false,
isLinux: true
}))
describe('config', () => {

View File

@ -3,15 +3,15 @@ import consola from 'consola'
import { getNuxtConfig } from '../src/options'
jest.mock('std-env', () => ({
browser: false,
test: 'test',
dev: false,
production: true,
debug: false,
ci: true,
windows: false,
darwin: false,
linux: true
isBrowser: false,
isTest: true,
isDevelopment: false,
isProduction: true,
isDebug: false,
isCI: true,
isWindows: false,
isMacOS: false,
isLinux: true
}))
jest.mock('@nuxt/utils', () => ({

View File

@ -1,9 +1,7 @@
import { resolve } from 'path'
import env from 'std-env'
import { isWindows } from 'std-env'
const isWin = env.windows
const rootDir = isWin ? 'C:\\nuxt' : '/var/nuxt'
const rootDir = isWindows ? 'C:\\nuxt' : '/var/nuxt'
export const createNuxt = () => ({
ready: jest.fn(),

View File

@ -37,7 +37,7 @@
"postcss-preset-env": "^6.7.0",
"postcss-url": "^8.0.0",
"semver": "^7.3.5",
"std-env": "^2.3.1",
"std-env": "^3.0.0",
"style-resources-loader": "^1.4.1",
"terser-webpack-plugin": "^4.2.3",
"thread-loader": "^3.0.4",

View File

@ -8,7 +8,7 @@ import * as PnpWebpackPlugin from 'pnp-webpack-plugin'
import HardSourcePlugin from 'hard-source-webpack-plugin'
import TerserWebpackPlugin from 'terser-webpack-plugin'
import WebpackBar from 'webpackbar'
import env from 'std-env'
import { isMinimal } from 'std-env'
import semver from 'semver'
import { isRelative } from 'ufo'
@ -446,8 +446,8 @@ export default class WebpackBaseConfig {
'profile',
'stats'
],
basic: !buildOptions.quiet && env.minimalCLI,
fancy: !buildOptions.quiet && !env.minimalCLI,
basic: !buildOptions.quiet && isMinimal,
fancy: !buildOptions.quiet && isMinimal,
profile: !buildOptions.quiet && buildOptions.profile,
stats: !buildOptions.quiet && !this.dev && buildOptions.stats,
reporter: {

View File

@ -1,14 +1,12 @@
import consola from 'consola'
import env from 'std-env'
import { isWindows } from 'std-env'
import exit from 'exit'
const isWin = env.windows
describe.win = isWindows ? describe : describe.skip
test.win = isWindows ? test : test.skip
describe.win = isWin ? describe : describe.skip
test.win = isWin ? test : test.skip
describe.posix = !isWin ? describe : describe.skip
test.posix = !isWin ? test : test.skip
describe.posix = !isWindows ? describe : describe.skip
test.posix = !isWindows ? test : test.skip
jest.setTimeout(60000)
@ -24,7 +22,7 @@ process.on('uncaughtException', errorTrap)
expect.extend({
toBePath (received, posixPath, winPath) {
const expectedPath = isWin ? winPath : posixPath
const expectedPath = isWindows ? winPath : posixPath
const pass = received === expectedPath
return {
pass,

View File

@ -12257,13 +12257,18 @@ static-extend@^0.1.1:
resolved "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=
std-env@^2.2.1, std-env@^2.3.0, std-env@^2.3.1:
std-env@^2.2.1, std-env@^2.3.0:
version "2.3.1"
resolved "https://registry.npmjs.org/std-env/-/std-env-2.3.1.tgz#d42271908819c243f8defc77a140fc1fcee336a1"
integrity sha512-eOsoKTWnr6C8aWrqJJ2KAReXoa7Vn5Ywyw6uCXgA/xDhxPoaIsBa5aNJmISY04dLwXPBnDHW4diGM7Sn5K4R/g==
dependencies:
ci-info "^3.1.1"
std-env@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/std-env/-/std-env-3.0.0.tgz#8dbd16bd2aadc18992072e2f5839e897f4ee2733"
integrity sha512-GoFEqAGzhaexp/T01rIiLOK9LHa6HmVwEUyeU4cwdSnOhfxpw9IMeAFi44SHWbCErEs29qEh7vAOUbtUmoycjA==
stream-browserify@^2.0.1:
version "2.0.2"
resolved "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b"