initial
This commit is contained in:
38
ts/classes.tspublish.ts
Normal file
38
ts/classes.tspublish.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { logger } from './logging.js';
|
||||
import * as plugins from './plugins.js';
|
||||
|
||||
import { PublishModule } from './classes.publishmodule.js';
|
||||
|
||||
export class TsPublish {
|
||||
constructor() {}
|
||||
|
||||
public async publish (monorepoDirArg: string) {
|
||||
const publishModules = await this.readDirectory(monorepoDirArg);
|
||||
for (const publishModule of publishModules) {
|
||||
const publishModuleInstance = new PublishModule({
|
||||
monoRepoDir: monorepoDirArg,
|
||||
packageSubFolder: publishModule,
|
||||
});
|
||||
await publishModuleInstance.init();
|
||||
}
|
||||
}
|
||||
|
||||
public async readDirectory (dirArg: string) {
|
||||
const subDirs = await plugins.smartfile.fs.listFolders(dirArg);
|
||||
const publishModules: string[] = [];
|
||||
for (const subDir of subDirs) {
|
||||
if (!subDir.startsWith('ts')) {
|
||||
continue;
|
||||
}
|
||||
const fileTree = await plugins.smartfile.fs.listFileTree(subDir, '**/*');
|
||||
const hasPublishJson = fileTree.includes('tspublish.json');
|
||||
if (!hasPublishJson) {
|
||||
continue;
|
||||
}
|
||||
logger.log('info', `found publish module: ${subDir}`);
|
||||
publishModules.push(subDir);
|
||||
}
|
||||
logger.log('ok', `found ${publishModules.length} publish modules`);
|
||||
return publishModules;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user