837 Commits

Author SHA1 Message Date
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
Nate Fischer
9429aae203 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.

Tested this out with PR #1168.
2024-06-22 17:39:36 -07:00
Keith Mashinter
edac78e407
Fix Windows test errors in src/ls.js and test/cp.js. (#1166) 2024-06-22 17:05:47 -07:00
Nate Fischer
d81c32535b deprecate config.globOptions
This deprecates support for configuring `config.globOptions`. Exposing
this variable makes it difficult to change (or upgrade) our glob
library. This discourages users from depending on this config option
going forward.

If anyone is using `config.globOptions` then it should continue to
function, however this support is not promised for the long-term.

As far as I know, this is not a commonly used option:
https://github.com/shelljs/shelljs/issues?q=globOptions currently shows
no GitHub issues of users using this option, and there was never really
a motivation for why this needed to be exposed (#400 exposed the option
just because we could, not because we should).

This is one step toward supporting Issue #828.
2024-06-14 13:07:33 -07:00
Nate Fischer
c3797a9258 test: add more coverage for globOptions
No change to logic. This adds tests for more `config.globOptions`
values. This aims to cover the options which appear to be supported by
both node-glob and fast-glob, however the options have different names
in each module. This is a followup to PR #1163.

See https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#compatible-with-node-glob

Issue #828
2024-06-14 12:03:33 -07:00
Nate Fischer
d14782914f test: add test coverage for some globOptions
No change to logic. This adds test coverage support for all of the
globOptions which share the same name between node-glob and fast-glob.

See https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#compatible-with-node-glob

Issue #828
2024-06-14 10:55:43 -07:00
Nate Fischer
3529d5095f 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
2024-06-01 12:19:27 -07:00
Nate Fischer
2ff87eff00 test: create test files inside temp directory
No change to logic. This updates some test cases to create the files
they need inside the temp directory instead of in the repo itself. This
is helpful in case the test case fails early, that way we don't leave
this file behind.

This contributes toward #828, since the change to fast-glob made it
clear that this test was mishandling link files and leaving side effects
in the git repo. However this change is desirably independent of
fast-glob.
2024-02-17 18:07:35 -08:00
Nate Fischer
ec3e12bf37 chore: try codecov token again
I tried this recently in 1a1a820569f0883a317944973c15cf34431dd6c2 and
then reverted in b8b1c4224d0ec7d631d26c78922c018dd5b895f5. Unfortunately
I'm still seeing spurious failures from codecov, so let's try the token
one more time.

This time I double checked the token is provided by
https://app.codecov.io/gh/shelljs/shelljs/settings. I regenerated the
token for good measure.
2024-02-17 17:39:33 -08:00
Nate Fischer
a6d1e49f18 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.
2023-12-06 23:16:14 -08:00
Murph Murphy
85dd4729dd
test: make a test more forgiving for systems with non-standard bash and sh paths (#1144)
Made a test
more forgiving so it passes on systems that have non-standard `bash` and
`sh` binary paths.
2023-12-06 22:48:30 -08: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
Andreas Deininger
626973367f
Fixing typos (#1137)
This PR fixes a few typos that I spotted in the project.
2023-11-12 21:06:23 -08:00
Andreas Deininger
b5e53ebd12
Bump GitHub workflow actions to latest versions (#1136)
This PR bumps two GitHub workflow actions to their latest versions.
2023-11-12 21:05:27 -08:00
Nate Fischer
39ebb71846 test: add coverage for exit function
This adds test coverage for the shell.exit() function. This also
refactors how we mock stdout/stderr and adds support for mocking
process.exit() (which was needed for this change).

While I was writing these tests, I realized there was an edge case I
missed in PR #1122. This change fixes that edge case.

Issue #1013
2023-11-11 18:27:54 -08:00
Nate Fischer
b8b1c4224d chore: remove codecov token
It looks like 1a1a820569f0883a317944973c15cf34431dd6c2 actually broke
codecov. Codecov is currently trying to diff all PRs against the commit
before that one, which leads to flagging previously-added lines of code
as needing coverage in the current PR.

Let's try removing the token and see if codecov is happy again.

Fixes #1124
2023-11-11 17:42:46 -08:00
Nate Fischer
b704489221 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 #1140
2023-11-11 17:13:11 -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
e7ce4df63f docs: fix typo in security policy
No change to content. This fixes a missing ')' character.
2023-09-07 01:23:24 -07:00
Nate Fischer
f7a7c75d4d fix: shell.errorCode() honors shell.exit(code)
This changes shell.exit() to use a wrapper function. This is so that
shell.errorCode() will have the correct error code after invoking
shell.exit(code). This isn't normally relevant, however a caller may be
listening for the exit status:

```
process.on('exit', code => {
  shell.exit(shell.errorCode());
});
```

Issue #1013
2023-07-15 21:32:05 -07:00
Nate Fischer
547a739d61 chore: update CI to test against node v20
No change to logic. This updates GitHub actions CI to test on node v19
and v20.
2023-07-07 15:41:31 -07:00
Nate Fischer
1a1a820569 chore: add codecov token
This is supposed to fix codecov.

Fixes #1124
2023-07-05 18:29:23 -07:00
Nate Fischer
a3a7e7496d chore: update CI to include v18
No change to logic. This updates GitHub actions to test up through node
v18.
2022-08-09 21:49:21 -07:00
Marco Perrando
8c926df43a
Added -L to find to visit symlinked folders too. (#1080) 2022-02-24 19:18:29 -08:00
Nate Fischer
4b6b17a635 docs(touch): clarify docs for touch() command
No change to logic. This expands on the `touch()` command documentation
to make it more obvious how to use multiple options, long options, etc.
This also renames a variable in a test case to make the usage more
obvious.
2022-02-13 17:38:11 -08:00
Nate Fischer
5f0eab152c docs(import): document es6 import command
No change to logic. This documents that we support importing via
`import shell from 'shelljs'`.

Related to issue #1071, although some more investigation is required to
understand why the other syntax doesn't work.
2022-02-13 17:24:12 -08:00
Nate Fischer
9a0e5f6694
Add preserve option to cp (#869)
Co-authored-by: dwi2 <dwi2@dwi2.com>
2022-01-26 22:41:40 -08:00
Nate Fischer
a329b49780 test(cp): fix cp -Ru test cases
This fixes several issues with the cp -Ru test cases:

* Originally, I noticed the touch syntax looked wrong
* After fixing that, I was trying to figure out how the test case was
  even passing before. I realized one of the assertions was wrong (it
  was asserting sourceFile contents, but should have asserted destFile
  contents)
* I realized the test should have created a nested destination
  directory; without proper nesting, the sourceFile never actually
  collided with destFile during the copy
* Lastly, I swapped touch() usage to use hardcoded timestamps for test
  consistency
2022-01-26 20:00:00 -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
Andrea Canepa
42754c14ec
Added support for -n +NUM in tail.js (with sign) (#1027) 2022-01-15 13:44:54 -08:00
fhanrath
5af16d5c38
Feature/grep n (#1057) 2022-01-15 13:39:41 -08:00
JessieFrance
403a57cb9f
Feature: Expose Error Code (#1036) 2022-01-15 13:19:47 -08:00
Shubham Joshi
b473f2eab9
sed with -i option now runs silently (#959) 2022-01-15 13:09:02 -08:00
Nate Fischer
1a8e38d6f2 docs(chmod): briefly mention Windows file perms
File permissions on Windows are weird. This adds a brief note into the
README that this is something to watch out for. As far as I'm aware, WSL
completely avoids the weirdness because it's actually Linux (and so it
follows POSIX).
2022-01-15 12:59:19 -08:00
Nate Fischer
f45d256940 docs(ls): document the toString() override
No change to logic. This documents `shell.ls('-l')`'s `.toString()`
override. I noticed this feature was not documented. This string format
should not be depended on by programmatic usage, but it's useful to make
things more human readable.
2022-01-15 12:59:05 -08:00
Nate Fischer
b4daff5fd2
chore: add SECURITY.md (#1061)
No change to code. This adds a security policy.

Issue #1058
2022-01-06 22:39:44 -08:00
Nate Fischer
003a39d652
fix(exec): lockdown file permissions (#1060)
This locks down file permissions used by the internal implementation of
`shell.exec()`.

Issue #1058
Tested manually using the documented scenarios
2022-01-06 21:14:23 -08:00
Ian
ad911973cd
Removed mentions of documentup website (#1056) 2021-12-16 23:31:18 -08:00
Nate Fischer
d0a45166fd
chore: set up GitHub Actions CI (#1055) 2021-11-29 23:34:38 -08:00
TagawaHirotaka
0ae1dd681e
Fix test command example (#1043) 2021-09-02 23:34:41 -07:00
JessieFrance
79ae14d30d
remove file extension (#1033) 2021-06-02 16:23:58 -07:00
JessieFrance
124d3349af
Added mkdir -p tests for subdirectories (#1026) 2021-03-31 17:44:20 -07:00
Roy Ivy III
71085dba65
fix(mkdir): mitigate directory creation race condition (#1019) 2021-03-08 10:12:32 -08:00
Nate Fischer
cb64b92439
test(cmd): add test for caret char (#1017)
No change to logic. This adds a test case to make sure the caret
character ('^') is passed through to the command. This is to make sure
the character is not treated specially on Windows, where it's an escape
character in the shell.

Fixes #1015
2021-02-08 09:37:50 -08:00
reviewher
355bc754d2
Cleanup LICENSE (#966) 2020-10-26 16:46:43 -07: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
Zachary Snow
ba5d782fc2
Update ls with glob example. (#1006) 2020-09-02 23:31:59 -07:00
Chris Thielen
a8452b89f2 fix(mv): Fix moving files across volumes (#982)
At some point options parsing happened inside `_mv()` and `_cp()` but that is no longer the case so a parsed options object should be used instead.
2020-01-07 00:28:48 -08:00
Nate Fischer
aed6d994b5
chore: support up to node v13 (#978)
No change to logic. This just adds Travis and appveyor test support for
up to node v13. No change to the minimum supported version.
2019-11-13 22:35:03 -08:00