From da1f19a98a60e99750930db322b451f4e1c8f951 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 19 Jul 2024 23:18:24 +0200 Subject: [PATCH 1/2] fix: Correctly setup Typescript root to emit declarations Previously no root was set, so types for `vite.config` were included and the library types were emitted to `dist/lib`. Signed-off-by: Ferdinand Thiessen --- REUSE.toml | 2 +- package-lock.json | 2 +- package.json | 5 +++-- test/tsconfig.json | 7 +++++++ tsconfig.json | 27 +++++++++++++++------------ vitest.config.ts | 29 +++++++++++++++-------------- 6 files changed, 42 insertions(+), 30 deletions(-) create mode 100644 test/tsconfig.json diff --git a/REUSE.toml b/REUSE.toml index cf9b6af5..e88f5e86 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -6,7 +6,7 @@ SPDX-PackageSupplier = "Nextcloud GmbH " SPDX-PackageDownloadLocation = "https://github.com/nextcloud-libraries/nextcloud-paths" [[annotations]] -path = ["package.json", "package-lock.json", "tsconfig.json"] +path = ["package.json", "package-lock.json", "tsconfig.json", "test/tsconfig.json"] precedence = "aggregate" SPDX-FileCopyrightText = "2019 Nextcloud GmbH and Nextcloud contributors" SPDX-License-Identifier = "GPL-3.0-or-later" diff --git a/package-lock.json b/package-lock.json index 0bd65a8d..682e89e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ }, "engines": { "node": "^20.0.0", - "npm": "^9.0.0 || ^10.0.0" + "npm": "^10.0.0" } }, "node_modules/@ampproject/remapping": { diff --git a/package.json b/package.json index de4bd09f..276e708a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "type": "git", "url": "https://github.com/nextcloud-libraries/nextcloud-paths" }, - "author": "Christoph Wurst", + "author": "Nextcloud GmbH and Nextcloud contributors", "license": "GPL-3.0-or-later", "devDependencies": { "@nextcloud/browserslist-config": "^3.0.1", @@ -44,10 +44,11 @@ ], "engines": { "node": "^20.0.0", - "npm": "^9.0.0 || ^10.0.0" + "npm": "^10.0.0" }, "files": [ "dist", + "AUTHORS.md", "CHANGELOG.md", "README.md", "LICENSE" diff --git a/test/tsconfig.json b/test/tsconfig.json new file mode 100644 index 00000000..48ea9705 --- /dev/null +++ b/test/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "..", + "include": ["../*.ts", ".", "../lib"], + "compilerOptions": { + "rootDir": ".." + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 329d46fa..a61c790c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,14 +1,17 @@ { - "compilerOptions": { - "target": "ESNext", - "module": "ESNext", - "moduleResolution": "Bundler", - "declaration": true, - "outDir": "./dist", - "strict": true, - "lib": [ - "es6", - "dom" - ] - } + "include": ["lib"], + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "Bundler", + "declaration": true, + "outDir": "./dist", + "rootDir": "lib", + "strict": true, + "lib": [ + "es6", + "dom" + ], + "types": ["vitest"] + } } \ No newline at end of file diff --git a/vitest.config.ts b/vitest.config.ts index 59fe6ba1..e571b52c 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -2,23 +2,24 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: GPL-3.0-or-later */ +import { defineConfig } from "vitest/config"; import viteConfig from "./vite.config"; export default async (env: Parameters[0]) => { const config = typeof viteConfig === "function" ? await viteConfig(env) : viteConfig; - // node-externals conflicts with vitest - config.plugins = config.plugins!.filter( - (plugin) => - plugin && (!("name" in plugin) || plugin?.name !== "node-externals") - ); - - config.test = { - coverage: { - reporter: ["text", "lcov"], - }, - }; - - return config; -}; + return defineConfig({ + ...config, + // node-externals conflicts with vitest + plugins: config.plugins!.filter( + (plugin) => + plugin && (!("name" in plugin) || plugin?.name !== "node-externals") + ), + test: { + coverage: { + reporter: ["text", "lcov"], + }, + } + }) +} From 36f64a274e32106943c1a2edf31547b22f6c68ed Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 25 Jul 2024 12:02:43 +0200 Subject: [PATCH 2/2] chore: Prepare v2.2.1 Signed-off-by: Ferdinand Thiessen --- CHANGELOG.md | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71aa3ac6..8060ec0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file. +## 2.2.1 - 2024-07-25 +### Fixed +- fix: Correctly setup Typescript root to emit declarations + ## 2.2.0 - 2024-07-17 ### Fixed - fix: Adjust package.json to make `build:doc` work again and fix incorrect URL diff --git a/package-lock.json b/package-lock.json index 682e89e0..a04d329b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@nextcloud/paths", - "version": "2.2.0", + "version": "2.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@nextcloud/paths", - "version": "2.2.0", + "version": "2.2.1", "license": "GPL-3.0-or-later", "devDependencies": { "@nextcloud/browserslist-config": "^3.0.1", diff --git a/package.json b/package.json index 276e708a..488ab380 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nextcloud/paths", - "version": "2.2.0", + "version": "2.2.1", "description": "Helper functions for working with paths in Nextcloud apps", "type": "module", "main": "dist/index.js",