Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update zx to 8.2.4 #852

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix(deps): update zx to 8.2.4 #852

wants to merge 1 commit into from

Conversation

chii-bot[bot]
Copy link
Contributor

@chii-bot chii-bot bot commented Apr 6, 2024

This PR contains the following updates:

Package Type Update Change
zx (source) dependencies major ^7.0.7 -> ^8.0.0

⚠ Dependency Lookup Warnings ⚠

Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information.


Release Notes

google/zx

v8.2.4

Compare Source

  • Fixed bun async_hooks compatibility #​959

v8.2.3

Compare Source

This release continues the work on pipe API enhancements:

const { stdout } = await $({ halt: true })`echo "hello"`
 .pipe`awk '{print $1" world"}'`
 .pipe`tr '[a-z]' '[A-Z]'`
 .run()

stdout // 'HELLO WORLD'
  • Let $ be piped directly from streams #​953
const getUpperCaseTransform = () =>
  new Transform({
    transform(chunk, encoding, callback) {
      callback(null, String(chunk).toUpperCase())
    },
  })

// $ > stream (promisified) > $ 
const o1 = await $`echo "hello"`
  .pipe(getUpperCaseTransform())
  .pipe($`cat`)

o1.stdout //  'HELLO\n'

// stream > $
const file = tempfile()
await fs.writeFile(file, 'test')
const o2 = await fs
  .createReadStream(file)
  .pipe(getUpperCaseTransform())
  .pipe($`cat`)

o2.stdout //  'TEST'
const file = tempfile()
const fileStream = fs.createWriteStream(file)
const p = $`echo "hello"`
  .pipe(getUpperCaseTransform())
  .pipe(fileStream)
const o = await p

p instanceof WriteStream             // true
o instanceof WriteStream             // true
o.stdout                             // 'hello\n'
o.exitCode;                          // 0
(await fs.readFile(file)).toString() // 'HELLO\n'

We've also slightly tweaked up dist contents for better compatibility with bundlers #​957

v8.2.2

Compare Source

What's Changed

Full Changelog: google/zx@8.2.1...8.2.2

v8.2.1

Compare Source

  • #​936 fixes endless streams piping
  • #​930 enables custom extensions support

v8.2.0

Compare Source

Pipes supercharge today! 🚀

Features

  • Delayed piping. You can fill dependent streams at any time during the origin process lifecycle (even when finished) without losing data. #​914
const result = $`echo 1; sleep 1; echo 2; sleep 1; echo 3`
const piped1 = result.pipe`cat`
let piped2

setTimeout(() => {
  piped2 = result.pipe`cat`
}, 1500)

await piped1
assert.equal((await piped1).toString(), '1\n2\n3\n')
assert.equal((await piped2).toString(), '1\n2\n3\n')
const file = tempfile()
const fileStream = fs.createWriteStream(file)
const p = $`echo "hello"`
  .pipe(
    new Transform({
      transform(chunk, encoding, callback) {
        callback(null, String(chunk).toUpperCase())
      },
    })
  )
  .pipe(fileStream)

p instanceof WriteStream             // true
await p === fileStream               // true
(await fs.readFile(file)).toString() // 'HELLO\n'

Chore

v8.1.9

Compare Source

Today's release is a minor update that includes:

Enhancements

  • We have replaced ProcessOutput fields with lazy getters to reduce mem consumption #​903, #​908
  • Reduced ReDos risks for codeblock patterns #​906
  • Kept argv reference on update #​916
  • Strengthened Shell interface to properly handle sync mode #​915:
expectType<ProcessPromise>($`cmd`)
expectType<ProcessPromise>($({ sync: false })`cmd`)
expectType<ProcessOutput>($({ sync: true })`cmd`)
expectType<ProcessOutput>($.sync`cmd`)

Fixes

v8.1.8

Compare Source

  • Apply the proper TeplateStringArray detection #​904, #​905
  • PromiseProcess got lazy getters to optimize mem usage #​903

v8.1.7

