MCPcopy Index your code
hub / github.com/angular/components / main

Function main

scripts/create-legacy-tests-bundle.mjs:43–73  ·  view source on GitHub ↗

* This script builds the whole library in `angular/components` together with its * spec files into a single IIFE bundle. * * The bundle can then be used in the legacy Saucelabs or Browserstack tests. Bundling * helps with running the Angular linker on framework packages, and also avoids unnecess

()

Source from the content-addressed store, hash-verified

41 * complexity with maintaining module resolution at runtime through e.g. SystemJS.
42 */
43async function main() {
44 // Wait for all Sass compilations to finish.
45 await compileSassFiles();
46
47 // Build the project with Ngtsc so that external resources are inlined.
48 await compileProjectWithNgtsc();
49
50 const specEntryPointFile = await createEntryPointSpecFile();
51
52 // Copy tsconfig so that ESBuild can leverage its path mappings.
53 const esbuildTsconfig = join(legacyOutputDir, 'tsconfig-esbuild.json');
54 await fs.promises.cp(join(packagesDir, 'bazel-tsconfig-build.json'), esbuildTsconfig);
55
56 const result = await esbuild.build({
57 bundle: true,
58 sourceRoot: projectDir,
59 platform: 'browser',
60 format: 'iife',
61 target: 'es2015',
62 outfile: outFile,
63 treeShaking: false,
64 logLevel: 'info',
65 tsconfig: esbuildTsconfig,
66 plugins: [createLinkerEsbuildPlugin()],
67 stdin: {contents: specEntryPointFile, resolveDir: projectDir},
68 });
69
70 if (result.errors.length) {
71 throw Error('Could not build legacy test bundle. See errors above.');
72 }
73}
74
75/**
76 * Compiles all non-partial Sass files in the project and writes them next

Callers 1

Calls 4

compileSassFilesFunction · 0.85
compileProjectWithNgtscFunction · 0.85
createEntryPointSpecFileFunction · 0.85

Tested by

no test coverage detected