Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4: Typescript, ESM, glob removal, drop node <18 #1195

Merged
merged 47 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
83853fd
Bump node.js requirement to v14
paulmillr Jan 18, 2022
8800112
Rewrite in typescript
paulmillr Jan 18, 2022
abe7809
prettier
paulmillr Jan 18, 2022
cac97c6
Remove glob support
paulmillr Jan 18, 2022
49d5958
Drop node <14 from CI
paulmillr Jan 18, 2022
46e8570
Lint on node 16
paulmillr Jan 18, 2022
fbc7324
Bump deps
paulmillr Jan 18, 2022
28908d3
Update to gh version of readdirp
paulmillr Jan 18, 2022
1aa80ac
Fix gh action
paulmillr Jan 18, 2022
f4eb8e2
Use ESM.
paulmillr Jan 18, 2022
22a5ec9
Fix tests
paulmillr Jan 18, 2022
585d968
test: fix up async bug in test setup
43081j Feb 5, 2024
aaa08be
test: revert close test and fix race condition
43081j Feb 6, 2024
44aab1b
test: fix dynamic import path of chokidar
43081j Feb 6, 2024
8cc1e66
test: revert close test
43081j Feb 6, 2024
4c98a6b
feat: rework anymatch and fix ignored paths
43081j Feb 6, 2024
e2bced6
chore: introduce tseslint and fix lint script
43081j Feb 6, 2024
9ba9ac5
feat: rework ignore matcher add/remove & add types
43081j Feb 7, 2024
cf5e73b
fix: revert default interval
43081j Feb 9, 2024
9d16426
fix: mac OS inodes change just like linux
43081j Feb 9, 2024
a01bbdd
chore: bump node CI versions
43081j Feb 9, 2024
5523179
chore: run build in CI
43081j Mar 19, 2024
3caba37
feat: re-enable fsevents conditional
43081j Mar 19, 2024
57c0cfd
fix: add fsevents types
43081j Mar 19, 2024
d4bc683
feat: use latest typescript
43081j Mar 19, 2024
a178985
Merge branch 'master' into v4-jg
43081j Mar 23, 2024
9a93273
chore: drop dtslint for now
43081j Mar 23, 2024
cd168d6
fix: use file urls for chokidar import
43081j Mar 23, 2024
0101e20
feat: strongly type some watch calls
43081j Mar 23, 2024
b8fdee2
test: try use fix fs delays
43081j Mar 24, 2024
7e8c742
feat: drop fsevents for macos
43081j Mar 25, 2024
928a755
test: fix symlinks on windows during testing
43081j Mar 26, 2024
75eb523
test: wait for each write to trigger an event
43081j Mar 27, 2024
6c20448
chore: add node 21 to CI
43081j Mar 27, 2024
eafeb45
test: wait for watcher in before
43081j May 18, 2024
f963c0b
chore: bump node versions in engine constraint
43081j May 20, 2024
cdfd50e
Merge pull request #1304 from 43081j/v4-jg
paulmillr May 23, 2024
ae0232b
Remove nyc, regen lockfile. Remove unused consts
paulmillr May 23, 2024
b879371
test: switch to node test runner
43081j May 25, 2024
dda8034
test: delay after initial add
43081j Jun 2, 2024
abc4688
Merge pull request #1318 from 43081j/v4-test-runner
paulmillr Jun 2, 2024
430d643
chore: upgrade to flat eslint configs
43081j May 25, 2024
bd3c8a0
Merge pull request #1320 from 43081j/v4-eslint
paulmillr Jun 2, 2024
9594771
feat: move to node:fs/promises
43081j Jun 25, 2024
c8c3ff2
Merge pull request #1329 from 43081j/async-fs
paulmillr Jun 28, 2024
d9f30a5
Stale issue
paulmillr Jul 1, 2024
6f715a9
Stale issue 2
paulmillr Jul 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions .eslintrc

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,3 @@ jobs:

