Gathering detailed insights and metrics for @poppinss/chokidar-ts
Gathering detailed insights and metrics for @poppinss/chokidar-ts
Gathering detailed insights and metrics for @poppinss/chokidar-ts
Gathering detailed insights and metrics for @poppinss/chokidar-ts
npm install @poppinss/chokidar-ts
Typescript
Module System
Min. Node Version
Node Version
NPM Version
95.3
Supply Chain
100
Quality
87.5
Maintenance
100
Vulnerability
99.6
License
Finally fix windows issues
Updated on May 29, 2025
Fix watcher to always watch project root
Updated on May 29, 2025
Update dependencies and internal cleanup
Updated on May 27, 2025
Fix watcher to work with chokidar 4
Updated on Apr 12, 2025
Update dependencies
Updated on Dec 28, 2024
Update dependencies
Updated on Mar 28, 2024
TypeScript (99.5%)
JavaScript (0.5%)
Total Downloads
3,133,127
Last Day
1,941
Last Week
32,108
Last Month
137,330
Last Year
1,305,528
MIT License
13 Stars
175 Commits
3 Forks
2 Watchers
1 Branches
5 Contributors
Updated on May 29, 2025
Minified
Minified + Gzipped
Latest Version
4.1.9
Package Id
@poppinss/chokidar-ts@4.1.9
Unpacked Size
18.42 kB
Size
5.88 kB
File Count
11
NPM Version
10.8.2
Node Version
20.19.1
Published on
May 29, 2025
Cumulative downloads
Total Downloads
Last Day
12.9%
1,941
Compared to previous day
Last Week
-8.9%
32,108
Compared to previous week
Last Month
4.4%
137,330
Compared to previous month
Last Year
67.6%
1,305,528
Compared to previous year
1
A thin wrapper on top of chokidar file watcher that relies on the
tsconfig.json
file to distinguish between the TypeScript source files and other files.
When running a Node.js backend development server with a file watcher, we need to know whether a newly added or changed file is part of our TypeScript project.
The best way to establish if a file is part of a TypeScript project is to rely on the tsconfig.json
file.
This is precisely what this package does. It will create a file watcher using chokidar and then uses the includes
and excludes
patterns from the tsconfig.json
file to know if a changed file is part of a TypeScript project.
Install the package from the npm packages registry. In addition, the package has a peer dependency on the typescript
package, so make sure to install that as well.
1npm i @poppinss/chokidar-ts
1yarn add @poppinss/chokidar-ts
1pnpm add @poppinss/chokidar-ts
And use it as follows.
1import typescript from 'typescript' 2import { ConfigParser, Watcher } from '@poppinss/chokidar-ts' 3 4const projectRoot = new URL('./', import.meta.url) 5const configFileName = 'tsconfig.json' 6 7const { config } = new ConfigParser( 8 projectRoot, 9 configFileName, 10 typescript, 11).parse() 12 13if (config) { 14 const watcher = new Watcher(projectRoot, config) 15 watcher.watch(['.']) 16}
The Watcher
class emits the following events. Events prefixed with source
refers to files included by the tsconfig.json
file, and other events refer to non-typescript or files excluded by the tsconfig.json
file.
add
: A new file has been added. The file is either not a TypeScript file or is excluded by the tsconfig.json
file.source:add
: A new TypeScript source file has been added.change
: An existing file has been updated. The file is either not a TypeScript file or is excluded by the tsconfig.json
file.source:change
: An existing TypeScript source file has been changed.unlink
: An existing file has been deleted. The file is not a TypeScript source file.source:unlink
: An existing TypeScript source file has been deleted.1const watcher = new Watcher(projectRoot, config) 2 3watcher.on('add', (file) => { 4 console.log(file.absPath) 5 console.log(file.relativePath) 6}) 7 8watcher.on('source:add', (file) => { 9 console.log(file.absPath) 10 console.log(file.relativePath) 11}) 12 13watcher.on('change', (file) => { 14 console.log(file.absPath) 15 console.log(file.relativePath) 16}) 17 18watcher.on('source:change', (file) => { 19 console.log(file.absPath) 20 console.log(file.relativePath) 21}) 22 23watcher.on('unlink', (file) => { 24 console.log(file.absPath) 25 console.log(file.relativePath) 26}) 27 28watcher.on('source:unlink', (file) => { 29 console.log(file.absPath) 30 console.log(file.relativePath) 31}) 32 33watcher.watch(['.'])
Parsing the tsconfig.json
file can produce errors, and you can display them using the TypeScript compiler as follows.
1import typescript from 'typescript' 2const { error, config } = new ConfigParser( 3 projectRoot, 4 configFileName, 5 typescript, 6).parse() 7 8if (error) { 9 const compilerHost = typescript.createCompilerHost({}) 10 console.log( 11 typescript.formatDiagnosticsWithColorAndContext([error], compilerHost) 12 ) 13 14 return 15} 16 17if (!config) { 18 return 19} 20 21if (config.errors) { 22 const compilerHost = typescript.createCompilerHost({}) 23 console.log( 24 typescript.formatDiagnosticsWithColorAndContext(config.errors, compilerHost) 25 ) 26 27 return 28}
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
13 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More