Skip to content

Commit 11001e8

Browse files
committed
chore: rename useWatchDirectory to useFileSystem
1 parent 5b5461b commit 11001e8

File tree

6 files changed

+10
-15
lines changed

6 files changed

+10
-15
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ pnpm add use-file-system
2424

2525
```tsx
2626
import React from 'react';
27-
import { commonFilters, useWatchDirectory } from 'use-file-system';
27+
import { commonFilters, useFileSystem } from 'use-file-system';
2828

2929
export const Example = () => {
30-
const { onDirectorySelection, files } = useWatchDirectory({
30+
const { onDirectorySelection, files } = useFileSystem({
3131
filters: commonFilters, // filters out .gitignore paths and output paths like node_modules or dist, etc
3232
onFilesAdded: (newFiles, previousFiles) => {
3333
console.log('onFilesAdded', newFiles, previousFiles);
@@ -93,7 +93,7 @@ export const Example = () => {
9393
- [distFilter](#gear-distfilter)
9494
- [miscFilter](#gear-miscfilter)
9595
- [processDirectory](#gear-processdirectory)
96-
- [useWatchDirectory](#gear-usewatchdirectory)
96+
- [useFileSystem](#gear-usefilesystem)
9797

9898
### :gear: gitFilter
9999

@@ -119,11 +119,11 @@ export const Example = () => {
119119
| ---------- | ---------- |
120120
| `processDirectory` | `(directoryHandle: FileSystemDirectoryHandle, directoryPath: string, filters: Filter[], includeFiles: Map<string, FileSystemFileHandle>, ignoreFilePaths: Set<...>) => Promise<...>` |
121121

122-
### :gear: useWatchDirectory
122+
### :gear: useFileSystem
123123

124124
| Function | Type |
125125
| ---------- | ---------- |
126-
| `useWatchDirectory` | `(props: UseFileHandlingHookProps) => { handles: Map<string, FileSystemFileHandle>; onDirectorySelection: () => Promise<void>; files: Map<...>; isProcessing: boolean; }` |
126+
| `useFileSystem` | `(props: UseFileHandlingHookProps) => { handles: Map<string, FileSystemFileHandle>; onDirectorySelection: () => Promise<void>; files: Map<...>; isProcessing: boolean; }` |
127127

128128

129129
## :wrench: Constants

src/filters.ts

-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ export const distFilter: FilterFn = async () => {
7676
if (filepath.includes(`/node_modules/`)) {
7777
return true;
7878
}
79-
if (filepath.includes(`/node_modules/`)) {
80-
return true;
81-
}
8279
if (filepath.includes(`/.next/`)) {
8380
return true;
8481
}

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export * from './filters';
22
export * from './processDirectory';
3-
export * from './useWatchDirectory';
3+
export * from './useFileSystem';

src/stories/Example.stories.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,4 @@ const Template: StoryFn<typeof Example> = () => <Example />;
1212

1313
export const Primary = Template.bind({});
1414

15-
Primary.args = {
16-
text: 'Clicked this many times:',
17-
};
15+
Primary.args = {};

src/stories/Example.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
22
import { action } from '@storybook/addon-actions';
3-
import { commonFilters, useWatchDirectory } from '..';
3+
import { commonFilters, useFileSystem } from '..';
44

55
export const Example = () => {
6-
const { onDirectorySelection, files } = useWatchDirectory({
6+
const { onDirectorySelection, files } = useFileSystem({
77
filters: commonFilters,
88
onFilesAdded: (newFiles, previousFiles) => {
99
console.log('onFilesAdded', newFiles, previousFiles);

src/useWatchDirectory.tsx src/useFileSystem.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export interface UseFileHandlingHookProps {
3030

3131
const DEFAULT_POLL_INTERVAL = 500;
3232

33-
export const useWatchDirectory = (props: UseFileHandlingHookProps) => {
33+
export const useFileSystem = (props: UseFileHandlingHookProps) => {
3434
const {
3535
onFilesAdded: onAddFile,
3636
onFilesChanged: onChangeFile,

0 commit comments

Comments
 (0)