Skip to content

Commit 3454fba

Browse files
committed
improve export script
1 parent c84341e commit 3454fba

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

explicitExport.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ function updateExportStatements(directoryPath: string) {
6767
const index = contents.find(
6868
(filePath) => fs.statSync(filePath).isFile() && path.basename(filePath) === "index.ts",
6969
);
70-
if (!index || !fs.statSync(index).isFile() || path.basename(index) !== "index.ts") return;
70+
if (!index || !fs.statSync(index).isFile() || path.basename(index) !== "index.ts") {
71+
console.log("No index.ts file found in", directoryPath);
72+
return;
73+
}
7174

7275
// Only update index.ts exports directly
7376
let fileContent = fs.readFileSync(index, "utf8");
@@ -89,8 +92,13 @@ function identifyWorkspaces(directoryPath: string) {
8992
const packageFile = fs.readFileSync(path.join(directoryPath, "package.json"), "utf8");
9093
const packageJson = JSON.parse(packageFile);
9194
for (const ws of packageJson.workspaces) {
95+
console.log("Working on", ws);
9296
updateExportStatements(path.join(directoryPath, ws, "src"));
9397
}
9498
}
9599

96-
identifyWorkspaces("/home/ben/connect-sdk");
100+
function rootDir(): string {
101+
return path.join(__dirname);
102+
}
103+
104+
identifyWorkspaces(rootDir());

0 commit comments

Comments
 (0)