- name: Run lint
run: npm run lint

- name: Run dtslint
run: npm run dtslint
21 changes: 6 additions & 15 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,21 @@ env:

jobs:
test:
name: Node.js ${{ matrix.node }} @ ${{ matrix.os }}
name: Node.js ${{ matrix.version }} @ ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node: [8, 10, 12, 14, 16]
os: [ubuntu-latest]
include:
- os: windows-latest
node: 8
- os: windows-latest
node: 14
- os: macOS-latest
node: 8
- os: macOS-latest
node: 14
version: [18, 20, 22]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: npm install
- name: Run mocha tests
run: npm run mocha
run: npm run test
22 changes: 22 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9
with:
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/node_modules/
/test-fixtures/
/package-lock.json
/lib
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ chokidar.watch('.').on('all', (event, path) => {
// Example of a more typical implementation structure

// Initialize watcher.
const watcher = chokidar.watch('file, dir, glob, or array', {
const watcher = chokidar.watch('file, dir, or array', {
ignored: /(^|[\/\\])\../, // ignore dotfiles
persistent: true
});
Expand Down Expand Up @@ -130,7 +130,6 @@ chokidar.watch('file', {
ignoreInitial: false,
followSymlinks: true,
cwd: '.',
disableGlobbing: false,

usePolling: false,
interval: 100,
Expand All @@ -151,12 +150,7 @@ chokidar.watch('file', {
`chokidar.watch(paths, [options])`

* `paths` (string or array of strings). Paths to files, dirs to be watched
recursively, or glob patterns.
- Note: globs must not contain windows separators (`\`),
because that's how they work by the standard —
you'll need to replace them with forward slashes (`/`).
- Note 2: for additional glob documentation, check out low-level
library: [picomatch](https://github.com/micromatch/picomatch).
recursively.
* `options` (object) Options object as defined below:

#### Persistence
Expand All @@ -182,8 +176,6 @@ symlinks themselves will be watched for changes instead of following
the link references and bubbling events through the link's path.
* `cwd` (no default). The base directory from which watch `paths` are to be
derived. Paths emitted with events will be relative to this.
* `disableGlobbing` (default: `false`). If set to `true` then the strings passed to `.watch()` and `.add()` are treated as
literal path names, even if they look like globs.

#### Performance

Expand Down Expand Up @@ -247,14 +239,14 @@ milliseconds.

`chokidar.watch()` produces an instance of `FSWatcher`. Methods of `FSWatcher`:

* `.add(path / paths)`: Add files, directories, or glob patterns for tracking.
* `.add(path / paths)`: Add files, directories for tracking.
Takes an array of strings or just one string.
* `.on(event, callback)`: Listen for an FS event.
Available events: `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `ready`,
`raw`, `error`.
Additionally `all` is available which gets emitted with the underlying event
name and path for every event other than `ready`, `raw`, and `error`. `raw` is internal, use it carefully.
* `.unwatch(path / paths)`: Stop watching files, directories, or glob patterns.
* `.unwatch(path / paths)`: Stop watching files or directories.
Takes an array of strings or just one string.
* `.close()`: **async** Removes all listeners from watched files. Asynchronous, returns Promise. Use with `await` to ensure bugs don't happen.
* `.getWatched()`: Returns an object representing all the paths on the file
Expand Down
34 changes: 34 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import eslintjs from '@eslint/js';
import globals from 'globals';
import {configs as tseslintConfigs} from 'typescript-eslint';

const {configs: eslintConfigs} = eslintjs;
const files = ['test.mjs', 'src/**/*.ts'];

export default [
{
files,
linterOptions: {
reportUnusedDisableDirectives: 'error'
},
languageOptions: {
globals: {
...globals.node
}
}
},
{
...eslintConfigs.recommended,
files
},
...tseslintConfigs.strict.map((config) => ({
...config,
files
})),
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-dynamic-delete': 'off'
}
}
];
Loading
Loading