diff options
author | 2022-03-19 12:33:24 -0500 | |
---|---|---|
committer | 2022-03-19 10:33:24 -0700 | |
commit | 9219d5e1c088f4835c974804fec65ecd9c659496 (patch) | |
tree | 7b72eb95a64f599f0e6a6b930bd14f56963df231 /scripts/notify/index.js | |
parent | 0a498d7289f7d8961026323573d7b2e6a931c26e (diff) | |
download | astro-9219d5e1c088f4835c974804fec65ecd9c659496.tar.gz astro-9219d5e1c088f4835c974804fec65ecd9c659496.tar.zst astro-9219d5e1c088f4835c974804fec65ecd9c659496.zip |
Release bot (#2836)
* fix(ci): improve release-bot message by dynamically generating packageMap
* fix(ci): update changeset to refresh lockfile after version
Diffstat (limited to 'scripts/notify/index.js')
-rwxr-xr-x | scripts/notify/index.js | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/scripts/notify/index.js b/scripts/notify/index.js index e9bb69300..c8e8a242b 100755 --- a/scripts/notify/index.js +++ b/scripts/notify/index.js @@ -1,3 +1,7 @@ +import { globby as glob } from 'globby'; +import { fileURLToPath } from 'node:url'; +import { readFile } from 'node:fs/promises' + const baseUrl = new URL('https://github.com/withastro/astro/blob/main/'); const emojis = ['🎉', '🥳', '🚀', '🧑🚀', '🎊', '🏆', '✅', '🤩', '🤖', '🙌']; @@ -50,23 +54,19 @@ function singularlize(text) { return text.replace(/(\[([^\]]+)\])/gm, (_, _full, match) => `${match}`); } -const packageMap = new Map([ - ['astro', './packages/astro'], - ['@astrojs/parser', './packages/astro-parser'], - ['@astrojs/prism', './packages/astro-prism'], - ['create-astro', './packages/create-astro'], - ['@astrojs/markdown-remark', './packages/markdown/remark'], - ['@astrojs/renderer-lit', './packages/renderers/renderer-lit'], - ['@astrojs/renderer-preact', './packages/renderers/renderer-preact'], - ['@astrojs/renderer-react', './packages/renderers/renderer-react'], - ['@astrojs/renderer-solid', './packages/renderers/renderer-solid'], - ['@astrojs/renderer-solid', './packages/renderers/renderer-solid'], - ['@astrojs/renderer-svelte', './packages/renderers/renderer-svelte'], - ['@astrojs/renderer-vue', './packages/renderers/renderer-vue'], - ['@astrojs/webapi', './packages/webapi'], -]); +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) }) + await Promise.all(packages.map(async (pkg) => { + const pkgFile = fileURLToPath(new URL(pkg, packageRoot)); + const content = await readFile(pkgFile).then(res => JSON.parse(res.toString())) + packageMap.set(content.name, `./packages/${pkg.replace('/package.json', '')}`); + })) +} async function run() { + await generatePackageMap(); const releases = process.argv.slice(2)[0]; const data = JSON.parse(releases); const packages = await Promise.all( |