Skip to content

Commit

Permalink
Update setup-care-apps scripts to remove existing apps that are not c…
Browse files Browse the repository at this point in the history
…onfigured in env if any
  • Loading branch information
rithviknishad committed Nov 8, 2024
1 parent 4b8b4a4 commit 16b9877
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/setup-care-apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ const installApp = (app) => {
);
};

fs.readdirSync(appsDir, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name)
.filter(
(dir) =>
!appsConfig
.map((app) => path.join(appsDir, app.package.split("/")[1]))
.includes(dir),
)
.forEach((unusedApp) => {
console.log(`Removing existing app '${unusedApp}' as not configured.`);
fs.rmSync(path.join(appsDir, unusedApp), { recursive: true, force: true });
});

// Clone or pull care apps
appsConfig.forEach((app) => {
const appDir = path.join(appsDir, app.package.split("/")[1]);
Expand Down

0 comments on commit 16b9877

Please sign in to comment.