chore(bots): update notify settings
This commit is contained in:
parent
ef3950c647
commit
0beb9183ae
1 changed files with 31 additions and 18 deletions
|
@ -4,7 +4,7 @@ const require = createRequire(import.meta.url);
|
||||||
const baseUrl = new URL('https://github.com/withastro/astro/blob/main/');
|
const baseUrl = new URL('https://github.com/withastro/astro/blob/main/');
|
||||||
|
|
||||||
const emojis = ['🎉', '🥳', '🚀', '🧑🚀', '🎊', '🏆', '✅', '🤩', '🤖', '🙌'];
|
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 = [
|
const verbs = [
|
||||||
'just went out!',
|
'just went out!',
|
||||||
'just launched!',
|
'just launched!',
|
||||||
|
@ -14,32 +14,45 @@ const verbs = [
|
||||||
'hit the registry!',
|
'hit the registry!',
|
||||||
'to share!',
|
'to share!',
|
||||||
'for you!',
|
'for you!',
|
||||||
'for y’all!',
|
'for y’all! 🤠',
|
||||||
'comin’ your way!',
|
'comin’ your way!',
|
||||||
'comin’ atcha!',
|
'comin’ atcha!',
|
||||||
'comin’ in hot!',
|
'comin’ in hot!',
|
||||||
', freshly minted on the blockchain! (jk)',
|
'freshly minted on the blockchain! (jk)',
|
||||||
', now with 100% more reticulated splines!',
|
'[is] out (now with 100% more reticulated splines!)',
|
||||||
'(as seen on TV!)',
|
'(as seen on TV!)',
|
||||||
'just dropped!',
|
'just dropped!',
|
||||||
', artisanally hand-crafted just for you.',
|
'– artisanally hand-crafted just for you.',
|
||||||
', oh happy day!',
|
'– oh happy day!',
|
||||||
'—enjoy!',
|
'– enjoy!',
|
||||||
'(be the first on your block to download it!)',
|
'now out. Be the first on your block to download!',
|
||||||
', made with love',
|
'made with love 💕',
|
||||||
', our best version yet!',
|
'[is] out! Our best [version] yet!',
|
||||||
'DOWNLOAD! DOWNLOAD! DOWNLOAD!',
|
'[is] here. DOWNLOAD! DOWNLOAD! DOWNLOAD!',
|
||||||
'! HUZZAH!',
|
'... HUZZAH!',
|
||||||
'has landed!',
|
'[has] landed!',
|
||||||
'! The internet just got a little more fun.',
|
'landed! The internet just got a little more fun.',
|
||||||
', from our family to yours.',
|
'– from our family to yours.',
|
||||||
', go forth and build!',
|
'– go forth and build!',
|
||||||
];
|
];
|
||||||
|
|
||||||
function item(items) {
|
function item(items) {
|
||||||
return items[Math.floor(Math.random() * items.length)];
|
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() {
|
async function run() {
|
||||||
const releases = process.argv.slice(2)[0];
|
const releases = process.argv.slice(2)[0];
|
||||||
const data = JSON.parse(releases);
|
const data = JSON.parse(releases);
|
||||||
|
@ -56,9 +69,9 @@ async function run() {
|
||||||
|
|
||||||
if (packages.length === 1) {
|
if (packages.length === 1) {
|
||||||
const { name, version, url } = packages[0];
|
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 {
|
} else {
|
||||||
console.log(`${emoji} Some ${descriptor} ${verb}\n`);
|
console.log(`${emoji} Some ${descriptor} ${pluralize(verb)}\n`);
|
||||||
for (const { name, version, url } of packages) {
|
for (const { name, version, url } of packages) {
|
||||||
console.log(`• \`${name}@${version}\` Read the [release notes →](<${url}>)`);
|
console.log(`• \`${name}@${version}\` Read the [release notes →](<${url}>)`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue