Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: speed up isolated next instance test setup #56525

Merged
merged 9 commits into from
Oct 6, 2023
Prev Previous commit
Next Next commit
refactor: replace readJson with JSON.parse + readFile
  • Loading branch information
SukkaW committed Oct 6, 2023
commit a9d7f6971ada10e4c7cd4799e4cf386b37a8c031
42 changes: 22 additions & 20 deletions .github/actions/next-stats-action/src/prepare/repo-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,29 @@ module.exports = (actionInfo) => {
throw err
}

for (const pkg of pkgs) {
const pkgPath = path.join(repoDir, 'packages', pkg)
const packedPkgPath = path.join(pkgPath, `${pkg}-packed.tgz`)

const pkgDataPath = path.join(pkgPath, 'package.json')
if (!fs.existsSync(pkgDataPath)) {
require('console').log(`Skipping ${pkgDataPath}`)
continue
}
const pkgData = await fse.readJSON(pkgDataPath)
const { name } = pkgData

pkgDatas.set(name, {
pkgDataPath,
pkg,
pkgPath,
pkgData,
packedPkgPath,
await Promise.all(
pkgs.map(async (pkg) => {
const pkgPath = path.join(repoDir, 'packages', pkg)
const packedPkgPath = path.join(pkgPath, `${pkg}-packed.tgz`)

const pkgDataPath = path.join(pkgPath, 'package.json')
if (fs.existsSync(pkgDataPath)) {
const pkgData = JSON.parse(await fsp.readFile(pkgDataPath))
huozhi marked this conversation as resolved.
Show resolved Hide resolved
const { name } = pkgData

pkgDatas.set(name, {
pkgDataPath,
pkg,
pkgPath,
pkgData,
packedPkgPath,
})
pkgPaths.set(name, packedPkgPath)
} else {
require('console').log(`Skipping ${pkgDataPath}`)
}
})
pkgPaths.set(name, packedPkgPath)
}
)

for (const [
pkg,
Expand Down
Loading