summaryrefslogtreecommitdiff
path: root/scripts/notify/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/notify/index.js')
-rwxr-xr-xscripts/notify/index.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/notify/index.js b/scripts/notify/index.js
new file mode 100755
index 000000000..ea911f61a
--- /dev/null
+++ b/scripts/notify/index.js
@@ -0,0 +1,25 @@
+const path = require('path');
+const baseUrl = new URL('https://github.com/withastro/astro/blob/main/');
+
+async function run() {
+ const releases = process.argv.slice(2)[0];
+ const data = JSON.parse(releases);
+ const packages = await Promise.all(
+ data.map(({ name, version }) => {
+ const p = path.relative('./', path.dirname(require.resolve(name))).replace(path.sep, '/');
+ return { name, version, url: new URL(`${p}/CHANGELOG.md#${version.replace(/\./g, '')}`, baseUrl).toString() };
+ })
+ );
+
+ if (packages.length === 1) {
+ const { name, version, url } = packages[0];
+ console.log(`\`${name}@${version}\` was just released! Read the [release notes →](<${url}>)`);
+ } else {
+ console.log(`**Some new releases just went out!**\n`);
+ for (const { name, version, url } of packages) {
+ console.log(` • \`${name}@${version}\` ([Release Notes →](<${url}>))`);
+ }
+ }
+}
+
+run();