angular/integration/cli-hello-world-lazy/check-output-for-ngdevmode.js
Joey Perrott 894c1c5f10 refactor: apply prettier formatting to integration (#54653)
Apply prettier formatting to integration directories

PR Close #54653
2024-04-02 20:42:04 +00:00

18 lines
579 B
JavaScript

const fs = require('fs');
const path = require('path');
const distPath = './dist/';
const ngDevModeVariable = 'ngDevMode';
const filesWithNgDevMode = fs
.readdirSync(distPath)
.filter((p) => p.endsWith('.js'))
.filter((p) => fs.readFileSync(path.join(distPath, p), 'utf-8').includes(ngDevModeVariable));
if (filesWithNgDevMode.length > 0) {
throw new Error(
`Found '${ngDevModeVariable}' referenced in ${filesWithNgDevMode}. These references should be tree-shaken away!`,
);
} else {
console.log(`No '${ngDevModeVariable}' references found in ${distPath}`);
}