Compare Source

Step by step on the road to improvements

Fixes

Finally, we've fixed the issue with piped process rejection #​640 #​899:

const p1 = $`exit 1`.pipe($`echo hello`)
try {
  await p1
} catch (e) {
  assert.equal(e.exitCode, 1)
}

const p2 = await $({ nothrow: true })`echo hello && exit 1`.pipe($`cat`)
assert.equal(p2.exitCode, 0)
assert.equal(p2.stdout.trim(), 'hello')

Enhancements

Added cmd display to ProcessPromise #​891:

const foo = 'bar'
const p = $`echo ${foo}`

p.cmd // 'echo bar'

and duration field to ProcessOutput #​892:

const p = $`sleep 1`.nothrow()
const o = await p

o.duration // ~1000 (in ms)

Enabled zurk-like pipe string literals #​900:

const p = await $`echo foo`.pipe`cat`
p.stdout.trim() // 'foo'

v8.1.6

Compare Source

Improvements & Fixes
  • The $.preferLocal option now also accepts a directory #​886, #​887.
$.preferLocal = true             // injects node_modules/.bin to the $PATH
$.preferLocal = '/foo/bar'       // attaches /foo/bar to the $PATH
$.preferLocal = ['/bar', '/baz'] // now the $PATH includes both /bar and /baz

Why not just $.env['PATH'] = 'extra:' + '$.env['PATH']?
Well, the API internally does the same, but also handles the win paths peculiarities.

  • Provided $.killSignal option for the symmetry with the $.timeoutSignal. You can override the default termination flow #​885:
$.killSignal = 'SIGKILL'

const p = $({nothrow: true})`sleep 10000`
setTimeout(p.kill, 100)
  
(await p).signal // SIGKILL
  • $ opt presets became chainable #​883:
const $$ = $({ nothrow: true })
assert.equal((await $$`exit 1`).exitCode, 1)

const $$$ = $$({ sync: true }) // Both {nothrow: true, sync: true} are applied
assert.equal($$$`exit 2`.exitCode, 2)
  • Enhanced the internal Duration parser #​884:
const p = $({timeout: '1mss'})`sleep 999` // raises an error now
  • Abortion signal listeners are now removed after the process completes #​881, #​889, zurk#​12, zurk#​13.
  • Extended integration tests matrix, added nodejs-nightly builds and TS dev snapshots #​888

v8.1.5

Compare Source

We've rolled out a new release!

Fixes

  • Added the minimist typings to the dts bundle. #​872 brings the fix.
  • Re-enabled the YAML extra
    API. #​870 #​879

Chores

  • Clarified cd(), within() and syncProcessCwd() interactions. #​878
  • Included mention of the cwd option in the documentation. #​868
  • Test enhancements. #​877 #​880

v8.1.4

Compare Source

We continue optimizing bundles and CI/CD pipelines.

  • Update @​webpod/ps to v0.0.0-beta.7 to sync internal zurk version. #​855
  • Split vendor chunk to reduce the zx/core entry size. #​856
  • Add bundle size check. #​857
  • Refactor the testing flow, remove duplicated tasks. #​861
  • Add missing types for the global defaults. #​864
  • Omit redundant YAML API extras. #​866

Which gives us: 897 kB → 829 kB (-7.58%)

v8.1.3

Compare Source

Nothing special today. We just keep improving the implementation.

Features

import {$} from 'zx'
  • zx/cli exports its inners to allow more advanced usage.
    Imagine, your own CLI tool that uses zx as a base:
    #​828
#!/usr/bin/env node

import './index.mjs'
import {main} from 'zx/cli'

main()
  • Provide intermediate store configuration for fine-grained control of memory usage.
    #​650, #​849
const getFixedSizeArray = (size) => {
  const arr = []
  return new Proxy(arr, {
    get: (target, prop) =>
      prop === 'push' && arr.length >= size
        ? () => {}
        : target[prop],
  })
}
const store = {
  stdout: getFixedSizeArray(1),
  stderr: getFixedSizeArray(1),
  stdall: getFixedSizeArray(0),
}

