128 Commits

Author SHA1 Message Date
Nate Fischer
964fb48e9e test: check for README changes in the unit tests
No change to logic. This checks for stale README in the unit tests
instead of by calling 'gendocs' directly.

The main goal is for GitHub CI to stop getting tripped up by
package-lock.json formatting changes. `npm install` sometimes overwrites
the package-lock file with a new format, and this breaks the
after-travis step.

Test: node_modules/.bin/ava test/docs.js
2025-11-18 22:25:05 -08:00
Nate Fischer
4580c00398
0.10.0 2025-05-09 12:16:36 -07:00
Nate Fischer
9a06336bc1 Deprecate the shjs binary
This removes the shjs binary. This feature was not widely used and it
was buggy. The recommended workaround is to invoke scripts directly with
'node' (you may also need to set your NODE_PATH environmental variable).

Dropping this script lets us trim down the dependency tree.

For those who still need the original script, the source code has moved
to https://github.com/shelljs/shjs.
2025-05-09 00:55:23 -07:00
Nate Fischer
3b03c85ef6
chore: remove accidental audit dep
I think this was installed by accident when running `npm audit`. The
`audit` module is entirely unrelated and I didn't meant to add a
dependency on this.
2025-05-05 16:56:51 -07:00
Julien Barbay
e48e919543
bump execa (#1216)
This update execa to v5.
2025-04-29 18:08:01 -07:00
Nate Fischer
8bc5833828 chore: update ava
This updates ava to v6. This resolves some `npm audit` warnings in our
project's devDependencies. This adds `workerThreads: false` because
operations like `process.chdir()` don't work in workers (but are
required for shelljs).

This is a partial fix #1180, although I found more errors when I ran the
tests locally on v22.10.0.

Test: npm audit
2025-04-10 01:11:39 -07:00
Nate Fischer
6434b5fed3 chore: update deps
This updates shelljs-release, shx, and travis-check-changes to the
latest versions.
2025-03-16 18:44:57 -07:00
Nate Fischer
b90139fb62
0.9.2 2025-03-16 17:50:04 -07:00
Nate Fischer
0a47587c92 fix: add package.json to exports list
No change to logic. shx has a dependency on shelljs/package.json so that
it can read the ShellJS version number. This is useful for shx and
probably harmless for other packages (we need to ship the package.json
file anyway), so this adds it to the exports list as an optional export.

Fixes #1195
Test: I ran `shx --version` with this copy of shelljs as the dependency
2025-03-08 22:55:22 -08:00
Nate Fischer
8c3c2ac385
0.9.1 2025-03-08 15:42:37 -08:00
Nate Fischer
f08195a1fd fix: add global.js and plugin.js to exports list
We intend for dependent projects to be able to import these files, so
this adds them to the explicit list of supported exports.

Fixes #1195
Test: tested this by running shelljs-plugin-open's test suite.
2025-03-08 15:39:11 -08:00
Nate Fischer
7d88393006
0.9.0 2025-03-08 15:02:06 -08:00
Nate Fischer
1b3904aa8e refactor: follow up fixes for static imports
No change to logic. This is a follow up to PR #1119. This change:

* Deletes commands.js entirely and edits the 'files' section of
  package.json
* Undoes some duplicate imports (ex. src/error)
* Adds an explicit import for exec-child.js as a hint for the bundler

After this change, I expect that bundlers/minifiers such as esbuild will
now correctly process shelljs.

Fixes #1160
2025-03-08 14:46:20 -08:00
Nate Fischer
495933f13a chore: update ava dep
No change to logic. This updates ava to major version 2. This is not the
latest version, however updating to version 3 is not trivial because of
some breaking changes.

This removes the commandline options from the ava invocation in favor of
moving this into the well-supported ava JSON configuration. This is
required for Windows compatibility, because otherwise Windows won't
properly expand "test/*.js" on the commandline and ava v2 won't expand
this unless it's specified in the JSON config.

Test: npm test
Test: npm run test-with-coverage
2025-03-08 14:18:53 -08:00
Nate Fischer
13cfe8a258 refactor: switch to fast-glob
This removes `node-glob` in favor of `fast-glob`. The main motivation
for this is because `node-glob` has a security warning and I can't
update to `node-glob@9` unless we drop compatibility for node v8.

Switching to `fast-glob` seems to be fairly straightforward, although
some options need to be changed by default for bash compatibility.

Fixes #828
Fixes #1149
2025-02-19 23:08:27 -08:00
Nate Fischer
7e71b2686d chore: drop support for old node versions
Dropping support for everything before node v18, which is the current
maintenance LTS and also the version in Ubuntu 24.04 LTS.

This also updates all devDependencies while trying to minimize the
required source code changes. Some devDependencies can go higher still
(ava, chalk), but this is going to require extensive refactoring.

