Skip to content

Commit

Permalink
Merge pull request #666 from intechstudio/DANIM1130/package-manager-v…
Browse files Browse the repository at this point in the history
…ersioning

Add versioning capability to package manager
  • Loading branch information
SukuWc authored Apr 12, 2024
2 parents e8af162 + 1bb7ba6 commit 3900e55
Show file tree
Hide file tree
Showing 7 changed files with 373 additions and 91 deletions.
9 changes: 8 additions & 1 deletion configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,12 @@
"PROFILE_CLOUD_URL_LOCAL": "http://localhost:5200",
"PROFILE_CLOUD_URL_DEV": "https://profile-cloud-dev.web.app",
"PROFILE_CLOUD_URL_PROD": "https://profile-cloud.web.app",
"PROFILE_CLOUD_EMAIL_REGISTRATION": "https://intech.studio/auth"
"PROFILE_CLOUD_EMAIL_REGISTRATION": "https://intech.studio/auth",
"RECOMMENDED_PACKAGES": {
"package-active-win": {
"name": "Active Window",
"gitHubRepositoryOwner": "intechstudio",
"gitHubRepositoryName": "package-active-win"
}
}
}
21 changes: 19 additions & 2 deletions src/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@ function createWindow() {
});
}

function startPackageManager() {
function startPackageManager(
updatePackageOnStartName: string | undefined = undefined
) {
const { port1, port2 } = new MessageChannelMain();
mainWindow.webContents.postMessage("package-manager-port", null, [port1]);

Expand All @@ -346,15 +348,30 @@ function startPackageManager() {
type: "init",
packageFolder: packageFolder,
version: configuration.EDITOR_VERSION,
githubPackages: store.get("githubPackages"),
updatePackageOnStartName,
},
[port2]
);

packageManagerProcess.on("message", (message) => {
if (message.type == "shutdown-complete") {
if (message.type === "shutdown-complete") {
packageManagerProcess?.kill();
packageManagerProcess = undefined;
startPackageManager();
}
if (
message.type === "delete-package-folder" ||
message.type === "update-package-folder"
) {
packageManagerProcess?.once("exit", () => {
fs.rm(message.path, { recursive: true }, () =>
startPackageManager(message.packageName)
);
});
packageManagerProcess!.kill();
packageManagerProcess = undefined;
}
});
} else {
packageManagerProcess.postMessage(
Expand Down
Loading

0 comments on commit 3900e55

Please sign in to comment.