Skip to content

Commit 75bb207

Browse files
committed
Update README.md
1 parent a6de62b commit 75bb207

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

README.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,38 @@ Simple REPL for gulp.
88

99
```ts
1010
// gulpfile.ts
11-
import gulp from 'gulp';
11+
import gulp, { type TaskFunction } from 'gulp';
1212
import repl from 'gulp-repl';
1313

14-
gulp.task('repl-start', (cb) => {
15-
gulp.repl = repl.start(gulp);
16-
cb();
17-
});
14+
const gulpWithRepl = gulp as typeof gulp & { repl?: ReturnType<typeof repl.start> };
1815

19-
gulp.task('repl-stop', (cb) => {
20-
if (gulp.repl) {
21-
gulp.repl.close(); // same as nodejs.org/api/readline.html#readline_rl_close
16+
const replStart: TaskFunction = (done) => {
17+
gulpWithRepl.repl = repl.start(gulp);
18+
done();
19+
};
20+
21+
const replStop: TaskFunction = (done) => {
22+
if (gulpWithRepl.repl) {
23+
gulpWithRepl.repl.close(); // same as nodejs.org/api/readline.html#readline_rl_close
2224
}
23-
cb();
24-
});
25+
done();
26+
};
2527

26-
gulp.task('foo', (cb) => {
28+
const foo: TaskFunction = (done) => {
2729
// do foo stuff
28-
cb();
29-
});
30+
done();
31+
};
3032

31-
gulp.task('bar', (cb) => {
33+
const bar: TaskFunction = (done) => {
3234
// do bar stuff
33-
cb();
34-
});
35-
36-
gulp.task('default', gulp.series('foo', 'bar'));
35+
done();
36+
};
37+
38+
exports['repl-start'] = replStart;
39+
exports['repl-stop'] = replStop;
40+
exports.foo = foo;
41+
exports.bar = bar;
42+
exports.default = gulp.series('foo', 'bar');
3743
```
3844

3945
> **Note:** For `gulpfile.ts`, ensure `ts-node` or `tsx` is available. Use `gulpfile.js` with `require()` if you prefer plain JavaScript.
@@ -132,7 +138,7 @@ $ npm install --save-dev gulp-repl
132138

133139
### requirements
134140

135-
- Node.js >= 14.0.0
141+
- Node.js >= 20.0.0
136142

137143
### Changelog
138144

0 commit comments

Comments
 (0)