fix(TsPublish): Add validation for tspublish.json name field

This commit is contained in:
Philipp Kunz 2024-11-05 00:41:46 +01:00
parent ac839d5419
commit 023aea2494
3 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## 2024-11-05 - 1.7.3 - fix(TsPublish)
Add validation for tspublish.json name field
- Ensure that the tspublish.json file contains a valid name field before processing.
- Log a warning message if the name is not found in tspublish.json.
## 2024-11-05 - 1.7.2 - fix(project)
Fixed minor formatting issues and improved code consistency.

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tspublish',
version: '1.7.2',
version: '1.7.3',
description: 'A tool to publish multiple, concise, and small packages from monorepos, specifically for TypeScript projects within a git environment.'
}

View File

@ -40,6 +40,16 @@ export class TsPublish {
if (!hasPublishJson) {
continue;
}
// lets check wether there is a name
const tspublishJson = JSON.parse(
plugins.smartfile.fs.toStringSync(plugins.path.join(subDir, 'tspublish.json')),
);
if (!tspublishJson.name) {
logger.log('warn', `no name found in tspublish.json for ${subDir}`);
continue;
}
logger.log('info', `found publish module: ${subDir}`);
publishModules[subDir] = JSON.parse(
plugins.smartfile.fs.toStringSync(plugins.path.join(subDir, 'tspublish.json')),