@grouparoo/core
Version:
The Grouparoo Core
50 lines (44 loc) • 1.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NewVersionNotifier = void 0;
const notifier_1 = require("../classes/notifier");
const plugins_1 = require("../modules/plugins");
class NewVersionNotifier extends notifier_1.Notifier {
constructor() {
super();
this.from = "Grouparoo Version Update Notifications";
this.messageLimit = 1;
}
async buildNotification() {
const plugins = await (0, plugins_1.listPlugins)();
const core = plugins.find((p) => p.name === "@grouparoo/core");
const otherPluginsWithUpdates = plugins
.filter((p) => p.name !== "@grouparoo/core")
.filter((p) => p.upToDate === false);
if (core.upToDate) {
await this.clearNotifications();
return;
}
if (core.latestVersion === "unknown")
return;
const notification = {
subject: "There's a new version of Grouparoo!",
body: `
**There is a new version of Grouparoo available!**
You are currently running version **${core.currentVersion}** of @grouparoo/core, but the latest version is **${core.latestVersion}**. We suggest that you upgrade your server as soon as possible to take advantage of all the new features and fixes.
You can learn more about upgrading Grouparoo at [www.grouparoo.com](https://www.grouparoo.com/docs).
${otherPluginsWithUpdates
? `There are also other plugins with updates available:
${otherPluginsWithUpdates
.map((p) => ` * ${p.name} (${p.currentVersion} -> ${p.latestVersion})`)
.join("\r\n")}`
: null}
Thanks, The Grouparoo Team
`,
cta: "See what upgrades are available",
ctaLink: "/about",
};
return notification;
}
}
exports.NewVersionNotifier = NewVersionNotifier;