fix(xo-cli,xo-upload-ova}: dont use deprecated nice-pipe

BREAKING CHANGE: they now require Node >=10
This commit is contained in:
Julien Fontanet
2021-05-28 09:25:19 +02:00
parent 9984b5882d
commit f41903c2a1
5 changed files with 14 additions and 16 deletions

View File

@@ -27,7 +27,7 @@
"xo-upload-ova": "dist/index.js"
},
"engines": {
"node": ">=8.10"
"node": ">=10"
},
"dependencies": {
"chalk": "^4.1.0",
@@ -40,7 +40,6 @@
"human-format": "^0.11.0",
"l33teral": "^3.0.3",
"lodash": "^4.17.4",
"nice-pipe": "0.0.0",
"pretty-ms": "^7.0.0",
"progress-stream": "^2.0.0",
"pw": "^0.0.4",

View File

@@ -14,7 +14,6 @@ import l33t from 'l33teral'
import isObject from 'lodash/isObject'
import getKeys from 'lodash/keys'
import startsWith from 'lodash/startsWith'
import nicePipe from 'nice-pipe'
import prettyMs from 'pretty-ms'
import progressStream from 'progress-stream'
import pw from 'pw'
@@ -22,10 +21,13 @@ import stripIndent from 'strip-indent'
import { URL } from 'url'
import Xo from 'xo-lib'
import { parseOVAFile } from 'xo-vmdk-to-vhd'
import { pipeline } from 'stream'
import pkg from '../package'
import { load as loadConfig, set as setConfig, unset as unsetConfig } from './config'
const noop = Function.prototype
function help() {
return stripIndent(
`
@@ -206,7 +208,7 @@ export async function upload(args) {
url = new URL(result[key], baseUrl)
const { size: length } = await stat(file)
const input = nicePipe([
const input = pipeline(
createReadStream(file),
progressStream(
{
@@ -215,7 +217,8 @@ export async function upload(args) {
},
printProgress
),
])
noop
)
formData.append('file', input, { filename: 'file', knownLength: length })
try {
return await hrp.post(url.toString(), { body: formData, headers: formData.getHeaders() }).readAll('utf-8')

View File

@@ -27,7 +27,7 @@
"xo-cli": "dist/index.js"
},
"engines": {
"node": ">=8.10"
"node": ">=10"
},
"dependencies": {
"bluebird": "^3.5.1",
@@ -40,7 +40,6 @@
"lodash": "^4.17.4",
"micromatch": "^4.0.2",
"mkdirp": "^1.0.4",
"nice-pipe": "0.0.0",
"pretty-ms": "^7.0.0",
"progress-stream": "^2.0.0",
"promise-toolbox": "^0.19.2",

View File

@@ -19,7 +19,6 @@ const humanFormat = require('human-format')
const identity = require('lodash/identity')
const isObject = require('lodash/isObject')
const micromatch = require('micromatch')
const nicePipe = require('nice-pipe')
const pairs = require('lodash/toPairs')
const pick = require('lodash/pick')
const pump = require('pump')
@@ -27,7 +26,7 @@ const prettyMs = require('pretty-ms')
const progressStream = require('progress-stream')
const pw = require('pw')
const Xo = require('xo-lib').default
const { PassThrough } = require('stream')
const { PassThrough, pipeline } = require('stream')
// -------------------------------------------------------------------
@@ -80,6 +79,8 @@ function extractFlags(args) {
return flags
}
const noop = Function.prototype
const PARAM_RE = /^([^=]+)=([^]*)$/
function parseParameters(args) {
const params = {}
@@ -395,7 +396,7 @@ async function call(args) {
url = resolveUrl(baseUrl, result[key])
const { size: length } = await stat(file)
const input = nicePipe([
const input = pipeline(
createReadStream(file),
progressStream(
{
@@ -404,7 +405,8 @@ async function call(args) {
},
printProgress
),
])
noop
)
return hrp
.post(url, {

View File

@@ -11586,11 +11586,6 @@ next-tick@~1.0.0:
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
integrity sha1-yobR/ogoFpsBICCOPchCS524NCw=
nice-pipe@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/nice-pipe/-/nice-pipe-0.0.0.tgz#0e2069551244d64ce686a716511892fe4fb1d63a"
integrity sha1-DiBpVRJE1kzmhqcWURiS/k+x1jo=
nice-try@^1.0.4:
version "1.0.5"
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"