0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
FredKSchott 2022-03-19 17:34:21 +00:00 committed by GitHub Actions
parent 9219d5e1c0
commit 2a8580c251

View file

@ -1,6 +1,6 @@
import { globby as glob } from 'globby'; import { globby as glob } from 'globby';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { readFile } from 'node:fs/promises' import { readFile } from 'node:fs/promises';
const baseUrl = new URL('https://github.com/withastro/astro/blob/main/'); const baseUrl = new URL('https://github.com/withastro/astro/blob/main/');
@ -57,12 +57,14 @@ function singularlize(text) {
const packageMap = new Map(); const packageMap = new Map();
async function generatePackageMap() { async function generatePackageMap() {
const packageRoot = new URL('../../packages/', import.meta.url); 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) => { await Promise.all(
const pkgFile = fileURLToPath(new URL(pkg, packageRoot)); packages.map(async (pkg) => {
const content = await readFile(pkgFile).then(res => JSON.parse(res.toString())) const pkgFile = fileURLToPath(new URL(pkg, packageRoot));
packageMap.set(content.name, `./packages/${pkg.replace('/package.json', '')}`); const content = await readFile(pkgFile).then((res) => JSON.parse(res.toString()));
})) packageMap.set(content.name, `./packages/${pkg.replace('/package.json', '')}`);
})
);
} }
async function run() { async function run() {