From f74a6bf2ad71274dfe0cdacfc72814c6fa45ccd9 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Mon, 28 Oct 2024 01:30:39 +0100 Subject: [PATCH] fix(core): Fix incorrect logging and directory preparation --- changelog.md | 6 ++++++ ts/00_commitinfo_data.ts | 2 +- ts/classes.publishmodule.ts | 2 +- ts/classes.tspublish.ts | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index cf8d356..97485cb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2024-10-28 - 1.5.3 - fix(core) +Fix incorrect logging and directory preparation + +- Corrected logging to accurately report the number of detected publish modules. +- Ensured the publish directory is emptied before creating package.json. + ## 2024-10-28 - 1.5.2 - fix(core) Add logging for found publish modules diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index de551a7..c9b7197 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/tspublish', - version: '1.5.2', + version: '1.5.3', description: 'A tool to publish multiple, concise, and small packages from monorepos, specifically for TypeScript projects within a git environment.' } diff --git a/ts/classes.publishmodule.ts b/ts/classes.publishmodule.ts index 460c33f..d704d9d 100644 --- a/ts/classes.publishmodule.ts +++ b/ts/classes.publishmodule.ts @@ -142,9 +142,9 @@ export class PublishModule { this.options.monoRepoDir, `dist_publish_${this.options.packageSubFolder}` ); + await plugins.smartfile.fs.ensureEmptyDir(this.options.publishModDirFullPath); // package.json - await plugins.smartfile.fs.ensureEmptyDir(this.options.publishModDirFullPath); const packageJson = await plugins.smartfile.SmartFile.fromString( plugins.path.join(this.options.publishModDirFullPath, 'package.json'), await this.createPackageJson(), diff --git a/ts/classes.tspublish.ts b/ts/classes.tspublish.ts index b47f7e8..0c7baaa 100644 --- a/ts/classes.tspublish.ts +++ b/ts/classes.tspublish.ts @@ -9,8 +9,8 @@ export class TsPublish { public async publish (monorepoDirArg: string) { const publishModules = await this.getModuleSubDirs(monorepoDirArg); - console.log(`Found ${publishModules.length} publish modules:`); - console.log(publishModules); + console.log(`Found ${Object.keys(publishModules).length} publish modules:`); + console.log(Object.keys(publishModules)); for (const publishModule of Object.keys(publishModules)) { const publishModuleInstance = new PublishModule({ monoRepoDir: monorepoDirArg,