* Compiles all non-partial Sass files in the project and writes them next * to their source files. The files are written into the source root as * this simplifies the resolution within the standalone Angular compiler. * * Given that the legacy tests should only run on CI, it is acceptable to *
()
| 82 | * explicitly added. |
| 83 | */ |
| 84 | async function compileSassFiles() { |
| 85 | const sassFiles = globSync('src/**/!(_*|theme).scss', {cwd: projectDir, absolute: true}); |
| 86 | const writeTasks = []; |
| 87 | |
| 88 | let count = 0; |
| 89 | for (const file of sassFiles) { |
| 90 | const outRelativePath = relative(projectDir, file).replace(/\.scss$/, '.css'); |
| 91 | const outPath = join(projectDir, outRelativePath); |
| 92 | const content = renderSassFile(file).css; |
| 93 | |
| 94 | count++; |
| 95 | console.error(`Compiled ${count}/${sassFiles.length} files`); |
| 96 | |
| 97 | writeTasks.push(async () => { |
| 98 | console.info('Compiled, now writing:', outRelativePath); |
| 99 | await fs.promises.mkdir(dirname(outPath), {recursive: true}); |
| 100 | await fs.promises.writeFile(outPath, content); |
| 101 | }); |
| 102 | } |
| 103 | |
| 104 | // Start all writes and wait for them to finish. |
| 105 | await Promise.all(writeTasks.map(task => task())); |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Compiles the project using the Angular compiler in order to produce JS output of |
no test coverage detected