2022-05-17 20:53:01 +02:00
|
|
|
/**
|
|
|
|
* Build the test setups
|
|
|
|
*/
|
|
|
|
|
|
|
|
import path from 'path'
|
2023-01-04 20:03:47 +01:00
|
|
|
import {cd, fs, $} from 'zx'
|
|
|
|
import {getCompatibilityTestSetups} from './utils.mjs'
|
2022-05-17 20:53:01 +02:00
|
|
|
|
2023-01-04 20:03:47 +01:00
|
|
|
const absPathOfCompatibilityTestSetups = getCompatibilityTestSetups()
|
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)
|
2023-01-04 20:03:47 +01:00
|
|
|
const pathToSetup = path.join(setupDir, setupDir)
|
2022-05-20 18:52:57 +02:00
|
|
|
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(
|
2023-01-04 20:03:47 +01:00
|
|
|
`The following setups had problems when their dependencies were being installed:\n${(
|
2022-05-17 20:53:01 +02:00
|
|
|
setupsWithErros.join('\n'),
|
|
|
|
)}`,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
})()
|