fix(cli): various fixes for adding custom modes and extensions (#3683)

Co-authored-by: Alireza <ar.sedghi@gmail.com>
This commit is contained in:
Joe BoccanfusoandAlireza authored and GitHub committed 2023-09-29 10:35:30 -04:00
1 parent 52da92fed4
commit dc73b18748
11 files changed
+61 -246

No files matched your search

+10 -6
View File
@@ -16,15 +16,15 @@ async function run() {
const rootDir = process.cwd();
for (const packagePathPattern of packages) {
const matchingDirectories = glob.sync(packagePathPattern);
const matchingDirectories = glob.sync(packagePathPattern, { cwd: rootDir });
for (const packageDirectory of matchingDirectories) {
// change back to the root directory
process.chdir(rootDir);
const packageJsonPath = path.join(packageDirectory, 'package.json');
try {
// change back to the root directory
process.chdir(rootDir);
const packageJsonPath = path.join(packageDirectory, 'package.json');
const packageJsonContent = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
if (packageJsonContent.private) {
@@ -32,11 +32,13 @@ async function run() {
continue;
}
// move to package directory
process.chdir(packageDirectory);
let retries = 0;
while (retries < MAX_RETRIES) {
try {
console.log(`Tying to publishing package at ${packageDirectory}`);
const publishArgs = ['publish'];
if (branchName === 'master') {
@@ -56,6 +58,8 @@ async function run() {
}
} catch (error) {
console.error(`An error occurred while processing ${packageDirectory}: ${error}`);
} finally {
process.chdir(rootDir); // Ensure we always move back to the root directory
}
}
}