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

View File

@@ -14,7 +14,6 @@ import l33t from 'l33teral'
import isObject from 'lodash/isObject' import isObject from 'lodash/isObject'
import getKeys from 'lodash/keys' import getKeys from 'lodash/keys'
import startsWith from 'lodash/startsWith' import startsWith from 'lodash/startsWith'
import nicePipe from 'nice-pipe'
import prettyMs from 'pretty-ms' import prettyMs from 'pretty-ms'
import progressStream from 'progress-stream' import progressStream from 'progress-stream'
import pw from 'pw' import pw from 'pw'
@@ -22,10 +21,13 @@ import stripIndent from 'strip-indent'
import { URL } from 'url' import { URL } from 'url'
import Xo from 'xo-lib' import Xo from 'xo-lib'
import { parseOVAFile } from 'xo-vmdk-to-vhd' import { parseOVAFile } from 'xo-vmdk-to-vhd'
import { pipeline } from 'stream'
import pkg from '../package' import pkg from '../package'
import { load as loadConfig, set as setConfig, unset as unsetConfig } from './config' import { load as loadConfig, set as setConfig, unset as unsetConfig } from './config'
const noop = Function.prototype
function help() { function help() {
return stripIndent( return stripIndent(
` `
@@ -206,7 +208,7 @@ export async function upload(args) {
url = new URL(result[key], baseUrl) url = new URL(result[key], baseUrl)
const { size: length } = await stat(file) const { size: length } = await stat(file)
const input = nicePipe([ const input = pipeline(
createReadStream(file), createReadStream(file),
progressStream( progressStream(
{ {
@@ -215,7 +217,8 @@ export async function upload(args) {
}, },
printProgress printProgress
), ),
]) noop
)
formData.append('file', input, { filename: 'file', knownLength: length }) formData.append('file', input, { filename: 'file', knownLength: length })
try { try {
return await hrp.post(url.toString(), { body: formData, headers: formData.getHeaders() }).readAll('utf-8') 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" "xo-cli": "dist/index.js"
}, },
"engines": { "engines": {
"node": ">=8.10" "node": ">=10"
}, },
"dependencies": { "dependencies": {
"bluebird": "^3.5.1", "bluebird": "^3.5.1",
@@ -40,7 +40,6 @@
"lodash": "^4.17.4", "lodash": "^4.17.4",
"micromatch": "^4.0.2", "micromatch": "^4.0.2",
"mkdirp": "^1.0.4", "mkdirp": "^1.0.4",
"nice-pipe": "0.0.0",
"pretty-ms": "^7.0.0", "pretty-ms": "^7.0.0",
"progress-stream": "^2.0.0", "progress-stream": "^2.0.0",
"promise-toolbox": "^0.19.2", "promise-toolbox": "^0.19.2",

View File

@@ -19,7 +19,6 @@ const humanFormat = require('human-format')
const identity = require('lodash/identity') const identity = require('lodash/identity')
const isObject = require('lodash/isObject') const isObject = require('lodash/isObject')
const micromatch = require('micromatch') const micromatch = require('micromatch')
const nicePipe = require('nice-pipe')
const pairs = require('lodash/toPairs') const pairs = require('lodash/toPairs')
const pick = require('lodash/pick') const pick = require('lodash/pick')
const pump = require('pump') const pump = require('pump')
@@ -27,7 +26,7 @@ const prettyMs = require('pretty-ms')
const progressStream = require('progress-stream') const progressStream = require('progress-stream')
const pw = require('pw') const pw = require('pw')
const Xo = require('xo-lib').default const Xo = require('xo-lib').default
const { PassThrough } = require('stream') const { PassThrough, pipeline } = require('stream')
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -80,6 +79,8 @@ function extractFlags(args) {
return flags return flags
} }
const noop = Function.prototype
const PARAM_RE = /^([^=]+)=([^]*)$/ const PARAM_RE = /^([^=]+)=([^]*)$/
function parseParameters(args) { function parseParameters(args) {
const params = {} const params = {}
@@ -395,7 +396,7 @@ async function call(args) {
url = resolveUrl(baseUrl, result[key]) url = resolveUrl(baseUrl, result[key])
const { size: length } = await stat(file) const { size: length } = await stat(file)
const input = nicePipe([ const input = pipeline(
createReadStream(file), createReadStream(file),
progressStream( progressStream(
{ {
@@ -404,7 +405,8 @@ async function call(args) {
}, },
printProgress printProgress
), ),
]) noop
)
return hrp return hrp
.post(url, { .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" resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= 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: nice-try@^1.0.4:
version "1.0.5" version "1.0.5"
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"