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", "pretty-bytes": "^5.6.0",
"semver": "^7.3.5", "semver": "^7.3.5",
"serve-static": "^1.14.1", "serve-static": "^1.14.1",
"std-env": "^2.3.1", "std-env": "^3.0.0",
"upath": "^2.0.1", "upath": "^2.0.1",
"wrap-ansi": "^7.0.0" "wrap-ansi": "^7.0.0"
}, },

View File

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

View File

@ -3,12 +3,12 @@ import exit from 'exit'
import { lock } from '@nuxt/utils' import { lock } from '@nuxt/utils'
import chalk from 'chalk' import chalk from 'chalk'
import env from 'std-env' import { isWindows } from 'std-env'
import { warningBox } from './formatting' import { warningBox } from './formatting'
export const eventsMapping = { export const eventsMapping = {
add: { icon: '+', color: 'green', action: 'Created' }, 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' } unlink: { icon: '-', color: 'red', action: 'Removed' }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@
"postcss-preset-env": "^6.7.0", "postcss-preset-env": "^6.7.0",
"postcss-url": "^8.0.0", "postcss-url": "^8.0.0",
"semver": "^7.3.5", "semver": "^7.3.5",
"std-env": "^2.3.1", "std-env": "^3.0.0",
"style-resources-loader": "^1.4.1", "style-resources-loader": "^1.4.1",
"terser-webpack-plugin": "^4.2.3", "terser-webpack-plugin": "^4.2.3",
"thread-loader": "^3.0.4", "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 HardSourcePlugin from 'hard-source-webpack-plugin'
import TerserWebpackPlugin from 'terser-webpack-plugin' import TerserWebpackPlugin from 'terser-webpack-plugin'
import WebpackBar from 'webpackbar' import WebpackBar from 'webpackbar'
import env from 'std-env' import { isMinimal } from 'std-env'
import semver from 'semver' import semver from 'semver'
import { isRelative } from 'ufo' import { isRelative } from 'ufo'
@ -446,8 +446,8 @@ export default class WebpackBaseConfig {
'profile', 'profile',
'stats' 'stats'
], ],
basic: !buildOptions.quiet && env.minimalCLI, basic: !buildOptions.quiet && isMinimal,
fancy: !buildOptions.quiet && !env.minimalCLI, fancy: !buildOptions.quiet && isMinimal,
profile: !buildOptions.quiet && buildOptions.profile, profile: !buildOptions.quiet && buildOptions.profile,
stats: !buildOptions.quiet && !this.dev && buildOptions.stats, stats: !buildOptions.quiet && !this.dev && buildOptions.stats,
reporter: { reporter: {

View File

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

View File

@ -12257,13 +12257,18 @@ static-extend@^0.1.1:
resolved "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" resolved "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= 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" version "2.3.1"
resolved "https://registry.npmjs.org/std-env/-/std-env-2.3.1.tgz#d42271908819c243f8defc77a140fc1fcee336a1" resolved "https://registry.npmjs.org/std-env/-/std-env-2.3.1.tgz#d42271908819c243f8defc77a140fc1fcee336a1"
integrity sha512-eOsoKTWnr6C8aWrqJJ2KAReXoa7Vn5Ywyw6uCXgA/xDhxPoaIsBa5aNJmISY04dLwXPBnDHW4diGM7Sn5K4R/g== integrity sha512-eOsoKTWnr6C8aWrqJJ2KAReXoa7Vn5Ywyw6uCXgA/xDhxPoaIsBa5aNJmISY04dLwXPBnDHW4diGM7Sn5K4R/g==
dependencies: dependencies:
ci-info "^3.1.1" 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: stream-browserify@^2.0.1:
version "2.0.2" version "2.0.2"
resolved "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b" resolved "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b"