feat(core): Refactor directory reading and module discovery for publishing process
This commit is contained in:
parent
386504b0fb
commit
dc97693ec8
@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## 2024-10-26 - 1.4.0 - feat(core)
|
||||
Refactor directory reading and module discovery for publishing process
|
||||
|
||||
- Renamed 'readDirectory' method to 'getModuleSubDirs' for clarity in describing function purpose.
|
||||
- Enhanced 'getModuleSubDirs' to return module information including parsed 'tspublish.json' data for each module.
|
||||
- Introduced new 'interfaces' directory to define TypeScript interfaces like 'ITsPublishJson'.
|
||||
|
||||
## 2024-10-23 - 1.3.3 - fix(core)
|
||||
Fix logging mechanism on existing package version check
|
||||
|
||||
|
7128
pnpm-lock.yaml
generated
7128
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tspublish',
|
||||
version: '1.3.3',
|
||||
version: '1.4.0',
|
||||
description: 'A tool to publish multiple, concise, and small packages from monorepos, specifically for TypeScript projects within a git environment.'
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { logger } from './logging.js';
|
||||
import * as plugins from './plugins.js';
|
||||
import * as interfaces from './interfaces/index.js';
|
||||
|
||||
import { PublishModule } from './classes.publishmodule.js';
|
||||
|
||||
@ -7,8 +8,8 @@ export class TsPublish {
|
||||
constructor() {}
|
||||
|
||||
public async publish (monorepoDirArg: string) {
|
||||
const publishModules = await this.readDirectory(monorepoDirArg);
|
||||
for (const publishModule of publishModules) {
|
||||
const publishModules = await this.getModuleSubDirs(monorepoDirArg);
|
||||
for (const publishModule of Object.keys(publishModules)) {
|
||||
const publishModuleInstance = new PublishModule({
|
||||
monoRepoDir: monorepoDirArg,
|
||||
packageSubFolder: publishModule,
|
||||
@ -20,9 +21,9 @@ export class TsPublish {
|
||||
}
|
||||
}
|
||||
|
||||
public async readDirectory (dirArg: string) {
|
||||
public async getModuleSubDirs (dirArg: string) {
|
||||
const subDirs = await plugins.smartfile.fs.listFolders(dirArg);
|
||||
const publishModules: string[] = [];
|
||||
const publishModules: {[key: string]: interfaces.ITsPublishJson} = {};
|
||||
for (const subDir of subDirs) {
|
||||
if (!subDir.startsWith('ts')) {
|
||||
continue;
|
||||
@ -33,7 +34,7 @@ export class TsPublish {
|
||||
continue;
|
||||
}
|
||||
logger.log('info', `found publish module: ${subDir}`);
|
||||
publishModules.push(subDir);
|
||||
publishModules[subDir] = JSON.parse(plugins.smartfile.fs.toStringSync(plugins.path.join(subDir, 'tspublish.json')));
|
||||
}
|
||||
logger.log('ok', `found ${publishModules.length} publish modules`);
|
||||
return publishModules;
|
||||
|
1
ts/interfaces/index.ts
Normal file
1
ts/interfaces/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './tspublish.js';
|
5
ts/interfaces/tspublish.ts
Normal file
5
ts/interfaces/tspublish.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export interface ITsPublishJson {
|
||||
name: string;
|
||||
dependencies: string[];
|
||||
registries: string[];
|
||||
}
|
Loading…
Reference in New Issue
Block a user