2022-05-17 20:53:01 +02:00
|
|
|
/**
|
|
|
|
* Build the test setups
|
|
|
|
*/
|
|
|
|
|
|
|
|
import path from 'path'
|
2022-05-20 18:52:57 +02:00
|
|
|
import {colorize, getCompatibilityTestSetups} from './utils.mjs'
|
2022-05-17 20:53:01 +02:00
|
|
|
|
|
|
|
const root = path.resolve(__dirname, '../..')
|
2022-05-20 18:52:57 +02:00
|
|
|
const absPathOfCompatibilityTestSetups = getCompatibilityTestSetups(root)
|
2022-05-17 20:53:01 +02:00
|
|
|
|
|
|
|
const setupsWithErros = []
|
|
|
|
|
|
|
|
// Try building the setups
|
|
|
|
;(async function () {
|
2022-05-20 18:52:57 +02:00
|
|
|
for (const setupDir of absPathOfCompatibilityTestSetups) {
|
2022-05-17 20:53:01 +02:00
|
|
|
try {
|
|
|
|
cd(setupDir)
|
2022-05-20 18:52:57 +02:00
|
|
|
const pathToSetup = path.join(absPathOfCompatibilityTestSetups, setupDir)
|
|
|
|
fs.removeSync(path.join(pathToSetup, 'node_modules'))
|
|
|
|
fs.removeSync(path.join(pathToSetup, 'package-lock.json'))
|
|
|
|
fs.removeSync(path.join(pathToSetup, 'yarn.lock'))
|
|
|
|
await $`npm install`
|
|
|
|
await $`npm run build`
|
2022-05-17 20:53:01 +02:00
|
|
|
} catch (err) {
|
|
|
|
console.error(err)
|
|
|
|
setupsWithErros.push(setupDir)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stop if there were any errors during the build process,
|
|
|
|
// and print all of them to the console.
|
|
|
|
if (setupsWithErros.length !== 0) {
|
|
|
|
throw new Error(
|
|
|
|
`The following setups had problems when their dependencies were being installed:\n${colorize.red(
|
|
|
|
setupsWithErros.join('\n'),
|
|
|
|
)}`,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
})()
|