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: shelljs/shx
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.4
Choose a base ref
...
head repository: shelljs/shx
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.4.0
Choose a head ref

Commits on Jan 17, 2022

  1. chore: remove codecov devDependency

    No change to logic. This removes the codecov package dependency because
    this is provided through GitHub Actions now.
    nfischer committed Jan 17, 2022
    Copy the full SHA
    4c70c1a View commit details
  2. chore(ci): run tests up to node v16

    No change to logic. This adds node v15 and v16 to the CI testing.
    nfischer committed Jan 17, 2022
    Copy the full SHA
    61aca96 View commit details

Commits on Aug 10, 2022

  1. chore: rename master -> main

    No change to logic. This updates the main branch name in the README.
    nfischer committed Aug 10, 2022
    Copy the full SHA
    bcb9e37 View commit details
  2. chore: update deps

    No change to logic. This only updates dependencies and adjusts code
    style to conform to the new `eslint`.
    
    The update was performed with:
    
    ```
    nvm use v16 --delete-prefix
    npm install -g npm-check-updates
    "$(npm config get prefix)/bin/ncu" -u --enginesNode
    ```
    nfischer committed Aug 10, 2022
    Copy the full SHA
    2d93fe9 View commit details
  3. chore: update CI to include v18

    No change to logic. This updates GitHub actions to test up through node
    v18.
    nfischer committed Aug 10, 2022
    Copy the full SHA
    05db932 View commit details

