From 5cd66736ccd24fe7cd0a8e6f343d72792437a366 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 15 Dec 2025 14:30:03 +0100 Subject: [PATCH] chore: prepare v3.0.0 Signed-off-by: Ferdinand Thiessen --- CHANGELOG.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ README.md | 3 +++ package.json | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5080419..650e046 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,51 @@ All notable changes to this project will be documented in this file. +## 3.0.0 - 2025-12-16 +### Breaking changes +- This package now does only provide an ES module, the CJS entry point is removed. +- The behavior of `basename` and `dirname` was fixed to behave similar + to the methods from the Node.js `paths` module and the PHP methods. + This mainly affects special cases: + - trailing slash on `basename` is ignored + ```diff + basename('subdir/') + - "" + + "subdir" + ``` + - `dirname` always respects the root path: + ```diff + dirname('/') + - "" + + "/" + ``` + ```diff + dirname('') + - "" + + "." + ``` + ```diff + dirname('/file') + - "" + + "/" + ``` + ```diff + dirname('file') + - "" + + "." + ``` + +### Added +* feat(basename): add support for removing an extension \([#843](https://github.com/nextcloud-libraries/nextcloud-paths/pull/843)\) + +### Fixed +* fix!: make `dirname` and `basename` behave like PHP and Node \([#839](https://github.com/nextcloud-libraries/nextcloud-paths/pull/839)\) + +### Changed +* chore!: drop commonJs entry points +* chore!: remove deprecated `joinPaths` in favor of `join` +* test: add unit tests for `encodePath` + ## 2.4.0 - 2025-11-14 ### Added * feat: add `extname` method diff --git a/README.md b/README.md index 6efc9fd..669a866 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,9 @@ import { basename, dirname, extname, encodePath, isSamePath, join } from '@nextc basename('/my/file.txt') // -> 'file.txt' +basename('/my/file.txt', '.txt') +// -> 'file' + dirname('/my/file.txt') // -> '/my' diff --git a/package.json b/package.json index 74e16cc..bd0e96c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nextcloud/paths", - "version": "2.4.0", + "version": "3.0.0", "description": "Helper functions for working with paths in Nextcloud apps", "keywords": [ "nextcloud",