const p = await $({ store })`echo foo`

p.stdout.trim() //  'foo'
p.toString()    // ''
  • Introduced sync methods for ps:
    #​840
import { ps } from 'zx'

const list1 = await ps()
const list2 = await tree()

// new methods
const list3 = ps.sync()
const list4 = tree.sync()

Chore

v8.1.2

Compare Source

Every new zx version is better than previous one. What have we here?

Features

  • Added ProcessPromise.verbose() to enhance debugging experience.
    #​820, #​710
const p = $`echo foo`
p.quiet()        // enable silent mode
p.quiet(false)   // then disable
p.verbose()      // enable verbose/debug mode
p.verbose(false) // and turn it off

await p
  • Aligned ProcessPromise.isSmth() API:
    #​823
const p = $`echo foo`

p.isHalted()
p.isVerbose()
p.isQuiet()
p.isNothrow()

Bug Fixes

  • fix: apply EOL ensurer to the last chunk only #​825
  • fix(cli): return exit code 1 on incorrect inputs #​826
  • fix: set cjs bundle as legacy main entrypoint #​827

Chore

v8.1.1

Compare Source

This release brings a pinch of sugar and minor fixes.

Features
  • Introduced $.preferLocal option to prefer node_modules/.bin located binaries over globally system installed ones.
    #​798
$.preferLocal = true

await $`c8 npm test`

await $({ preferLocal: true })`eslint .`
const p = $`echo 'foo\nbar'`

await p.text()        // foo\n\bar\n
await p.text('hex')   //  666f6f0a0861720a
await p.buffer()      //  Buffer.from('foo\n\bar\n')
await p.lines()       // ['foo', 'bar']
await $`echo '{"foo": "bar"}'`.json() // {foo: 'bar'}
  • ProcessPromise now exposes its signal reference.
    #​816
const p = $`sleep 999`
const {signal} = p

const res = fetch('https://example.com', {signal})

setTimeout(() => p.abort('reason'), 1000)
Fixes
  • CLI flag --quiet is mapped to $.quiet option. #​813
  • Module conditional exports are properly sorted now. #​812
  • A newline character is appended to the output of ProcessPromise if it's missing. #​810

v8.1.0

Compare Source

This new release is a big deal. It brings significant improvements in reliability and compatibility.

New features

Added usePwsh() helper to switch to PowerShell v7+ #​790

import {usePwsh, useBash} from 'zx'

usePwsh()
$.shell // 'pwsh'

useBash()
$.shell // 'bash'

timeout is now configurable $ opts #​796

import {$} from 'zx'

await $({ timeout: 100 })`sleep 999`

$.timeout = 1000            // Sets default timeout for all commands
$.timeoutSignal = 'SIGKILL' // Sets signal to send on timeout

await $`sleep 999`

Added --cwd option for CLI #​804

zx --cwd=/some/path script.js

Introduced tmpdir and tmpfile helpers #​803

import {tmpdir, tmpfile} from 'zx'

t1 = tmpdir()          // /os/based/tmp/zx-1ra1iofojgg/
t2 = tmpdir('foo')     // /os/based/tmp/zx-1ra1iofojgg/foo/

f1 = tmpfile()         // /os/based/tmp/zx-1ra1iofojgg
f2 = tmpfile('f.txt')  // /os/based/tmp/zx-1ra1iofojgg/foo.txt
f3 = tmpfile('f.txt', 'string or buffer')
  • Support CRLF for markdown script #​788
  • Added help digest for man #​806
  • Added compatibility with Deno 1.x. → zx seems to be working with Deno 1.x.

v8.0.2

Compare Source

