summaryrefslogtreecommitdiff
path: root/scripts/notify/index.js
diff options
context:
space:
mode:
authorGravatar Nate Moore <nate@skypack.dev> 2021-12-07 16:08:49 -0600
committerGravatar Nate Moore <nate@skypack.dev> 2021-12-07 16:08:49 -0600
commit0beb9183aefdc16fb735a3709bb3ef528156c6f8 (patch)
treecf620c1b54f0010c9ebafecd6c79ef7a2382acc7 /scripts/notify/index.js
parentef3950c647e523ff6f36cfa096c4a92596d32afa (diff)
downloadastro-0beb9183aefdc16fb735a3709bb3ef528156c6f8.tar.gz
astro-0beb9183aefdc16fb735a3709bb3ef528156c6f8.tar.zst
astro-0beb9183aefdc16fb735a3709bb3ef528156c6f8.zip
chore(bots): update notify settings
Diffstat (limited to 'scripts/notify/index.js')
-rwxr-xr-xscripts/notify/index.js49
1 files changed, 31 insertions, 18 deletions
diff --git a/scripts/notify/index.js b/scripts/notify/index.js
index 4325a04cd..300aefd9f 100755
--- a/scripts/notify/index.js
+++ b/scripts/notify/index.js
@@ -4,7 +4,7 @@ const require = createRequire(import.meta.url);
const baseUrl = new URL('https://github.com/withastro/astro/blob/main/');
const emojis = ['πŸŽ‰', 'πŸ₯³', 'πŸš€', 'πŸ§‘β€πŸš€', '🎊', 'πŸ†', 'βœ…', '🀩', 'πŸ€–', 'πŸ™Œ'];
-const descriptors = ['new releases', 'fresh new code', 'shiny updates', 'exciting stuff', 'package updates', 'awesome updates', 'bug fixes and features', 'updates'];
+const descriptors = ['new releases', 'hot and fresh updates', 'shiny updates', 'exciting changes', 'package updates', 'awesome updates', 'bug fixes and features', 'updates'];
const verbs = [
'just went out!',
'just launched!',
@@ -14,32 +14,45 @@ const verbs = [
'hit the registry!',
'to share!',
'for you!',
- 'for y’all!',
+ 'for y’all! 🀠',
'comin’ your way!',
'comin’ atcha!',
'comin’ in hot!',
- ', freshly minted on the blockchain! (jk)',
- ', now with 100% more reticulated splines!',
+ 'freshly minted on the blockchain! (jk)',
+ '[is] out (now with 100% more reticulated splines!)',
'(as seen on TV!)',
'just dropped!',
- ', artisanally hand-crafted just for you.',
- ', oh happy day!',
- 'β€”enjoy!',
- '(be the first on your block to download it!)',
- ', made with love',
- ', our best version yet!',
- 'DOWNLOAD! DOWNLOAD! DOWNLOAD!',
- '! HUZZAH!',
- 'has landed!',
- '! The internet just got a little more fun.',
- ', from our family to yours.',
- ', go forth and build!',
+ '– artisanally hand-crafted just for you.',
+ '– oh happy day!',
+ '– enjoy!',
+ 'now out. Be the first on your block to download!',
+ 'made with love πŸ’•',
+ '[is] out! Our best [version] yet!',
+ '[is] here. DOWNLOAD! DOWNLOAD! DOWNLOAD!',
+ '... HUZZAH!',
+ '[has] landed!',
+ 'landed! The internet just got a little more fun.',
+ '– from our family to yours.',
+ '– go forth and build!',
];
function item(items) {
return items[Math.floor(Math.random() * items.length)];
}
+const plurals = new Map([
+ ['is', 'are'],
+ ['has', 'have']
+])
+
+function pluralize(text) {
+ return text.replace(/(\[([^\]]+)\])/gm, (_, _full, match) => plurals.has(match) ? plurals.get(match) : `${match}s`)
+}
+
+function singularlize(text) {
+ return text.replace(/(\[([^\]]+)\])/gm, (_, _full, match) => `${match}`)
+}
+
async function run() {
const releases = process.argv.slice(2)[0];
const data = JSON.parse(releases);
@@ -56,9 +69,9 @@ async function run() {
if (packages.length === 1) {
const { name, version, url } = packages[0];
- console.log(`${emoji} \`${name}@${version}\` ${verb}\nRead the [release notes β†’](<${url}>)`);
+ console.log(`${emoji} \`${name}@${version}\` ${singularlize(verb)}\nRead the [release notes β†’](<${url}>)`);
} else {
- console.log(`${emoji} Some ${descriptor} ${verb}\n`);
+ console.log(`${emoji} Some ${descriptor} ${pluralize(verb)}\n`);
for (const { name, version, url } of packages) {
console.log(`β€’ \`${name}@${version}\` Read the [release notes β†’](<${url}>)`);
}