feat(publish): add registry resolution (useBase/extendBase) and migrate filesystem operations to async SmartFs; improve publish flow and docs
This commit is contained in:
@@ -43,22 +43,27 @@ export class TsPublish {
|
||||
}
|
||||
|
||||
public async getModuleSubDirs(dirArg: string) {
|
||||
const subDirs = await plugins.smartfile.fs.listFolders(dirArg);
|
||||
// List all directories
|
||||
const dirContents = await plugins.smartfs.directory(dirArg).list();
|
||||
const publishModules: { [key: string]: interfaces.ITsPublishJson } = {};
|
||||
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) {
|
||||
|
||||
for (const entry of dirContents) {
|
||||
const subDirName = entry.name;
|
||||
if (!subDirName.startsWith('ts')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
logPackage('Found module', subDir);
|
||||
publishModules[subDir] = JSON.parse(
|
||||
plugins.smartfile.fs.toStringSync(plugins.path.join(subDir, 'tspublish.json'))
|
||||
);
|
||||
// Check if this is a directory and has tspublish.json
|
||||
const subDirPath = plugins.path.join(dirArg, subDirName);
|
||||
const tspublishJsonPath = plugins.path.join(subDirPath, 'tspublish.json');
|
||||
|
||||
if (!(await plugins.smartfs.file(tspublishJsonPath).exists())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
logPackage('Found module', subDirName);
|
||||
const tspublishContent = await plugins.smartfs.file(tspublishJsonPath).encoding('utf8').read();
|
||||
publishModules[subDirName] = JSON.parse(tspublishContent as string);
|
||||
}
|
||||
logSuccess(`Found ${Object.keys(publishModules).length} publish modules`);
|
||||
logInfo('Ordering publish modules...');
|
||||
|
||||
Reference in New Issue
Block a user