Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: google/zx
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8.4.0
Choose a base ref
...
head repository: google/zx
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8.4.1
Choose a head ref
  • 7 commits
  • 24 files changed
  • 2 contributors

Commits on Mar 4, 2025

  1. chore(deps): update TS to 5.8 (#1120)

    antongolub authored Mar 4, 2025
    Copy the full SHA
    a38be55 View commit details

Commits on Mar 7, 2025

  1. ci: codeql tweakup (#1121)

    * chore: minor syntax imprs
    
    * ci(codeql): add bundles to `path-ignore`
    
    * ci: extract codeql config
    antongolub authored Mar 7, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    10a0eef View commit details

Commits on Mar 10, 2025

  1. feat(log): enhance cmd highlighter and make it configurable (#1122)

    closes #1119
    
    * fix: enhance cmd highlighter
    
    * test: add more `formatCmd` cases
    
    * feat: make `log.formatCmd` configurable
    
    * refactor: separate log module
    
    * test: provide tests for `log()`
    
    * docs: describe logger options
    antongolub authored Mar 10, 2025
    Copy the full SHA
    85c260c View commit details
  2. feat(log): provide custom formatting for every entry kind (#1123)

    * feat(log): provide custom formatting for every entry kind
    
    continues #1122
    
    * chore: ignore unknown log entries
    antongolub authored Mar 10, 2025
    Copy the full SHA
    2c4b5e8 View commit details

Commits on Mar 11, 2025

  1. chore(log): minor code imprs (#1125)

    antongolub authored Mar 11, 2025
    Copy the full SHA
    3d62660 View commit details
  2. ci: enable zizmor check (#1126)

    antongolub authored Mar 11, 2025
    Copy the full SHA
    5c3b179 View commit details

Commits on Mar 12, 2025

  1. docs: describe shell issues (#1128)

    * docs: describe shell issues
    
    closes #1127
    
    * chore: bump version to 8.4.1
    
    * Update shell.md
    
    ---------
    
    Co-authored-by: Anton Medvedev <anton@medv.io>
    antongolub and antonmedv authored Mar 12, 2025
    Copy the full SHA
    cb6f205 View commit details
11 changes: 11 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
paths:
- .github
- docs
- examples
- man
- src
- scripts
- test
- test-d
paths-ignore:
- build
3 changes: 3 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@ on:
schedule:
- cron: '28 6 * * 3'

permissions: {}

jobs:
analyze:
name: Analyze (${{ matrix.language }})
@@ -39,6 +41,7 @@ jobs:
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
config-file: ./.github/codeql/codeql-config.yml
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

2 changes: 2 additions & 0 deletions .github/workflows/dev-publish.yml
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ name: Dev Publish
on:
workflow_dispatch:

permissions: {}

jobs:
build:
runs-on: ubuntu-latest
2 changes: 2 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@ concurrency:
group: 'pages'
cancel-in-progress: false

permissions: {}

jobs:
deploy:
permissions:
2 changes: 2 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@ on:
release:
types: [created]

permissions: {}

jobs:
build:
runs-on: ubuntu-latest
2 changes: 2 additions & 0 deletions .github/workflows/osv.yml
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@

name: OSV-Scanner

permissions: {}

on:
pull_request:
branches: ['main']
30 changes: 30 additions & 0 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Zizmor

on:
push:
branches: ['main']
pull_request:
branches: ['**']

permissions: {}

jobs:
zizmor:
name: zizmor
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: false

- name: Run zizmor
run: uvx zizmor@1.5.0 .github/workflows -v -p --min-severity=medium
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,4 +5,5 @@ package/
reports/
docs/.vitepress/cache/
yarn.lock
pnpm-lock.yaml
temp
6 changes: 3 additions & 3 deletions .size-limit.json
Original file line number Diff line number Diff line change
@@ -9,14 +9,14 @@
{
"name": "zx/index",
"path": "build/*.{js,cjs}",
"limit": "812.1 kB",
"limit": "812 kB",
"brotli": false,
"gzip": false
},
{
"name": "dts libdefs",
"path": "build/*.d.ts",
"limit": "39 kB",
"limit": "39.3 kB",
"brotli": false,
"gzip": false
},
@@ -30,7 +30,7 @@
{
"name": "all",
"path": "build/*",
"limit": "851 kB",
"limit": "851.1 kB",
"brotli": false,
"gzip": false
}
1 change: 1 addition & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -75,6 +75,7 @@ export default defineConfig({
link: '/faq',
items: [
{ text: 'Quotes', link: '/quotes' },
{ text: 'Shell', link: '/shell' },
{ text: 'TypeScript', link: '/typescript' },
{ text: 'Markdown Scripts', link: '/markdown-scripts' },
{ text: 'Known Issues', link: '/known-issues' },
18 changes: 17 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ all `$` processes use `process.cwd()` by default (same as `spawn` behavior).

## `$.log`

Specifies a [logging function](src/core.ts).
Specifies a [logging function](src/log.ts).

```ts
import {LogEntry, log} from 'zx/core'
@@ -101,6 +101,22 @@ $.log = (entry: LogEntry) => {
}
```

Log mostly acts like a debugger, so by default it uses `process.error` for output.
Set `log.output` to change the stream.

```ts
$.log.output = process.stdout
```

Set `log.formatters` to customize each log entry kind printing:

```ts
$.log.formatters = {
cmd: (entry: LogEntry) => `CMD: ${entry.cmd}`,
fetch: (entry: LogEntry) => `FETCH: ${entry.url}`
}
```

## `$.timeout`

Specifies a timeout for the command execution.
23 changes: 23 additions & 0 deletions docs/shell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Shell

zx is not aimed to replace the shell, but to provide a more convenient way to use it through JavaScript enhancements. It supplements the shell with a more powerful and expressive language, so some kind of bash/zsh is still required.

zx provides several functions to help with setup:

* [`useBash`](./api#usebash) switches to bash
* [`usePowerShell`](./api#usepowershell) - PowerShell
* [`usePwsh`](./api#usepwsh) - pwsh (PowerShell v7+)

You can also set the shell directly via [JS API](./setup#bash), [CLI flags](./cli#shell) or [envars](./cli#environment-variables):

```js
$.shell = '/bin/zsh'
```

```bash
zx --shell /bin/zsh script.js
```

```bash
ZX_SHELL=/bin/zsh zx script.js
```
Loading