Test: npm run test-with-coverage
Test: npm run lint
Test: npm run check-node-support
2025-02-17 22:31:10 -08:00
Nate Fischer
8a960da838 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).
2024-06-23 12:42:52 -07:00
Alejandro Ojeda Gutiérrez
78ed036573
Exports shell.js and make.js on package.json (#1135)
Exports shell.js and make.js on package.json so make.js can be imported as "shelljs/make" without require file extension when using ESM.
2023-11-16 21:18:40 -08:00
Nate Fischer
a987ecfab2 chore: update nyc to v15
No change to logic. This updates nyc (code coverage tool) to version 15,
which works around a breaking change that snuck into the latest Node LTS
versions.

Unfortunately, this version of nyc appears to break Node 8 and 9. We
need to work around this problem by skipping test coverage on those
versions.

Fixes #1130
2023-11-11 16:50:13 -08:00
Nate Fischer
5d25e9b25f chore: update deps
No change to logic. This updates a bunch of devDependencies.
2022-01-25 21:48:00 -08:00
Nate Fischer
624e53d6df chore: remove codecov devDependency
No change to logic. This removes the codecov package dependency because
this is provided through GitHub Actions now.
2022-01-16 20:04:15 -08:00
Nate Fischer
54049d49d8
chore: change supported node versions (#1011)
This adds testing for node v14. This removes testing for node v6 and v7
because codecov breaks on these versions. This omits node v15 because
appveyor doesn't seem to support this version. The nodejs org currently
supports [10, 12, 14, 15].

This makes a couple minor edits to the check-node-support script for
consistency with shelljs/shx#186.

This bumps the shx dependency because it seems we're hitting issue #973
on node v14.

Test: npm run check-node-support
2020-10-26 16:44:47 -07:00
Nate Fischer
a421b9e3a5
feat: add shell.cmd to replace exec (#866)
This adds an initial implementation of shell.cmd(), which is intended as
the eventual replacement for shell.exec(). This PR does not fully
implement the API, but demonstrates a simple and secure alternative, and
will allow further iteration to cover other use cases in follow-up PRs.

Design doc: https://shelljs.page.link/cmd-design

Issue #495
Test: automated test suite
2019-10-29 18:35:14 -07:00
Nate Fischer
9aef0026d4
chore: update dev deps (#971)
No change to logic.

This updates ava and nyc, to suppress npm audit error messages.

Fixes #969
2019-10-09 00:26:38 -07:00
Nate Fischer
57df38c6ea
chore(lint): update lint dependencies (#948)
This updates `eslint-config-airbnb-base` and `eslint-plugin-import`.
This also addresses lint errors these updates raise, and excludes
several rules.

This also adds a minor simplification to the gendocs script.

Test: npm run lint
Test: npm run gendocs
2019-07-12 12:36:55 -07:00
Nate Fischer
a8e543a8d0
chore(lint): upgrade eslint (#947)
This upgrades eslint to a new version to resolve a security warning.
This fixes a couple new lint errors, and disables some lint checks.

The current version of the airbnb lint config triggers
DeprecationWarnings in the new version of eslint. These warnings will be
resolved in a follow-up.

Test: npm run lint
2019-06-20 23:34:41 -07:00
Nate Fischer
5cab915f70
chore(test): no coverage by default (#920)
NYC takes forever on my local machine, and I generally prefer to look at
coverage reports on the website anyway.

This changes `npm test` to run without coverage, and changes our CI to
run `npm run test-with-coverage` instead.
2018-12-02 22:40:33 -08:00
Nate Fischer
3bb72eda8b
chore(node): drop node v4 and v5 (#917)
This drops support for node v4 and v5. Neither is currently supported by
the Node.js team, nor by the `npm` CLI team, so it's hard to justify we
continue to support it.

The new minimum supported version is v6.

Fixes #873
2018-12-01 20:23:46 -08:00
Nate Fischer
06450b8070
chore: script to bump supported node versions (#913)
No change to node support, this just adds a script.

This adds a script to check that we correctly configure all supported
node versions, since we need to update quite a few spots (README.md,
package.json, travis, appveyor).

Issue #873
Test: manual
2018-12-01 19:21:45 -08:00
Nate Fischer
87c1ff7d4c
chore(npm): remove lockfile (#911)
This removes our lockfile and our `ci-or-install` script. The lockfile
caused headaches, since `npm install` would modify the lockfile.

Unfortunately, `ci-or-install` (added in #896) didn't work reliably on
appveyor, so removing the lockfile seems easier. We remove the script
since it's now obsolete.

Fixes #893
2018-11-29 22:55:45 -08:00
Nate Fischer
d4d1317ce6
0.8.3 2018-11-12 20:49:46 -08:00
Nate Fischer
37acb86e89
chore(npm): add ci-or-install script (#896)
* chore(npm): add ci-or-install script

This adds a script which checks the npm version and runs either `npm ci`
or `npm install` based on support. This is primarily to work around an
issue where `npm install` modifies `package-lock.json` for newer npm
versions.

A side benefit is that `npm ci` is slightly faster than `npm install`.

Fixes #893
2018-10-27 13:48:31 -07:00
Nate Fischer
72ff790f4f
chore: bump dev dependencies and add package-lock (#864)
No change to logic.

This reduces install spam by bumping codecov to avoid depending on a
deprecated graceful-fs version, as well as adding a package-lock.json.
2018-06-28 14:15:38 -07:00
Nate Fischer
dd5551da0c
chore: update shelljs-release version (#846)
This bumps the version of our dependency, shelljs-release. I just cut
the 3.0 release for shelljs-release, which contains support for the
`--otp` flag, as well as the significant refactoring work we put in.
2018-05-08 21:30:32 -07:00
Nate Fischer
3b266d0a29 0.8.2 2018-05-08 00:09:33 -07:00
Nate Fischer
7058d63048 0.8.1 2018-01-20 14:58:43 -08:00
Nate Fischer
ec0d60aecf 0.8.0 2018-01-11 23:13:59 -08:00
Nate Fischer
8ab0a3a393
chore: update nyc dependency (#805)
This is to fix an issue related to the most recent node 8.x.y versions.

Fixes #803
2017-11-13 22:55:41 -08:00
Nate Fischer
cd1aabab39 chore: set AVA options (#780)
This sets 2 AVA options:

 * `serial`: same behavior as the CLI flag, which this replaces
 * `powerAssert`: if an assert fails, it will inspect all objects involved in
   the failed assert. This causes readability issues if `t.falsy(shell.error())`
   breaks, since it inspects all of `shell` (which is way too large).

AVA options are a little easier to manage than CLI options (we only update one
place instead of 2 in `package.json`).
2017-10-12 23:23:09 -07:00
Nate Fischer
2ee83ebf74 refactor(test): update AVA and refactor tests (#760)
This updates tests for `AVA` 19.0.0+.

`AVA` 0.18.0 has a breaking change which changes the current working directory
for tests. As a result, we need to change 'resources' -> 'test/resources' (and
 similar path changes).

`AVA` 0.19.0 has a breaking change that all tests must run at least one assert.
This breaking change was already resolved by #746, so no change was necessary in
this PR.

This updates to `AVA` 0.21.0, since there are no other breaking changes.
2017-08-11 11:03:13 -07:00
Nate Fischer
38b57c8942 chore: add skipOnWin and skipOnUnix test helpers (#746)
This adds `skipOnWin` and `skipOnUnix` to help us manage our platform-dependent
tests. These methods give a nice warning message when we skip tests. We may also
consider adding warnings when running platform-dependent tests.

Part of the motivation for this is if we ever update to AVA v0.19. This version
requires at least one assertion per test case. While this could be disabled with
an AVA setting, we instead benefit from warnings for any case when we
unintentionally skip assertions.

This adds chalk as a dev dependency to enable colored messages.
2017-06-18 11:51:01 -07:00
Nate Fischer
f74e783890 chore: remove v0.12 and iojs support (#648)
Fixes #647
2017-06-06 21:10:27 -07:00
Nate Fischer
38645675f1 0.7.8 2017-06-06 21:01:21 -07:00
Nate Fischer
95638cc773 0.7.7 2017-03-08 22:37:03 -08:00
Nate Fischer
fb09c6aab8 chore: add codecov script to appveyor CI (#686)
Invoke codecov on appveyor builds too, so that we can get coverage for
Windows-specific lines of code.

Partial fix for #671
2017-03-05 10:25:44 -08:00
Nate Fischer
eb5230a53c chore: add codecov (#682)
* chore: add codecov

Add codecov to ShellJS

Partial fix for #671

* Add codecov badge to README
2017-03-04 17:53:37 -08:00
Nate Fischer
2d0428b1c9 Switch commands.json -> commands.js (#668)
WebPack has issues with importing JSON directly and using JavaScript
methods on it. For this reason, using the `.forEach()` method on the
imported JSON array caused a method-not-found error.

Instead, we can make this a real JavaScript array by keeping it in a
JavaScript file and exporting it as a field.

It should be noted that exporting it as `exports = [...]` does not work,
because Node won't actually interpret it as a JavaScript array (with
the required methods). So instead we can export it as
`exports.list = [...]` and access the `list` field to get the real
JavaScript array of command names.

Fixes #667
2017-02-28 01:34:51 -08:00
Brandon Freitag
2e29ba29e6 0.7.6 2017-01-08 14:28:27 -08:00
Nate Fischer
ac0ff873f1 refactor: add config.reset() and .resetForTesting() (#641)
Add .reset() and .resetForTesting() to shell.config and use .resetForTesting()
as a standard set-up for unit tests.
2017-01-07 22:40:38 -08:00
Nate Fischer
a3e622ba0d chore: set up test coverage (#638)
Use nyc for test coverage and ignore all nyc-related files in git & eslint.
This increases testing time (~35sec -> ~60sec on my 4-core machine).
2016-12-27 19:39:13 -08:00