2 Commits

Author SHA1 Message Date
4e8671a21d 1.7.4
Some checks failed
Default (tags) / security (push) Failing after 0s
Default (tags) / test (push) Failing after 0s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2024-11-05 00:47:16 +01:00
78c73ee713 fix(classes.tspublish): Refactor getModuleSubDirs method to streamline name validation for publish modules 2024-11-05 00:47:16 +01:00
4 changed files with 18 additions and 11 deletions

View File

@ -1,5 +1,11 @@
# Changelog # Changelog
## 2024-11-05 - 1.7.4 - fix(classes.tspublish)
Refactor getModuleSubDirs method to streamline name validation for publish modules
- Moved the check for the presence of the 'name' field in tspublish.json from getModuleSubDirs to the publish method.
- Added log warning and continue flow if 'name' is not found during the publish process.
## 2024-11-05 - 1.7.3 - fix(TsPublish) ## 2024-11-05 - 1.7.3 - fix(TsPublish)
Add validation for tspublish.json name field Add validation for tspublish.json name field

View File

@ -1,6 +1,6 @@
{ {
"name": "@git.zone/tspublish", "name": "@git.zone/tspublish",
"version": "1.7.3", "version": "1.7.4",
"private": false, "private": false,
"description": "A tool to publish multiple, concise, and small packages from monorepos, specifically for TypeScript projects within a git environment.", "description": "A tool to publish multiple, concise, and small packages from monorepos, specifically for TypeScript projects within a git environment.",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

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

View File

@ -17,6 +17,14 @@ export class TsPublish {
); );
} }
for (const publishModule of Object.keys(publishModules)) { for (const publishModule of Object.keys(publishModules)) {
// lets check wether there is a name
const tspublishJson = JSON.parse(
plugins.smartfile.fs.toStringSync(plugins.path.join(publishModule, 'tspublish.json')),
);
if (!tspublishJson.name) {
logger.log('warn', `no name found in tspublish.json for ${publishModule}. Skipping...`);
continue;
}
const publishModuleInstance = new PublishModule({ const publishModuleInstance = new PublishModule({
monoRepoDir: monorepoDirArg, monoRepoDir: monorepoDirArg,
packageSubFolder: publishModule, packageSubFolder: publishModule,
@ -41,21 +49,14 @@ export class TsPublish {
continue; 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}`); logger.log('info', `found publish module: ${subDir}`);
publishModules[subDir] = JSON.parse( publishModules[subDir] = JSON.parse(
plugins.smartfile.fs.toStringSync(plugins.path.join(subDir, 'tspublish.json')), plugins.smartfile.fs.toStringSync(plugins.path.join(subDir, 'tspublish.json')),
); );
} }
logger.log('ok', `found ${publishModules.length} publish modules`); logger.log('ok', `found ${publishModules.length} publish modules`);
logger.log('info', `Ordering publish modules...`);
return publishModules; return publishModules;
} }
} }