Skip to content

Commit

Permalink
v1.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
shuritch committed Mar 19, 2024
1 parent e6076fc commit 8c1fa6d
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 19 deletions.
10 changes: 9 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
<!--
Thank you for your pull request.
Check following steps to help us land your changes:
Change [ ] to [x] for completed items.
- Fill current date
- Create list with pull request changes / or describe purpose of pull request
- Change [ ] to [x] for completed items.
-->

## Changes - 202x-xx-xx

- Added ...
- Updated ...
- Deleted ...

- [ ] tests and linter show no problems (`npm t`)
- [ ] tests are added/updated for bug fixes and new features
- [ ] code is properly formatted (`npm run fmt`)
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## [Unreleased][unreleased]

## [1.8.1][] - 2024-03-19

- Eslint bug fix
- Pull request template update
- Readme warning update
- Version fix

## [1.8.0][] - 2024-03-18

- Return of macos & windows CI versions
Expand Down Expand Up @@ -68,7 +75,8 @@
- New Tests
- JSDoc

[unreleased]: https://github.com/astrohelm/filesnitch/compare/v1.8.0...HEAD
[unreleased]: https://github.com/astrohelm/filesnitch/compare/v1.8.1...HEAD
[1.8.1]: https://github.com/astrohelm/filesnitch/compare/v1.8.0...v1.8.1
[1.8.0]: https://github.com/astrohelm/filesnitch/compare/v1.7.0...v1.8.0
[1.7.0]: https://github.com/astrohelm/filesnitch/compare/v1.6.0...v1.7.0
[1.6.0]: https://github.com/astrohelm/filesnitch/compare/v1.5.0...v1.6.0
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
Deduplicate events with debounce <br/>
</p>

> [!WARNING]
>
> Macos can emit directory events if nested files were removed / added. This behavior can be
> different on each OS. As for Linux ecosystem, in most distributions - we missing this behavior.
<h2 align="center">Installation</h2>

```bash
Expand Down
12 changes: 6 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ const READ_OPTS = { withFileTypes: true };

const access = (list, v) => !list.some(ignore => new RegExp(ignore).test(v));

function setWatcher(path, watchers, err, stats) {
function Watcher(path, watchers, err, stats) {
if (err || watchers.has(path)) return;
watchers.set(path, watch(path, listen.bind(this, path)));
watchers.set(path, watch(path, Listen.bind(this, path)));
if (!stats.isDirectory() || !this.options.deep) return;
readdir(path, READ_OPTS, (err, files) => {
!err && files.forEach(f => void (f.isDirectory() && this.watch(join(path, f.name))));
});
}

function listen(path, _, filename) {
function Listen(path, _, filename) {
const target = path.endsWith(sep + filename) ? path : join(path, filename);
if (!access(this.options.ignore, target)) return;
stat(target, submit.bind(this, target));
stat(target, Submit.bind(this, target));
}

function submit(target, err, stats) {
function Submit(target, err, stats) {
const { deep, home } = this.options;
const parsed = home ? target.replace(home, '') : target;
if (err) return void (this.unwatch(target), this.emit('unlink', parsed));
Expand All @@ -32,4 +32,4 @@ function submit(target, err, stats) {
});
}

module.exports = { Scheduler: require('./scheduler'), access, setWatcher };
module.exports = { Scheduler: require('./scheduler'), access, setWatcher: Watcher };
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"license": "MIT",
"version": "1.7.0",
"version": "1.8.1",
"type": "commonjs",
"name": "filesnitch",
"homepage": "https://astrohelm.ru",
Expand Down Expand Up @@ -39,9 +39,9 @@
},

"devDependencies": {
"@types/node": "^20.11.28",
"@types/node": "^20.11.30",
"eslint": "^8.57.0",
"eslint-config-astrohelm": "^1.3.0",
"eslint-config-astrohelm": "^1.4.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
Expand Down

0 comments on commit 8c1fa6d

Please sign in to comment.