diff options
author | 2022-04-02 14:15:41 -0600 | |
---|---|---|
committer | 2022-04-02 14:15:41 -0600 | |
commit | 1335797903a57716e9a02b0ffd8ca636b3883c62 (patch) | |
tree | d8835124fec7ab80bfbf25c6d9c5a57039a1c56d /scripts/notify/index.js | |
parent | d63213f1198293e72bb9d9734bf4ec8309c515d4 (diff) | |
download | astro-1335797903a57716e9a02b0ffd8ca636b3883c62.tar.gz astro-1335797903a57716e9a02b0ffd8ca636b3883c62.tar.zst astro-1335797903a57716e9a02b0ffd8ca636b3883c62.zip |
update prettier width (#2968)
Diffstat (limited to 'scripts/notify/index.js')
-rwxr-xr-x | scripts/notify/index.js | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/scripts/notify/index.js b/scripts/notify/index.js index a0505c9ae..fa699372a 100755 --- a/scripts/notify/index.js +++ b/scripts/notify/index.js @@ -5,7 +5,16 @@ import { readFile } from 'node:fs/promises'; const baseUrl = new URL('https://github.com/withastro/astro/blob/main/'); const emojis = ['🎉', '🥳', '🚀', '🧑🚀', '🎊', '🏆', '✅', '🤩', '🤖', '🙌']; -const descriptors = ['new releases', 'hot and fresh updates', 'shiny updates', 'exciting changes', '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!', @@ -47,7 +56,9 @@ const plurals = new Map([ ]); function pluralize(text) { - return text.replace(/(\[([^\]]+)\])/gm, (_, _full, match) => (plurals.has(match) ? plurals.get(match) : `${match}s`)); + return text.replace(/(\[([^\]]+)\])/gm, (_, _full, match) => + plurals.has(match) ? plurals.get(match) : `${match}s` + ); } function singularlize(text) { @@ -57,7 +68,9 @@ function singularlize(text) { const packageMap = new Map(); async function generatePackageMap() { const packageRoot = new URL('../../packages/', import.meta.url); - const packages = await glob(['*/package.json', '*/*/package.json'], { cwd: fileURLToPath(packageRoot) }); + const packages = await glob(['*/package.json', '*/*/package.json'], { + cwd: fileURLToPath(packageRoot), + }); await Promise.all( packages.map(async (pkg) => { const pkgFile = fileURLToPath(new URL(pkg, packageRoot)); @@ -77,7 +90,11 @@ async function run() { if (!p) { throw new Error(`Unable to find entrypoint for "${name}"!`); } - return { name, version, url: new URL(`${p}/CHANGELOG.md#${version.replace(/\./g, '')}`, baseUrl).toString() }; + return { + name, + version, + url: new URL(`${p}/CHANGELOG.md#${version.replace(/\./g, '')}`, baseUrl).toString(), + }; }) ); @@ -87,7 +104,9 @@ async function run() { if (packages.length === 1) { const { name, version, url } = packages[0]; - console.log(`${emoji} \`${name}@${version}\` ${singularlize(verb)}\nRead the [release notes →](<${url}>)`); + console.log( + `${emoji} \`${name}@${version}\` ${singularlize(verb)}\nRead the [release notes →](<${url}>)` + ); } else { console.log(`${emoji} Some ${descriptor} ${pluralize(verb)}\n`); for (const { name, version, url } of packages) { |