@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
20 lines (16 loc) • 655 B
text/typescript
import { readdirSync } from 'fs';
import { TargetOptions } from '@angular-builders/custom-webpack';
export default (targetOptions: TargetOptions, indexHtml: string) => {
const i = indexHtml.indexOf('</body>');
const bundlePath = '../../dist/packages/shell/bundle';
const files = readdirSync(bundlePath);
let insert = '';
for (const file of files) {
if (file.indexOf('msftsme.') === 0 || file.indexOf('vendor.') === 0) {
insert += `<script src="${file}" defer></script>`;
}
}
return `${indexHtml.slice(0, i)}
${insert}
${indexHtml.slice(i)}`;
};