Skip to content

Commit 22b0c2b

Browse files
committed
feat: update chokidar to v4
1 parent f4c4d3c commit 22b0c2b

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

template/base/package.json.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"babel-plugin-autocomplete-index": "^0.2.0",
5656
"babel-plugin-module-resolver": "^5.0.2",
5757
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
58-
"chokidar": "^3.6.0",
58+
"chokidar": "^4.0.1",
5959
"cross-env": "^7.0.3",
6060
<%_ if (needsEslint) { _%>
6161
"eslint": "^9.13.0",

template/javascript/build.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,9 @@ async function buildComponentLibrary(name) {
126126
};
127127

128128
const watcher = chokidar.watch([destination], {
129-
ignored: ['**/.{gitkeep,DS_Store}'],
129+
ignored: (path, stats) => stats?.isFile() && !path.endsWith('.js'),
130130
});
131131
watcher.on('add', (filePath) => {
132-
if (!filePath.endsWith('.js')) return;
133132
const promise = tnm(filePath);
134133
jobs.push(promise);
135134
});
@@ -251,7 +250,9 @@ async function dev() {
251250
await scanDependencies();
252251
chokidar
253252
.watch(['src'], {
254-
ignored: ['**/.{gitkeep,DS_Store}'],
253+
ignored: (path, stats) =>
254+
stats?.isFile() &&
255+
(path.endsWith('.gitkeep') || path.endsWith('.DS_Store')),
255256
})
256257
.on('add', (filePath) => {
257258
const promise = cb(filePath);
@@ -275,7 +276,9 @@ async function prod() {
275276
await fs.remove('dist');
276277
await scanDependencies();
277278
const watcher = chokidar.watch(['src'], {
278-
ignored: ['**/.{gitkeep,DS_Store}'],
279+
ignored: (path, stats) =>
280+
stats?.isFile() &&
281+
(path.endsWith('.gitkeep') || path.endsWith('.DS_Store')),
279282
});
280283
watcher.on('add', (filePath) => {
281284
const promise = cb(filePath);

template/typescript/build.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,9 @@ async function buildComponentLibrary(name) {
126126
};
127127

128128
const watcher = chokidar.watch([destination], {
129-
ignored: ['**/.{gitkeep,DS_Store}'],
129+
ignored: (path, stats) => stats?.isFile() && !path.endsWith('.js'),
130130
});
131131
watcher.on('add', (filePath) => {
132-
if (!filePath.endsWith('.js')) return;
133132
const promise = tnm(filePath);
134133
jobs.push(promise);
135134
});
@@ -251,7 +250,9 @@ async function dev() {
251250
await scanDependencies();
252251
chokidar
253252
.watch(['src'], {
254-
ignored: ['**/.{gitkeep,DS_Store}'],
253+
ignored: (path, stats) =>
254+
stats?.isFile() &&
255+
(path.endsWith('.gitkeep') || path.endsWith('.DS_Store')),
255256
})
256257
.on('add', (filePath) => {
257258
const promise = cb(filePath);
@@ -275,7 +276,9 @@ async function prod() {
275276
await fs.remove('dist');
276277
await scanDependencies();
277278
const watcher = chokidar.watch(['src'], {
278-
ignored: ['**/.{gitkeep,DS_Store}'],
279+
ignored: (path, stats) =>
280+
stats?.isFile() &&
281+
(path.endsWith('.gitkeep') || path.endsWith('.DS_Store')),
279282
});
280283
watcher.on('add', (filePath) => {
281284
const promise = cb(filePath);

0 commit comments

Comments
 (0)