Skip to content

Commit 296b101

Browse files
viceicegkalpak
andauthored
🤖 Merge PR DefinitelyTyped#74110 feat(shelljs): update types to match latest version by @viceice
Co-authored-by: George Kalpakas <[email protected]>
1 parent bd9ba4a commit 296b101

File tree

7 files changed

+69
-40
lines changed

7 files changed

+69
-40
lines changed

‎types/shelljs/global.d.ts‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import shelljs = require("./index");
2+
3+
declare global {
4+
const cat: typeof shelljs.cat;
5+
const cd: typeof shelljs.cd;
6+
const chmod: typeof shelljs.chmod;
7+
const cmd: typeof shelljs.cmd;
8+
const config: typeof shelljs.config;
9+
const cp: typeof shelljs.cp;
10+
const dirs: typeof shelljs.dirs;
11+
const echo: typeof shelljs.echo;
12+
const env: typeof shelljs.env;
13+
const error: typeof shelljs.error;
14+
const exec: typeof shelljs.exec;
15+
const exit: typeof shelljs.exit;
16+
const find: typeof shelljs.find;
17+
const grep: typeof shelljs.grep;
18+
const head: typeof shelljs.head;
19+
const ln: typeof shelljs.ln;
20+
const ls: typeof shelljs.ls;
21+
const mkdir: typeof shelljs.mkdir;
22+
const mv: typeof shelljs.mv;
23+
const popd: typeof shelljs.popd;
24+
const pushd: typeof shelljs.pushd;
25+
const pwd: typeof shelljs.pwd;
26+
const rm: typeof shelljs.rm;
27+
const sed: typeof shelljs.sed;
28+
const set: typeof shelljs.set;
29+
const sort: typeof shelljs.sort;
30+
const tail: typeof shelljs.tail;
31+
const tempdir: typeof shelljs.tempdir;
32+
const touch: typeof shelljs.touch;
33+
const uniq: typeof shelljs.uniq;
34+
const ShellString: typeof shelljs.ShellString;
35+
}

‎types/shelljs/index.d.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference types="node"/>
22

33
import child = require("child_process");
4-
import glob = require("glob");
4+
import glob = require("fast-glob");
55

66
/**
77
* Changes the current working directory dir for the duration of the script.
@@ -1240,7 +1240,7 @@ export interface ShellConfig {
12401240
/**
12411241
* Passed to glob.sync() instead of the default options ({}).
12421242
*/
1243-
globOptions: glob.GlobOptions;
1243+
globOptions: glob.Options;
12441244

12451245
/**
12461246
* Absolute path of the Node binary. Default is null (inferred).

‎types/shelljs/make.d.ts‎

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import shelljs = require("./index");
1+
import "./global";
2+
23
declare global {
34
interface Target {
45
(...args: any[]): void;
@@ -7,38 +8,6 @@ declare global {
78
}
89
const target: {
910
all?: Target;
10-
[s: string]: Target;
11+
[s: string]: Target | undefined;
1112
};
12-
13-
const cat: typeof shelljs.cat;
14-
const cd: typeof shelljs.cd;
15-
const chmod: typeof shelljs.chmod;
16-
const cmd: typeof shelljs.cmd;
17-
const config: typeof shelljs.config;
18-
const cp: typeof shelljs.cp;
19-
const dirs: typeof shelljs.dirs;
20-
const echo: typeof shelljs.echo;
21-
const env: typeof shelljs.env;
22-
const error: typeof shelljs.error;
23-
const exec: typeof shelljs.exec;
24-
const exit: typeof shelljs.exit;
25-
const find: typeof shelljs.find;
26-
const grep: typeof shelljs.grep;
27-
const head: typeof shelljs.head;
28-
const ln: typeof shelljs.ln;
29-
const ls: typeof shelljs.ls;
30-
const mkdir: typeof shelljs.mkdir;
31-
const mv: typeof shelljs.mv;
32-
const popd: typeof shelljs.popd;
33-
const pushd: typeof shelljs.pushd;
34-
const pwd: typeof shelljs.pwd;
35-
const rm: typeof shelljs.rm;
36-
const sed: typeof shelljs.sed;
37-
const set: typeof shelljs.set;
38-
const sort: typeof shelljs.sort;
39-
const tail: typeof shelljs.tail;
40-
const tempdir: typeof shelljs.tempdir;
41-
const touch: typeof shelljs.touch;
42-
const uniq: typeof shelljs.uniq;
43-
const ShellString: typeof shelljs.ShellString;
4413
}

‎types/shelljs/package.json‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
{
22
"private": true,
33
"name": "@types/shelljs",
4-
"version": "0.8.9999",
4+
"version": "0.10.9999",
55
"projects": [
66
"http://shelljs.org",
77
"https://github.com/shelljs/shelljs"
88
],
9+
"exports": {
10+
".": "./index.d.ts",
11+
"./global": "./global.d.ts",
12+
"./global.js": "./global.d.ts",
13+
"./make": "./make.d.ts",
14+
"./make.js": "./make.d.ts",
15+
"./package": "./package.json",
16+
"./package.json": "./package.json",
17+
"./plugin": "./plugin.d.ts",
18+
"./plugin.js": "./plugin.d.ts"
19+
},
920
"dependencies": {
10-
"glob": "^11.0.3",
21+
"fast-glob": "^3.3.2",
1122
"@types/node": "*"
1223
},
1324
"devDependencies": {

‎types/shelljs/plugin.d.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// TODO: proper typing
2+
// https://github.com/shelljs/shelljs/wiki/Using-ShellJS-Plugins#pluginregister-options
3+
export function register(...args: unknown[]): void;

‎types/shelljs/shelljs-tests.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ shell.chmod("u+x", "/Users/brandon");
148148
shell.chmod("-cR", 755, "/Users/brandon");
149149
shell.chmod("-Rv", "u+x", "/Users/brandon");
150150

151-
shell.exit(0);
152-
153151
shell.touch("/Users/brandom/test1");
154152
shell.touch("/Users/brandom/test1", "/Users/brandom/test2");
155153

@@ -206,3 +204,13 @@ const farr = new shell.ShellString(["hello", "world"]);
206204

207205
const boo = shell.ShellString("hello world");
208206
const barr = shell.ShellString(["hello", "world"]);
207+
208+
require("shelljs/make");
209+
210+
// global works
211+
cp("some/path", "/tmp/dst/");
212+
target.all = () => {
213+
ln("-sf", "some/path", "/tmp/dst");
214+
};
215+
216+
shell.exit(0);

‎types/shelljs/tsconfig.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
},
1515
"files": [
1616
"index.d.ts",
17+
"global.d.ts",
18+
"make.d.ts",
19+
"plugin.d.ts",
1720
"shelljs-tests.ts"
1821
]
1922
}

0 commit comments

Comments
 (0)