Skip to content

Commit 44d7609

Browse files
chore: modernize to v3.0.0 - TypeScript, Jest, ESLint, GitHub Actions
- Convert source to TypeScript (src/index.ts, src/lib.ts) - Replace Mocha/Should with Jest - Update ESLint for TypeScript (flat config) - Add GitHub Actions CI (Node 20, 22, 24) - Pin package versions - Separate tsconfig.build.json for dist output - Update README and remove Travis config Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d1fedf3 commit 44d7609

27 files changed

+10188
-511
lines changed

.eslintrc.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
node-version: ['20', '22', '24']
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Lint
30+
run: npm run lint
31+
32+
- name: Build
33+
run: npm run build
34+
35+
- name: Test
36+
run: npm test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
dist
3+
coverage

.travis.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# gulp-repl [![NPM version][b-version]][x-npm] [![downloads][badge-downloads]][x-npm]
22

3-
[![build][b-build]][x-travis]
3+
[![CI][b-build]][x-actions]
44

5-
Simple repl for gulp compatible with gulp#3.x and the future gulp#4.x.
5+
Simple REPL for gulp compatible with gulp 3.x and gulp 4.x.
66

77
### usage
88

@@ -22,7 +22,6 @@ gulp.task('repl-stop', function (cb) {
2222
cb();
2323
});
2424

25-
2625
gulp.task('foo', function (cb) {
2726
// do foo stuff
2827
cb();
@@ -42,11 +41,11 @@ Then, on your terminal write:
4241
gulp repl-start
4342
```
4443

45-
and you'll have a repl with:
44+
and you'll have a REPL with:
4645

4746
1. Press <kbd>Enter</kbd> to see the prompt
48-
1. write the tasks you want to run
49-
1. Press <kbd>Tab</kbd> for completion
47+
2. Write the tasks you want to run
48+
3. Press <kbd>Tab</kbd> for completion
5049

5150
```
5251
$ gulp
@@ -63,14 +62,12 @@ foo bar default
6362

6463
### API
6564

66-
The module exports a function
65+
The module exports an object with the following methods:
6766

6867
```js
6968
var repl = require('gulp-repl');
7069
```
7170

72-
with the following methods
73-
7471
#### repl.add
7572

7673
```js
@@ -101,7 +98,7 @@ Removes all of the previously added instances and _returns_ the module again.
10198
function get(Gulp gulp)
10299
```
103100

104-
Takes a `gulp` instance as argument
101+
Takes a `gulp` instance as argument.
105102

106103
_returns_
107104
- `null` if the `gulp` instance wasn't stored yet
@@ -114,7 +111,7 @@ _returns_
114111
function start(Gulp gulp)
115112
```
116113

117-
Takes a `gulp` instance as argument
114+
Takes a `gulp` instance as argument.
118115

119116
Adds the `gulp` instance tasks for the REPL.
120117

@@ -124,14 +121,23 @@ _returns_ a `readline.Interface` instance.
124121

125122
[See node's core module `readline` documentation about the `readline.Interface`](https://nodejs.org/api/readline.html).
126123

127-
128124
### install
129125

130126
```
131127
$ npm install --save-dev gulp-repl
132128
```
133129

134-
## Changelog
130+
### requirements
131+
132+
- Node.js >= 14.0.0
133+
134+
### Changelog
135+
136+
[v3.0.0][v3.0.0]:
137+
- Modernize codebase: TypeScript, Jest, ESLint
138+
- Add GitHub Actions CI (Node 20, 22, 24)
139+
- Pin package versions
140+
- Breaking: Output is now in `dist/`, requires build step before publish
135141

136142
[v2.0.1][v2.0.1]:
137143
- test: small fix to use `repl.start` instead of the `module.exports`
@@ -145,13 +151,11 @@ $ npm install --save-dev gulp-repl
145151
- dev: separate module into add, get, remove, reset and start
146152

147153
[v1.1.2][v1.1.2]:
148-
149154
- docs: add changelog
150155
- next_release: patch release
151156
- fix: `gulp.parallel` as task runner when `gulp.start` is undefined
152157

153158
[v1.1.1][v1.1.1]:
154-
155159
- fix: make the repl prompt after not found tasks
156160
- fix: line end matches
157161

@@ -172,14 +176,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
172176

173177
<!-- links -->
174178
[x-npm]: https://npmjs.com/gulp-repl
175-
[x-travis]: https://travis-ci.org/stringparser/gulp-repl/builds
179+
[x-actions]: https://github.com/stringparser/gulp-repl/actions
176180

177-
[b-build]: https://travis-ci.org/stringparser/gulp-repl.svg?branch=master
181+
[b-build]: https://github.com/stringparser/gulp-repl/actions/workflows/ci.yml/badge.svg
178182
[b-version]: http://img.shields.io/npm/v/gulp-repl.svg?style=flat-square
179183
[badge-downloads]: http://img.shields.io/npm/dm/gulp-repl.svg?style=flat-square
180184

185+
[v3.0.0]: https://github.com/stringparser/gulp-repl/releases/tag/v3.0.0
181186
[v2.0.1]: https://github.com/stringparser/gulp-repl/commit/4420f55db8f9a4887e5a8bd82976a8930e12fb50
182-
183187
[v2.0.0]: https://github.com/stringparser/gulp-repl/commit/be44875927a42d8f08dcafa7984db0bfc423e0a3
184188
[v1.1.2]: https://github.com/stringparser/gulp-repl/commit/572df8ce7cd9d4edd3a2190de021381671a295f0
185189
[v1.1.1]: https://github.com/stringparser/gulp-repl/commit/6f4655ca1a667ca04d2a668a175055f9b4437d65

eslint.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import js from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
4+
export default tseslint.config(
5+
js.configs.recommended,
6+
...tseslint.configs.recommended,
7+
{
8+
languageOptions: {
9+
parserOptions: {
10+
ecmaVersion: 2020,
11+
sourceType: 'module',
12+
},
13+
},
14+
rules: {
15+
'@typescript-eslint/no-require-imports': 'off',
16+
},
17+
}
18+
);

gulpfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

3-
var gulp = require('gulp');
4-
gulp.repl = require('./.')(gulp);
3+
const gulp = require('gulp');
4+
gulp.repl = require('./dist').start(gulp);
55

66
gulp.task('foo', function (cb) {
77
setTimeout(cb, Math.random() * 1000);

index.js

Lines changed: 0 additions & 113 deletions
This file was deleted.

jest.config.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/** @type {import('jest').Config} */
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
5+
roots: ['<rootDir>/test'],
6+
testMatch: ['**/*.test.ts'],
7+
collectCoverageFrom: ['src/**/*.ts', '!src/**/*.d.ts'],
8+
moduleFileExtensions: ['ts', 'js', 'json'],
9+
verbose: true,
10+
transform: {
11+
'^.+\\.ts$': [
12+
'ts-jest',
13+
{
14+
tsconfig: {
15+
types: ['jest', 'node'],
16+
},
17+
},
18+
],
19+
},
20+
};

0 commit comments

Comments
 (0)