fix(classes.tspublish): Refactor getModuleSubDirs method to streamline name validation for publish modules
This commit is contained in:
parent
5b768288c5
commit
78c73ee713
@ -1,5 +1,11 @@
|
||||
# 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)
|
||||
Add validation for tspublish.json name field
|
||||
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
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.'
|
||||
}
|
||||
|
@ -17,6 +17,14 @@ export class TsPublish {
|
||||
);
|
||||
}
|
||||
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({
|
||||
monoRepoDir: monorepoDirArg,
|
||||
packageSubFolder: publishModule,
|
||||
@ -41,21 +49,14 @@ export class TsPublish {
|
||||
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')),
|
||||
);
|
||||
}
|
||||
logger.log('ok', `found ${publishModules.length} publish modules`);
|
||||
logger.log('info', `Ordering publish modules...`);
|
||||
|
||||
return publishModules;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user