Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c73a931dad | |||
| 3bdb014d25 | |||
| 5577e4e4de | |||
| 6308e198c7 | |||
| 381680f2e7 | |||
| c9e45a9abe |
21
changelog.md
21
changelog.md
@@ -1,5 +1,26 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-11-30 - 1.1.3 - fix(smartfs.provider.node)
|
||||||
|
Default createDirectory to recursive=true when option not provided in Node provider
|
||||||
|
|
||||||
|
- Node provider: createDirectory now defaults to recursive=true when options.recursive is undefined.
|
||||||
|
- Prevents errors when creating nested directories without explicitly passing the recursive option.
|
||||||
|
- No API signature changes; behavior change is limited to the Node provider implementation.
|
||||||
|
|
||||||
|
## 2025-11-29 - 1.1.2 - fix(SmartFsProviderNode)
|
||||||
|
Fix Node provider watch path handling and remove main test entry
|
||||||
|
|
||||||
|
- Node provider: detect at start whether the watched path is a file or directory (fs.stat) and build fullPath accordingly so watching a single file does not incorrectly join the filename onto the file path.
|
||||||
|
- Watch callback: ensure events are evaluated against the configured filter using the correct full path.
|
||||||
|
- Tests: removed test/test.ts (main test entry that previously imported provider test files).
|
||||||
|
|
||||||
|
## 2025-11-29 - 1.1.1 - fix(smartfs.provider.node)
|
||||||
|
Default deleteDirectory to recursive=true in Node provider
|
||||||
|
|
||||||
|
- Changed SmartFsProviderNode.deleteDirectory to use recursive: options?.recursive ?? true when calling fs.rm.
|
||||||
|
- Directories will now be removed recursively by default when no recursive option is provided (was previously undefined).
|
||||||
|
- Retains force: true behavior to ignore missing targets and suppress errors.
|
||||||
|
|
||||||
## 2025-11-21 - 1.1.0 - feat(core)
|
## 2025-11-21 - 1.1.0 - feat(core)
|
||||||
Add SmartFS core library with providers, builders, interfaces, docs, tests and CI
|
Add SmartFS core library with providers, builders, interfaces, docs, tests and CI
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartfs",
|
"name": "@push.rocks/smartfs",
|
||||||
"version": "1.1.0",
|
"version": "1.1.3",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a cross platform extendable fs module",
|
"description": "a cross platform extendable fs module",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
/**
|
|
||||||
* Main test entry point
|
|
||||||
* Imports all test files
|
|
||||||
*/
|
|
||||||
|
|
||||||
import './test.memory.provider.js';
|
|
||||||
import './test.node.provider.js';
|
|
||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartfs',
|
name: '@push.rocks/smartfs',
|
||||||
version: '1.1.0',
|
version: '1.1.3',
|
||||||
description: 'a cross platform extendable fs module'
|
description: 'a cross platform extendable fs module'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,14 +237,14 @@ export class SmartFsProviderNode implements ISmartFsProvider {
|
|||||||
|
|
||||||
public async createDirectory(path: string, options?: { recursive?: boolean; mode?: number }): Promise<void> {
|
public async createDirectory(path: string, options?: { recursive?: boolean; mode?: number }): Promise<void> {
|
||||||
await fs.mkdir(path, {
|
await fs.mkdir(path, {
|
||||||
recursive: options?.recursive,
|
recursive: options?.recursive ?? true,
|
||||||
mode: options?.mode,
|
mode: options?.mode,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async deleteDirectory(path: string, options?: { recursive?: boolean }): Promise<void> {
|
public async deleteDirectory(path: string, options?: { recursive?: boolean }): Promise<void> {
|
||||||
await fs.rm(path, {
|
await fs.rm(path, {
|
||||||
recursive: options?.recursive,
|
recursive: options?.recursive ?? true,
|
||||||
force: true,
|
force: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -266,6 +266,10 @@ export class SmartFsProviderNode implements ISmartFsProvider {
|
|||||||
// --- Watch Operations ---
|
// --- Watch Operations ---
|
||||||
|
|
||||||
public async watch(path: string, callback: TWatchCallback, options?: IWatchOptions): Promise<IWatcherHandle> {
|
public async watch(path: string, callback: TWatchCallback, options?: IWatchOptions): Promise<IWatcherHandle> {
|
||||||
|
// Check once at start if we're watching a file or directory
|
||||||
|
const watchedStats = await fs.stat(path);
|
||||||
|
const isWatchingFile = watchedStats.isFile();
|
||||||
|
|
||||||
const watcher = fsSync.watch(
|
const watcher = fsSync.watch(
|
||||||
path,
|
path,
|
||||||
{
|
{
|
||||||
@@ -274,7 +278,8 @@ export class SmartFsProviderNode implements ISmartFsProvider {
|
|||||||
async (eventType, filename) => {
|
async (eventType, filename) => {
|
||||||
if (!filename) return;
|
if (!filename) return;
|
||||||
|
|
||||||
const fullPath = pathModule.join(path, filename);
|
// For file watching, path IS the file; for directory, join with filename
|
||||||
|
const fullPath = isWatchingFile ? path : pathModule.join(path, filename);
|
||||||
|
|
||||||
// Apply filter
|
// Apply filter
|
||||||
if (options?.filter && !this.matchesPathFilter(fullPath, options.filter)) {
|
if (options?.filter && !this.matchesPathFilter(fullPath, options.filter)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user