feat(core): support cli tools inside mono repos.

This commit is contained in:
2025-01-02 03:31:15 +01:00
parent 51ca619151
commit 23f89eabf3
6 changed files with 74 additions and 34 deletions

View File

@@ -3,9 +3,16 @@ import * as plugins from './plugins.js';
import * as interfaces from './interfaces/index.js';
import { PublishModule } from './classes.publishmodule.js';
import { GiteaAssets } from './classes.giteaassets.js';
export class TsPublish {
constructor() {}
public giteaAssetsInstance: GiteaAssets;
constructor() {
this.giteaAssetsInstance = new GiteaAssets({
giteaBaseUrl: 'https://code.foss.global',
});
}
public async publish(monorepoDirArg: string) {
const publishModules = await this.getModuleSubDirs(monorepoDirArg);
@@ -13,7 +20,7 @@ export class TsPublish {
for (const publishModule of Object.keys(publishModules)) {
logger.log(
'info',
`Publishing module: ${publishModule} -> ${publishModules[publishModule].name}`,
`Publishing module: ${publishModule} -> ${publishModules[publishModule].name}`
);
}
for (const publishModule of Object.keys(publishModules)) {
@@ -22,7 +29,7 @@ export class TsPublish {
logger.log('warn', `no name found in tspublish.json for ${publishModule}. Skipping...`);
continue;
}
const publishModuleInstance = new PublishModule({
const publishModuleInstance = new PublishModule(this, {
monoRepoDir: monorepoDirArg,
packageSubFolder: publishModule,
});
@@ -48,12 +55,12 @@ export class TsPublish {
logger.log('info', `found publish module: ${subDir}`);
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 ${Object.keys(publishModules).length} publish modules`);
logger.log('info', `Ordering publish modules...`);
return publishModules;
}
}