Commits on Aug 5, 2023

  1. fix(lint): fixes import order lint warnings

    I can't reproduce these warnings locally, but these appear to be failing
    on CI. This is a speculative fix.
    
    I also noticed that eslint-import-resolver-node updated today but has a
    breaking change that breaks node v6 compatibility. I'm adding this to
    devDependencies to pin this to the last non-broken version.
    nfischer committed Aug 5, 2023
    Copy the full SHA
    0cb9065 View commit details
  2. doc: highlight globs and emphasize double quotes

    This adds an "important" callout to emphasize that double quotes are
    necessary and single quotes won't work.
    
    Fixes #213
    nfischer committed Aug 5, 2023
    Copy the full SHA
    7442e02 View commit details
  3. chore: update CI to test against node v20

    No change to logic. This updates GitHub actions CI to test on node v19
    and v20.
    nfischer committed Aug 5, 2023
    Copy the full SHA
    515c650 View commit details
  4. docs: change GitHub Actions README badge

    This changes the README to use a standard shields.io badge for GitHub
    Actions. The custom badge
    (https://github.com/Atrox/github-actions-badge) was cool, but the
    atrox.dev link doesn't work reliably. I noticed that shields has support
    for this now, so there's no reason to use a custom badge.
    
    One notably difference is that this badge says the build is passing even
    if there's a job still in progress.
    nfischer committed Aug 5, 2023
    Copy the full SHA
    88de24f View commit details

Commits on Nov 12, 2023

  1. chore: keep node < 16 around longer

    GitHub is removing all versions < v16 from GitHub actions. I'm trying to
    keep Node coverage for as long as possible.
    
    Issue shelljs/shelljs#1140
    nfischer committed Nov 12, 2023
    Copy the full SHA
    1e00e29 View commit details

Commits on Nov 13, 2023

  1. Bump GitHub workflow action to latest version (#220)

    This PR bumps two GitHub workflow actions to their latest versions.
    deining authored Nov 13, 2023
    Copy the full SHA
    e50c8fe View commit details

Commits on Nov 20, 2023

  1. Copy the full SHA
    0dcbb9d View commit details

Commits on Jun 22, 2024

  1. chore: add codecov token

    No change to logic. This adds a codecov token to the project.
    nfischer committed Jun 22, 2024
    Copy the full SHA
    e86411b View commit details
  2. chore: remove unsupported node configs from CI

    No change to logic. GitHub Actions recently dropped some NodeJS
    configurations from their service. This excludes those configs from our
    CI.
    
    This also adds Node versions up through v22.
    
    Test: npm run check-node-support
    nfischer committed Jun 22, 2024
    Copy the full SHA
    8e22136 View commit details

Commits on Jun 23, 2024

  1. chore: switch to codecov v4

    No change to logic. This updates codecov/codecov-action to v4. This
    version supposedly has better support for external contributors working
    from repository forks.
    nfischer committed Jun 23, 2024
    Copy the full SHA
    c787042 View commit details
  2. chore(dependencies): update js-yaml

    This updates js-yaml to 4.1.0 and swaps out `yaml.safeLoad()` for
    `yaml.load()` because the `safe*` functions are deprecated starting in
    4.0.0 (the "regular" functions are considered safe).
    nfischer committed Jun 23, 2024
    Copy the full SHA
    03c2964 View commit details

Commits on Dec 20, 2024

  1. doc: Fix typo in README

    mpaw authored and nfischer committed Dec 20, 2024
    Copy the full SHA
    f8b0b37 View commit details

Commits on Mar 9, 2025

  1. chore: update shelljs and drop old node support

    This updates the ShellJS peer dependency to the latest release. This
    also drops support for all node versions prior to v18 to match ShellJS's
    version range.
    
    This includes some changes due to the latest shelljs version:
    
    * `shx sed -i` will now run silently. This is compatible with unix
      behavior. See shelljs/shelljs#959
    * `shx --version` no longer prints the ShellJS version. This is a
      consequence of the switch to an explicit "exports" list in shelljs
      (see shelljs/shelljs#1195 and shelljs/shelljs#1135).
    
    Test: npm test
    nfischer committed Mar 9, 2025
    Copy the full SHA
    b70e666 View commit details
  2. chore: drop non-LTS node versions

    No change to logic. This drops support for non-LTS versions. Non-LTS
    versions will now require community support (I will stll accept
    patches).
    nfischer committed Mar 9, 2025
    Copy the full SHA
    3bb21d9 View commit details
  3. chore: drop some dependencies and simplify

    No change to logic. This drops support for some of the package commands
    that I never run. We can trim out a few dependencies this way.
    
    This also adds `npm run build` as a step in CI since I realized this
    probably wasn't actually ever tested on CI.
    nfischer committed Mar 9, 2025
    Copy the full SHA
    e8bb9f8 View commit details
  4. chore: update dependencies

    No change to logic. This updates some of the easier dependencies.
    
    This adds two new line rule suppressions (if I don't suppress these,
    then I have lines which exceed the preferred line length).
    
    This also converts the mocha configuration to the new mocharc.js format.
    nfischer committed Mar 9, 2025
    Copy the full SHA
    5106c6b View commit details

Commits on Mar 17, 2025

  1. fix: add back ShellJS version in --version

    This is a small fix for the `--version` flag. This adds back ShellJS
    version number, which was re-exposed in PR shelljs/shelljs#1200. This
    reverts one of the workarounds added in PR #228.
    
    This also commits package-lock.json to the repo.
    nfischer committed Mar 17, 2025
    Copy the full SHA
    b3d5b80 View commit details
  2. Adding a global --negate flag (#189)

    * Adding a global --negate flag
    * Adding a new test case to negate a 0 output
    * Adding --negate to help command and adding an example in the readme.
    
    ---------
    
    Co-authored-by: SoTrx <-->
    SoTrx authored Mar 17, 2025
    Copy the full SHA
    6184003 View commit details
  3. refactor: code cleanup for the --negate flag

    No change to logic. This is a small refactor/cleanup for the '--negate'
    option added in PR #189.
    
    This also adds documentation to the README.
    nfischer committed Mar 17, 2025
    Copy the full SHA
    e8db3bc View commit details
  4. 0.4.0

    nfischer committed Mar 17, 2025
    Copy the full SHA
    8886c3e View commit details
Showing with 16,837 additions and 74 deletions.
  1. +2 −0 .eslintrc.json
  2. +9 −12 .github/workflows/main.yml
  3. +0 −1 .gitignore
  4. +5 −0 .mocharc.js
  5. +1 −1 CONTRIBUTING.md
  6. +27 −15 README.md
  7. +16,728 −0 package-lock.json
  8. +17 −25 package.json
  9. +8 −5 scripts/check-node-support.js
  10. +1 −1 src/cli.js
  11. +7 −7 src/help.js
  12. +7 −2 src/shx.js
  13. +0 −2 test/mocha.opts
  14. +25 −3 test/specs/cli.js
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@
"extends": "airbnb-base",
"rules": {
"curly": [2, "multi-line"],
"function-call-argument-newline": 0,
"function-paren-newline": 0,
"global-require": 0,
"import/no-dynamic-require": 0,
"import/no-extraneous-dependencies": 0,
21 changes: 9 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -10,27 +10,24 @@ jobs:
fail-fast: false
matrix:
node-version:
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 18
- 20
- 22
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run test
- run: npm run build
- run: npm run check-node-support
- uses: codecov/codecov-action@v2
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ lib
.nyc_output
coverage
.shxrc.json
package-lock.json

# Linux
*~
5 changes: 5 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// https://mochajs.org/#configuring-mocha-nodejs
module.exports = {
require: ['babel-register'], // Transpile files using Babel
recursive: true,
};
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

## Releasing

On the latest clean `master`:
On the latest clean `main`:

```
npm run release:major
42 changes: 27 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Shx

[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fshelljs%2Fshx%2Fbadge%3Fref%3Dmaster&style=flat-square)](https://actions-badge.atrox.dev/shelljs/shx/goto?ref=master)
[![Codecov](https://img.shields.io/codecov/c/github/shelljs/shx/master.svg?style=flat-square&label=coverage)](https://codecov.io/gh/shelljs/shx)
[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/shelljs/shx/main.yml?style=flat-square&logo=github)](https://github.com/shelljs/shx/actions/workflows/main.yml)
[![Codecov](https://img.shields.io/codecov/c/github/shelljs/shx/main.svg?style=flat-square&label=coverage)](https://codecov.io/gh/shelljs/shx)
[![npm version](https://img.shields.io/npm/v/shx.svg?style=flat-square)](https://www.npmjs.com/package/shx)
[![npm downloads](https://img.shields.io/npm/dm/shx.svg?style=flat-square)](https://www.npmjs.com/package/shx)

`shx` is a wrapper around [ShellJS](https://github.com/shelljs/shelljs) Unix
commands, providing an easy solution for simple Unix-like, cross-platform
commands in npm package scripts.

`shx` is proudly tested on every node release since <!-- start minVersion -->`v6`<!-- stop minVersion -->!
`shx` is proudly tested on every LTS node release since <!-- start minVersion -->`v18`<!-- stop minVersion -->!

## Difference Between ShellJS and shx

@@ -59,6 +59,8 @@ sub
$ shx rm -r sub # options work as well

$ shx --silent ls fakeFileName # silence error output

$ shx --negate test -d dir # Negate status code output (e.g., failed commands will now have status 0)
```

All commands internally call the ShellJS corresponding function, guaranteeing
@@ -71,19 +73,26 @@ platform-independent scripts, we recommend you go with that.

However, `shx` is ideal for one-liners inside `package.json`:

```javascript
```json
{
"scripts": {
"clean": "shx rm -rf build dist && shx echo Done"
"clean": "shx rm -rf \"build/**/*.js\" \"build/output\" && shx echo \"Done cleaning\""
}
}
```

**Tip:** because Windows treats single quotes (ex. `'some string'`) differently
than double quotes, [we
recommend](https://github.com/shelljs/shx/issues/165#issuecomment-563127983)
wrapping your arguments in double quotes for cross platform compatibility (ex.
`"some string"`).
It's safe to use `&&` and `||` operators in npm package scripts. These will be
interpreted by the operating system's shell (`sh` on Unix, `cmd.exe` on
Windows). If you're using glob operators like `*` or `**`, then we recommend to
**put these in double quotes**, which ensures that `shx` will expand the glob
rather than the operating system shell.

> [!IMPORTANT]
> Windows treats single quotes (ex. `'some string'`) differently than double
> quotes.
> [We recommend](https://github.com/shelljs/shx/issues/165#issuecomment-563127983)
> wrapping your arguments in **escaped double quotes** so that your code is
> compatible cross platform (ex. `"clean": "shx echo \"some string\""`).
## Command reference

@@ -114,7 +123,7 @@ characters in the file path.

### Unsupported Commands

As mentioned above, most ShellJS commands are supported in ShellJS. Due to the
As mentioned above, most ShellJS commands are supported in `shx`. Due to the
differences in execution environments between ShellJS and `shx` (JS vs CLI) the
following commands are not supported:

@@ -136,10 +145,13 @@ supported options:

| [`set`](https://github.com/shelljs/shelljs#setoptions) flag | [`shell.config`](https://github.com/shelljs/shelljs#configuration) setting | shx command | Effect |
|:---:| --- | --- | --- |
| `-e` | `config.fatal = true` | Not supported | Exit upon first error |
| `-v` | `config.verbose = true` | `shx --verbose cd foo` | Log the command as it's run |
| `-f` | `config.noglob = true` | `shx --noglob cat '*.txt'` | Don't expand wildcards |
| N/A | `config.silent = true` | `shx --silent cd noexist` | Don't show error output |
| `-e` | `config.fatal = true` | Not supported | Exit upon first error. |
| `-v` | `config.verbose = true` | `shx --verbose cd foo` | Log the command as it's run. |
| `-f` | `config.noglob = true` | `shx --noglob cat '*.txt'` | Don't expand wildcards. |
| N/A | `config.silent = true` | `shx --silent cd noexist` | Don't show error output. |
| N/A | N/A | `shx --negate test -d dir` | Runs the specified command but negates the exit status. Failed command = status 0, successful command = status 1. |
| N/A | N/A | `shx --help` | Show help text. |
| N/A | N/A | `shx --version` | Print the shx version. |

## Team

Loading