Skip to content

Commit 630625d

Browse files
bodia-uztmcw
authored andcommitted
fix: get rid of shelljs dependency
1 parent b309d39 commit 630625d

File tree

4 files changed

+7
-25
lines changed

4 files changed

+7
-25
lines changed

__tests__/lib/input/dependency.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const os = require('os');
2-
const shell = require('shelljs');
32
const path = require('path');
43
const fs = require('fs');
54
const dependency = require('../../../src/input/dependency');

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"remark-reference-links": "^4.0.1",
4545
"remark-toc": "^5.0.0",
4646
"remote-origin-url": "0.4.0",
47-
"shelljs": "^0.8.1",
4847
"stream-array": "^1.1.2",
4948
"strip-json-comments": "^2.0.1",
5049
"tiny-lr": "^1.1.0",

src/smart_glob.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
const fs = require('fs');
33
const path = require('path');
44
const glob = require('glob');
5-
const shell = require('shelljs');
65

76
/**
87
* Replace Windows with posix style paths
@@ -59,7 +58,10 @@ function processPath(extensions) {
5958
let newPath = pathname;
6059
const resolvedPath = path.resolve(cwd, pathname);
6160

62-
if (shell.test('-d', resolvedPath)) {
61+
if (
62+
fs.existsSync(resolvedPath) &&
63+
fs.lstatSync(resolvedPath).isDirectory()
64+
) {
6365
newPath = pathname.replace(/[/\\]$/, '') + suffix;
6466
}
6567

@@ -107,7 +109,7 @@ function listFilesToProcess(globPatterns: Array<string>): Array<string> {
107109

108110
globPatterns.forEach(function(pattern) {
109111
const file = path.resolve(cwd, pattern);
110-
if (shell.test('-f', file)) {
112+
if (fs.existsSync(file) && fs.statSync(file).isFile()) {
111113
addFile(fs.realpathSync(file));
112114
} else {
113115
const globOptions = {

yarn.lock

+2-20
Original file line numberDiff line numberDiff line change
@@ -2693,7 +2693,7 @@ glob@^6.0.1:
26932693
once "^1.3.0"
26942694
path-is-absolute "^1.0.0"
26952695

2696-
glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2:
2696+
glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2:
26972697
version "7.1.2"
26982698
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
26992699
dependencies:
@@ -2979,10 +2979,6 @@ inquirer@^3.0.6:
29792979
strip-ansi "^4.0.0"
29802980
through "^2.3.6"
29812981

2982-
interpret@^1.0.0:
2983-
version "1.0.3"
2984-
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90"
2985-
29862982
invariant@^2.2.0, invariant@^2.2.2:
29872983
version "2.2.2"
29882984
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360"
@@ -5166,12 +5162,6 @@ realpath-native@^1.0.0:
51665162
dependencies:
51675163
util.promisify "^1.0.0"
51685164

5169-
rechoir@^0.6.2:
5170-
version "0.6.2"
5171-
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
5172-
dependencies:
5173-
resolve "^1.1.6"
5174-
51755165
redent@^1.0.0:
51765166
version "1.0.0"
51775167
resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde"
@@ -5469,7 +5459,7 @@ [email protected]:
54695459
version "1.1.7"
54705460
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
54715461

5472-
resolve@^1.1.3, resolve@^1.1.6:
5462+
resolve@^1.1.3:
54735463
version "1.4.0"
54745464
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86"
54755465
dependencies:
@@ -5600,14 +5590,6 @@ shebang-regex@^1.0.0:
56005590
version "1.0.0"
56015591
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
56025592

5603-
shelljs@^0.8.1:
5604-
version "0.8.1"
5605-
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.1.tgz#729e038c413a2254c4078b95ed46e0397154a9f1"
5606-
dependencies:
5607-
glob "^7.0.0"
5608-
interpret "^1.0.0"
5609-
rechoir "^0.6.2"
5610-
56115593
shellwords@^0.1.1:
56125594
version "0.1.1"
56135595
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"

0 commit comments

Comments
 (0)