In this release:

  • Added configurable detached option (#​782)
  • Fixed pkg typings entries for tsd tests (#​780)

v8.0.1

Compare Source

In this release:

  • Added feature: add stdio option (#​772)
  • Added feature: support signal opt (#​769)
  • Fixed: additional process.kill fallback for bun (#​770)

v8.0.0

Compare Source

We are thrilled to announce the release of zx v8.0.0! 🎉

With this release, we have introduced a lot of new features, improvements, and bug fixes.
We have also made some breaking changes, so please read the following release notes carefully.

🚀 New Shiny Features

Squashed deps: we use esbuild with custom plugins to forge js bundles and dts-bundle-generator for typings 2acb0f, #​722

More safety, more stability and significantly reduced installation time. Zx now is ~20x smaller.

Options presets are here. To implement this, we have also completely refactored the zx core, and now it's available as a separate package – zurk\ aeec7a, #​733, #​600

const $$ = $({quiet: true})
await $$`echo foo`

$({nothrow: true})`exit 1`

We have introduced $.sync() API\ 1f8c8b, #​738, #​681, 1d8aa9, #​739

import {$} from 'zx'

const { output } = $.sync`echo foo` // foo

You can also override the internal API to implement pools, test mocking, etc.

$.spawnSync = () => {} // defaults to `child_process.spawnSync`

The input option is now available to pass data to the command.\ b38972, #​736

const p1 = $({ input: 'foo' })`cat`
const p2 = $({ input: Readable.from('bar') })`cat`
const p3 = $({ input: Buffer.from('baz') })`cat`
const p4 = $({ input: p3 })`cat`
const p5 = $({ input: await p3 })`cat`

AbortController has been introduced to abort the command execution. It's available via the ac option.\ fa4a7b, #​734, #​527

const ac = new AbortController()
const p = $({ ac })`sleep 9999`

setTimeout(() => ac.abort(), 100)

If not specified, the default instance will be used. Abortion trigger is also available via PromiseResponse:

const p = $`sleep 9999`
setTimeout(() => p.abort(), 100)

kill method is exposed now. To terminate any (not only zx starter) process:

import { kill } from 'zx'

await kill(123)
await kill(123, 'SIGKILL')

Btw, we have replaced ps-tree with @​webpod/ps & @​webpod/ingrid, and exposed ps util:

import {ps} from 'zx'

const children = await ps.tree(123)
/**
 [
 {pid: 124, ppid: 123},
 {pid: 125, ppid: 123}
 ]
 */
const children2 = await ps.tree({pid: 123, recursive: true})
/**
 [
 {pid: 124, ppid: 123},
 {pid: 125, ppid: 123},

 {pid: 126, ppid: 124},
 {pid: 127, ppid: 124},
 {pid: 128, ppid: 124},

 {pid: 129, ppid: 125},
 {pid: 130, ppid: 125},
 ]
 */

Introduced $.postfix option. It's like a $.prefix, but for the end of the command. fb9554, #​756, #​536

import {$} from 'zx'

$.postfix = '; exit $LastExitCode' // for PowerShell compatibility

minimist API exposed\ #​661

import { minimist } from 'zx'

const argv = minimist(process.argv.slice(2), {})

Fixed npm package name pattern on --install mode 956dcc, #​659, #​660, #​663

import '@&#8203;qux/pkg'       // valid
import '@&#8203;qux/pkg/entry' // was invalid before and valid now
⚠️ Breaking changes

We've tried our best to avoid them, but it was necessary.

  1. $.verbose is set to false by default, but errors are still printed to stderr. Set $.quiet = true to suppress all output.\ cafb90, #​745, #​569

    $.verbose = true // everything works like in v7
    
    $.quiet = true // to completely turn off logging
  2. ssh API was dropped. Install webpod package instead.\ 8925a1, #​750

    // import {ssh} from 'zx' ↓
    import {ssh} from 'webpod'
    
    const remote = ssh('user@host')
    await remote`echo foo`
  3. zx is not looking for powershell anymore, on Windows by default. If you still need it, use the usePowerShell helper:\ 24dcf3, #​757

    import { usePowerShell, useBash } from 'zx'
    
    usePowerShell() // to enable powershell
    useBash()       // switch to bash, the default
  4. Process cwd synchronization between $ invocations is disabled by default. This functionality is provided via an async hook and can now be controlled directly.\ d79a63, #​765

    import { syncProcessCwd } from 'zx'
    
    syncProcessCwd() // restores legacy v7 behavior
🧰 Other Improvements

v7.2.3

Compare Source

What's Changed

New Contributors

Full Changelog: google/zx@7.2.2...7.2.3

v7.2.2

Compare Source

What's Changed

New Contributors

Full Changelog: google/zx@7.2.1...7.2.2

v7.2.1

Compare Source

What's Changed

New Contributors

Full Changelog: google/zx@7.2.0...7.2.1

v7.2.0

Compare Source

🐚 zx v7.2.0 release! 🎉

A tool for writing better scripts

zx

In this release:

  • Helpers retry() & spinner() now available in zx without the experimental flag.
  • Added support for ~~~ blocks in markdown scripts.
  • Updated npm dependencies.
  • Added support for ssh commands via webpod.

PS: Plan for the next v8 release.

v7.1.1

Compare Source

  • Fixed default shell on Windows: if bash is installed, use bash by default.

v7.1.0

Compare Source

Autoinstall

This release introduces a new flag --install which will parse and install all required or imported packages automatically.

import sh from 'tinysh'
sh.say('Hello, world!')

And running zx --install script.mjs will trigger installation of tinysh package! It even possible to specify a needed version in comment with @ symbol:

import sh from 'tinysh' // @&#8203;^1.0.0
PowerShell

Another big change is for Windows. Now, the default shell on Windows is powershell.exe.

This should fix a lot of issues with "dollar" signs.

Fixes
  • Minimist now correctly parses argv when using zx cli.

v7.0.8

Compare Source

What's Changed

Full Changelog: google/zx@7.0.7...7.0.8


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, click this checkbox.

This PR has been generated by Renovate Bot.

| datasource | package | from  | to    |
| ---------- | ------- | ----- | ----- |
| npm        | zx      | 7.0.7 | 8.0.0 |
@chii-bot chii-bot bot requested a review from toboshii as a code owner April 6, 2024 01:02
@chii-bot chii-bot bot added type/major size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 6, 2024
@chii-bot
Copy link
Contributor Author

chii-bot bot commented Apr 6, 2024

MegaLinter status: ❌ ERROR

Descriptor Linter Files Fixed Errors Elapsed time
❌ COPYPASTE jscpd yes 2 0.78s
✅ REPOSITORY git_diff yes no 0.02s
✅ REPOSITORY secretlint yes no 1.01s

See errors details in artifact MegaLinter reports on CI Job page
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.0.0 fix(deps): update zx to 8.0.1 Apr 8, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.0.1 fix(deps): update zx to 8.0.2 Apr 18, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.0.2 fix(deps): update zx to 8.1.0 May 13, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.1.0 fix(deps): update zx to 8.1.1 May 23, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.1.1 fix(deps): update zx to 8.1.2 May 27, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.1.2 fix(deps): update zx to 8.1.3 Jun 19, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.1.3 fix(deps): update zx to 8.1.4 Jul 4, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.1.4 fix(deps): update zx to 8.1.5 Aug 28, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.1.5 fix(deps): update zx to 8.1.6 Sep 11, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.1.6 fix(deps): update zx to 8.1.7 Sep 17, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.1.7 fix(deps): update zx to 8.1.8 Sep 19, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.1.8 fix(deps): update zx to 8.1.9 Oct 6, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.1.9 fix(deps): update zx to 8.2.0 Oct 31, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.2.0 fix(deps): update zx to 8.2.1 Nov 9, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.2.1 fix(deps): update zx to 8.2.2 Nov 12, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.2.2 fix(deps): update zx to 8.2.3 Nov 28, 2024
@chii-bot chii-bot bot changed the title fix(deps): update zx to 8.2.3 fix(deps): update zx to 8.2.4 Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/major
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants