_id
stringlengths 21
254
| text
stringlengths 1
93.7k
| metadata
dict |
---|---|---|
angular-cli/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html_5882_8043 | <div class="toolbar" role="banner">
<img
width="40"
alt="Angular Logo"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="
/>
<span>Welcome</span>
<div class="spacer"></div>
<a aria-label="Angular on twitter" target="_blank" rel="noopener" href="https://twitter.com/angular" title="Twitter">
<svg id="twitter-logo" height="24" data-name="Logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400">
<rect width="400" height="400" fill="none"/>
<path d="M153.62,301.59c94.34,0,145.94-78.16,145.94-145.94,0-2.22,0-4.43-.15-6.63A104.36,104.36,0,0,0,325,122.47a102.38,102.38,0,0,1-29.46,8.07,51.47,51.47,0,0,0,22.55-28.37,102.79,102.79,0,0,1-32.57,12.45,51.34,51.34,0,0,0-87.41,46.78A145.62,145.62,0,0,1,92.4,107.81a51.33,51.33,0,0,0,15.88,68.47A50.91,50.91,0,0,1,85,169.86c0,.21,0,.43,0,.65a51.31,51.31,0,0,0,41.15,50.28,51.21,51.21,0,0,1-23.16.88,51.35,51.35,0,0,0,47.92,35.62,102.92,102.92,0,0,1-63.7,22A104.41,104.41,0,0,1,75,278.55a145.21,145.21,0,0,0,78.62,23" fill="#fff"/>
</svg>
</a>
<a aria-label="Angular on YouTube" target="_blank" rel="noopener" href="https://youtube.com/angular" title="YouTube">
<svg id="youtube-logo" height="24" width="24" data-name="Logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff">
<path d="M0 0h24v24H0V0z" fill="none"/>
<path d="M21.58 7.19c-.23-.86-.91-1.54-1.77-1.77C18.25 5 12 5 12 5s-6.25 0-7.81.42c-.86.23-1.54.91-1.77 1.77C2 8.75 2 12 2 12s0 3.25.42 4.81c.23.86.91 1.54 1.77 1.77C5.75 19 12 19 12 19s6.25 0 7.81-.42c.86-.23 1.54-.91 1.77-1.77C22 15.25 22 12 22 12s0-3.25-.42-4.81zM10 15V9l5.2 3-5.2 3z"/>
</svg>
</a>
</div> | {
"end_byte": 8043,
"start_byte": 5882,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html_8045_9993 | <div class="content" role="main">
<!-- Highlight Card -->
<div class="card highlight-card card-small">
<svg id="rocket" xmlns="http://www.w3.org/2000/svg" width="101.678" height="101.678" viewBox="0 0 101.678 101.678">
<title>Rocket Ship</title>
<g id="Group_83" data-name="Group 83" transform="translate(-141 -696)">
<circle id="Ellipse_8" data-name="Ellipse 8" cx="50.839" cy="50.839" r="50.839" transform="translate(141 696)" fill="#dd0031"/>
<g id="Group_47" data-name="Group 47" transform="translate(165.185 720.185)">
<path id="Path_33" data-name="Path 33" d="M3.4,42.615a3.084,3.084,0,0,0,3.553,3.553,21.419,21.419,0,0,0,12.215-6.107L9.511,30.4A21.419,21.419,0,0,0,3.4,42.615Z" transform="translate(0.371 3.363)" fill="#fff"/>
<path id="Path_34" data-name="Path 34" d="M53.3,3.221A3.09,3.09,0,0,0,50.081,0,48.227,48.227,0,0,0,18.322,13.437c-6-1.666-14.991-1.221-18.322,7.218A33.892,33.892,0,0,1,9.439,25.1l-.333.666a3.013,3.013,0,0,0,.555,3.553L23.985,43.641a2.9,2.9,0,0,0,3.553.555l.666-.333A33.892,33.892,0,0,1,32.647,53.3c8.55-3.664,8.884-12.326,7.218-18.322A48.227,48.227,0,0,0,53.3,3.221ZM34.424,9.772a6.439,6.439,0,1,1,9.106,9.106,6.368,6.368,0,0,1-9.106,0A6.467,6.467,0,0,1,34.424,9.772Z" transform="translate(0 0.005)" fill="#fff"/>
</g>
</g>
</svg>
<h1>Hello, {{ title }}</h1>
<svg id="rocket-smoke" xmlns="http://www.w3.org/2000/svg" width="516.119" height="1083.632" viewBox="0 0 516.119 1083.632">
<title>Rocket Ship Smoke</title>
<path id="Path_40" data-name="Path 40" d="M644.6,141S143.02,215.537,147.049,870.207s342.774,201.755,342.774,201.755S404.659,847.213,388.815,762.2c-27.116-145.51-11.551-384.124,271.9-609.1C671.15,139.365,644.6,141,644.6,141Z" transform="translate(-147.025 -140.939)" fill="#f5f5f5"/>
</svg>
</div>
<!-- Resources -->
<h2>Resources</h2>
<p>Here are some links to help you get started:</p> | {
"end_byte": 9993,
"start_byte": 8045,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html_9997_13722 | <div class="card-container">
<a class="card" target="_blank" rel="noopener" href="https://angular.dev/tutorials/learn-angular">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M5 13.18v4L12 21l7-3.82v-4L12 17l-7-3.82zM12 3L1 9l11 6 9-4.91V17h2V9L12 3z"/></svg>
<span>Learn Angular</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg> </a>
<a class="card" target="_blank" rel="noopener" href="https://angular.dev/tools/cli">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/></svg>
<span>CLI Documentation</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
</a>
<a class="card" target="_blank" rel="noopener" href="https://material.angular.io">
<svg xmlns="http://www.w3.org/2000/svg" style="margin-right: 8px" width="21.813" height="23.453" viewBox="0 0 179.2 192.7"><path fill="#ffa726" d="M89.4 0 0 32l13.5 118.4 75.9 42.3 76-42.3L179.2 32 89.4 0z"/><path fill="#fb8c00" d="M89.4 0v192.7l76-42.3L179.2 32 89.4 0z"/><path fill="#ffe0b2" d="m102.9 146.3-63.3-30.5 36.3-22.4 63.7 30.6-36.7 22.3z"/><path fill="#fff3e0" d="M102.9 122.8 39.6 92.2l36.3-22.3 63.7 30.6-36.7 22.3z"/><path fill="#fff" d="M102.9 99.3 39.6 68.7l36.3-22.4 63.7 30.6-36.7 22.4z"/></svg>
<span>Angular Material</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
</a>
<a class="card" target="_blank" rel="noopener" href="https://blog.angular.dev">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M13.5.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 17.41 3.8 13.5.67zM11.71 19c-1.78 0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 1.77-.36 3.6-1.21 4.62-2.58.39 1.29.59 2.65.59 4.04 0 2.65-2.15 4.8-4.8 4.8z"/></svg>
<span>Angular Blog</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
</a>
<a class="card" target="_blank" rel="noopener" href="https://angular.dev/tools/devtools">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><g><path d="M14.73,13.31C15.52,12.24,16,10.93,16,9.5C16,5.91,13.09,3,9.5,3S3,5.91,3,9.5C3,13.09,5.91,16,9.5,16 c1.43,0,2.74-0.48,3.81-1.27L19.59,21L21,19.59L14.73,13.31z M9.5,14C7.01,14,5,11.99,5,9.5S7.01,5,9.5,5S14,7.01,14,9.5 S11.99,14,9.5,14z"/><polygon points="10.29,8.44 9.5,6 8.71,8.44 6.25,8.44 8.26,10.03 7.49,12.5 9.5,10.97 11.51,12.5 10.74,10.03 12.75,8.44"/></g></g></svg>
<span>Angular DevTools</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
</a>
</div>
<!-- Next Steps -->
<h2>Next Steps</h2>
<p>What do you want to do next with your app?</p>
<input type="hidden" #selection>
| {
"end_byte": 13722,
"start_byte": 9997,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html_13722_16064 | <div class="card-container">
<button class="card card-small" (click)="selection.value = 'component'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>New Component</span>
</button>
<button class="card card-small" (click)="selection.value = 'material'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Angular Material</span>
</button>
<button class="card card-small" (click)="selection.value = 'pwa'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Add PWA Support</span>
</button>
<button class="card card-small" (click)="selection.value = 'dependency'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Add Dependency</span>
</button>
<button class="card card-small" (click)="selection.value = 'test'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Run and Watch Tests</span>
</button>
<button class="card card-small" (click)="selection.value = 'build'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Build for Production</span>
</button>
</div>
<!-- Terminal -->
<div class="terminal" [ngSwitch]="selection.value">
<pre *ngSwitchDefault>ng generate component xyz</pre>
<pre *ngSwitchCase="'material'">ng add @angular/material</pre>
<pre *ngSwitchCase="'pwa'">ng add @angular/pwa</pre>
<pre *ngSwitchCase="'dependency'">ng add _____</pre>
<pre *ngSwitchCase="'test'">ng test</pre>
<pre *ngSwitchCase="'build'">ng build</pre>
</div>
<!-- Links -->
<div class="card-container"> | {
"end_byte": 16064,
"start_byte": 13722,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html_16069_19252 | <a class="circle-link" title="Find a Local Meetup" href="https://www.meetup.com/find/?keywords=angular" target="_blank" rel="noopener">
<svg xmlns="http://www.w3.org/2000/svg" width="24.607" height="23.447" viewBox="0 0 24.607 23.447">
<title>Meetup Logo</title>
<path id="logo--mSwarm" d="M21.221,14.95A4.393,4.393,0,0,1,17.6,19.281a4.452,4.452,0,0,1-.8.069c-.09,0-.125.035-.154.117a2.939,2.939,0,0,1-2.506,2.091,2.868,2.868,0,0,1-2.248-.624.168.168,0,0,0-.245-.005,3.926,3.926,0,0,1-2.589.741,4.015,4.015,0,0,1-3.7-3.347,2.7,2.7,0,0,1-.043-.38c0-.106-.042-.146-.143-.166a3.524,3.524,0,0,1-1.516-.69A3.623,3.623,0,0,1,2.23,14.557a3.66,3.66,0,0,1,1.077-3.085.138.138,0,0,0,.026-.2,3.348,3.348,0,0,1-.451-1.821,3.46,3.46,0,0,1,2.749-3.28.44.44,0,0,0,.355-.281,5.072,5.072,0,0,1,3.863-3,5.028,5.028,0,0,1,3.555.666.31.31,0,0,0,.271.03A4.5,4.5,0,0,1,18.3,4.7a4.4,4.4,0,0,1,1.334,2.751,3.658,3.658,0,0,1,.022.706.131.131,0,0,0,.1.157,2.432,2.432,0,0,1,1.574,1.645,2.464,2.464,0,0,1-.7,2.616c-.065.064-.051.1-.014.166A4.321,4.321,0,0,1,21.221,14.95ZM13.4,14.607a2.09,2.09,0,0,0,1.409,1.982,4.7,4.7,0,0,0,1.275.221,1.807,1.807,0,0,0,.9-.151.542.542,0,0,0,.321-.545.558.558,0,0,0-.359-.534,1.2,1.2,0,0,0-.254-.078c-.262-.047-.526-.086-.787-.138a.674.674,0,0,1-.617-.75,3.394,3.394,0,0,1,.218-1.109c.217-.658.509-1.286.79-1.918a15.609,15.609,0,0,0,.745-1.86,1.95,1.95,0,0,0,.06-1.073,1.286,1.286,0,0,0-1.051-1.033,1.977,1.977,0,0,0-1.521.2.339.339,0,0,1-.446-.042c-.1-.092-.2-.189-.307-.284a1.214,1.214,0,0,0-1.643-.061,7.563,7.563,0,0,1-.614.512A.588.588,0,0,1,10.883,8c-.215-.115-.437-.215-.659-.316a2.153,2.153,0,0,0-.695-.248A2.091,2.091,0,0,0,7.541,8.562a9.915,9.915,0,0,0-.405.986c-.559,1.545-1.015,3.123-1.487,4.7a1.528,1.528,0,0,0,.634,1.777,1.755,1.755,0,0,0,1.5.211,1.35,1.35,0,0,0,.824-.858c.543-1.281,1.032-2.584,1.55-3.875.142-.355.28-.712.432-1.064a.548.548,0,0,1,.851-.24.622.622,0,0,1,.185.539,2.161,2.161,0,0,1-.181.621c-.337.852-.68,1.7-1.018,2.552a2.564,2.564,0,0,0-.173.528.624.624,0,0,0,.333.71,1.073,1.073,0,0,0,.814.034,1.22,1.22,0,0,0,.657-.655q.758-1.488,1.511-2.978.35-.687.709-1.37a1.073,1.073,0,0,1,.357-.434.43.43,0,0,1,.463-.016.373.373,0,0,1,.153.387.7.7,0,0,1-.057.236c-.065.157-.127.316-.2.469-.42.883-.846,1.763-1.262,2.648A2.463,2.463,0,0,0,13.4,14.607Zm5.888,6.508a1.09,1.09,0,0,0-2.179.006,1.09,1.09,0,0,0,2.179-.006ZM1.028,12.139a1.038,1.038,0,1,0,.01-2.075,1.038,1.038,0,0,0-.01,2.075ZM13.782.528a1.027,1.027,0,1,0-.011,2.055A1.027,1.027,0,0,0,13.782.528ZM22.21,6.95a.882.882,0,0,0-1.763.011A.882.882,0,0,0,22.21,6.95ZM4.153,4.439a.785.785,0,1,0,.787-.78A.766.766,0,0,0,4.153,4.439Zm8.221,18.22a.676.676,0,1,0-.677.666A.671.671,0,0,0,12.374,22.658ZM22.872,12.2a.674.674,0,0,0-.665.665.656.656,0,0,0,.655.643.634.634,0,0,0,.655-.644A.654.654,0,0,0,22.872,12.2ZM7.171-.123A.546.546,0,0,0,6.613.43a.553.553,0,1,0,1.106,0A.539.539,0,0,0,7.171-.123ZM24.119,9.234a.507.507,0,0,0-.493.488.494.494,0,0,0,.494.494.48.48,0,0,0,.487-.483A.491.491,0,0,0,24.119,9.234Zm-19.454,9.7a.5.5,0,0,0-.488-.488.491.491,0,0,0-.487.5.483.483,0,0,0,.491.479A.49.49,0,0,0,4.665,18.936Z" transform="translate(0 0.123)" fill="#f64060"/>
</svg>
</a> | {
"end_byte": 19252,
"start_byte": 16069,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html_19258_22671 | <a class="circle-link" title="Join the Conversation on Discord" href="https://discord.gg/angular" target="_blank" rel="noopener">
<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 245 240">
<title>Discord Logo</title>
<path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zM140.9 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/>
<path d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/>
</svg>
</a>
</div>
<!-- Footer -->
<footer>
Love Angular?
<a href="https://github.com/angular/angular" target="_blank" rel="noopener"> Give our repo a star.
<div class="github-star-badge">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/></svg>
Star
</div>
</a>
<a href="https://github.com/angular/angular" target="_blank" rel="noopener">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" fill="#1976d2"/><path d="M0 0h24v24H0z" fill="none"/></svg>
</a>
</footer>
<svg id="clouds" xmlns="http://www.w3.org/2000/svg" width="2611.084" height="485.677" viewBox="0 0 2611.084 485.677">
<title>Gray Clouds Background</title>
<path id="Path_39" data-name="Path 39" d="M2379.709,863.793c10-93-77-171-168-149-52-114-225-105-264,15-75,3-140,59-152,133-30,2.83-66.725,9.829-93.5,26.25-26.771-16.421-63.5-23.42-93.5-26.25-12-74-77-130-152-133-39-120-212-129-264-15-54.084-13.075-106.753,9.173-138.488,48.9-31.734-39.726-84.4-61.974-138.487-48.9-52-114-225-105-264,15a162.027,162.027,0,0,0-103.147,43.044c-30.633-45.365-87.1-72.091-145.206-58.044-52-114-225-105-264,15-75,3-140,59-152,133-53,5-127,23-130,83-2,42,35,72,70,86,49,20,106,18,157,5a165.625,165.625,0,0,0,120,0c47,94,178,113,251,33,61.112,8.015,113.854-5.72,150.492-29.764a165.62,165.62,0,0,0,110.861-3.236c47,94,178,113,251,33,31.385,4.116,60.563,2.495,86.487-3.311,25.924,5.806,55.1,7.427,86.488,3.311,73,80,204,61,251-33a165.625,165.625,0,0,0,120,0c51,13,108,15,157-5a147.188,147.188,0,0,0,33.5-18.694,147.217,147.217,0,0,0,33.5,18.694c49,20,106,18,157,5a165.625,165.625,0,0,0,120,0c47,94,178,113,251,33C2446.709,1093.793,2554.709,922.793,2379.709,863.793Z" transform="translate(142.69 -634.312)" fill="#eee"/>
</svg>
</div>
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --> | {
"end_byte": 22671,
"start_byte": 19258,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html_22672_23130 | <!-- * * * * * * * * * * * The content above * * * * * * * * * * * -->
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<router-outlet></router-outlet> | {
"end_byte": 23130,
"start_byte": 22672,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/15.0-project/src/app/app-routing.module.ts_0_245 | import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
| {
"end_byte": 245,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/15.0-project/src/app/app-routing.module.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.spec.ts_0_1070 | import { TestBed } from '@angular/core/testing';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterModule.forRoot([])
],
declarations: [
AppComponent
],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'fifteen-project'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('fifteen-project');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, fifteen-project');
});
});
| {
"end_byte": 1070,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.spec.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.module.ts_0_393 | import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
| {
"end_byte": 393,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.module.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.ts_0_219 | import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'fifteen-project';
}
| {
"end_byte": 219,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/add-collection-peer-good/index.js_0_96 | exports.default = (options) => tree => tree.create(options.name || 'empty-file-peer-good', '');
| {
"end_byte": 96,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/add-collection-peer-good/index.js"
} |
angular-cli/tests/legacy-cli/e2e/assets/schematic-boolean-option-negated/index.js_0_53 | exports.default = (options) => console.log(options);
| {
"end_byte": 53,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/schematic-boolean-option-negated/index.js"
} |
angular-cli/tests/legacy-cli/e2e/assets/add-collection-peer-bad/index.js_0_95 | exports.default = (options) => tree => tree.create(options.name || 'empty-file-peer-bad', '');
| {
"end_byte": 95,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/add-collection-peer-bad/index.js"
} |
angular-cli/tests/legacy-cli/e2e/assets/schematic-allow-scripts/index.js_0_710 | const tasks = require("@angular-devkit/schematics/tasks");
exports.default = ({ allowScripts, ignoreScripts = false }) => {
return (tree, context) => {
tree.create('/install-test/package.json', JSON.stringify({
name: 'install-test',
version: '0.0.0',
scripts: {
postinstall: `node run-post.js`,
}
}));
tree.create('/install-test/.npmrc', `ignore-scripts=${ignoreScripts}`);
tree.create('/install-test/run-post.js', 'require("fs").writeFileSync(__dirname + "/post-script-ran", "12345");')
context.addTask(new tasks.NodePackageInstallTask({ workingDirectory: 'install-test', allowScripts }));
};
};
| {
"end_byte": 710,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/schematic-allow-scripts/index.js"
} |
angular-cli/tests/legacy-cli/e2e/assets/nested-schematic-main/index.js_0_122 | exports.default = (options) => require("@angular-devkit/schematics").externalSchematic('empty-app-nested', 'nested', {});
| {
"end_byte": 122,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/nested-schematic-main/index.js"
} |
angular-cli/tests/legacy-cli/e2e/assets/add-collection/index.js_0_86 | exports.default = (options) => tree => tree.create(options.name || 'empty-file', '');
| {
"end_byte": 86,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/add-collection/index.js"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/README.md_0_1112 | # 17SsrProjectWebpack
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.2.10.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate --help` to see all the available schematics you can generate.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview](https://angular.dev/tools/cli) and [Command Reference](https://angular.dev/cli) pages.
| {
"end_byte": 1112,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/README.md"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/server.ts_0_2233 | import 'zone.js/node';
import { APP_BASE_HREF } from '@angular/common';
import { CommonEngine } from '@angular/ssr';
import * as express from 'express';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import AppServerModule from './src/main.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const distFolder = join(process.cwd(), 'dist/18-ssr-project-webpack/browser');
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
? join(distFolder, 'index.original.html')
: join(distFolder, 'index.html');
const commonEngine = new CommonEngine();
server.set('view engine', 'html');
server.set('views', distFolder);
// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get('*.*', express.static(distFolder, {
maxAge: '1y'
}));
// All regular routes use the Angular engine
server.get('*', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;
commonEngine
.render({
bootstrap: AppServerModule,
documentFilePath: indexHtml,
url: `${protocol}://${headers.host}${originalUrl}`,
publicPath: distFolder,
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
})
.then((html) => res.send(html))
.catch((err) => next(err));
});
return server;
}
function run(): void {
const port = process.env['PORT'] || 4000;
// Start up the Node server
const server = app();
server.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
});
}
// Webpack will replace 'require' with '__webpack_require__'
// '__non_webpack_require__' is a proxy to Node 'require'
// The below code is to ensure that the server is run only when not requiring the bundle.
declare const __non_webpack_require__: NodeRequire;
const mainModule = __non_webpack_require__.main;
const moduleFilename = mainModule && mainModule.filename || '';
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
run();
}
export default AppServerModule;
| {
"end_byte": 2233,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/server.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/index.html_0_305 | <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>17SsrProjectWebpack</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
| {
"end_byte": 305,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/index.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/main.ts_0_214 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
| {
"end_byte": 214,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/main.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/styles.css_0_80 | /* You can add global styles to this file, and also import other style files */
| {
"end_byte": 80,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/styles.css"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/main.server.ts_0_70 | export { AppServerModule as default } from './app/app.module.server';
| {
"end_byte": 70,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/main.server.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html_0_572 | <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * * * The content below * * * * * * * * * * * -->
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * Delete the template below * * * * * * * * * * -->
<!-- * * * * * * * to get started with your project! * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --> | {
"end_byte": 572,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html_574_5881 | <style>
:host {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 14px;
color: #333;
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 8px 0;
}
p {
margin: 0;
}
.spacer {
flex: 1;
}
.toolbar {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 60px;
display: flex;
align-items: center;
background-color: #1976d2;
color: white;
font-weight: 600;
}
.toolbar img {
margin: 0 16px;
}
.toolbar #twitter-logo {
height: 40px;
margin: 0 8px;
}
.toolbar #youtube-logo {
height: 40px;
margin: 0 16px;
}
.toolbar #twitter-logo:hover,
.toolbar #youtube-logo:hover {
opacity: 0.8;
}
.content {
display: flex;
margin: 82px auto 32px;
padding: 0 16px;
max-width: 960px;
flex-direction: column;
align-items: center;
}
svg.material-icons {
height: 24px;
width: auto;
}
svg.material-icons:not(:last-child) {
margin-right: 8px;
}
.card svg.material-icons path {
fill: #888;
}
.card-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-top: 16px;
}
.card {
all: unset;
border-radius: 4px;
border: 1px solid #eee;
background-color: #fafafa;
height: 40px;
width: 200px;
margin: 0 8px 16px;
padding: 16px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
transition: all 0.2s ease-in-out;
line-height: 24px;
}
.card-container .card:not(:last-child) {
margin-right: 0;
}
.card.card-small {
height: 16px;
width: 168px;
}
.card-container .card:not(.highlight-card) {
cursor: pointer;
}
.card-container .card:not(.highlight-card):hover {
transform: translateY(-3px);
box-shadow: 0 4px 17px rgba(0, 0, 0, 0.35);
}
.card-container .card:not(.highlight-card):hover .material-icons path {
fill: rgb(105, 103, 103);
}
.card.highlight-card {
background-color: #1976d2;
color: white;
font-weight: 600;
border: none;
width: auto;
min-width: 30%;
position: relative;
}
.card.card.highlight-card span {
margin-left: 60px;
}
svg#rocket {
width: 80px;
position: absolute;
left: -10px;
top: -24px;
}
svg#rocket-smoke {
height: calc(100vh - 95px);
position: absolute;
top: 10px;
right: 180px;
z-index: -10;
}
a,
a:visited,
a:hover {
color: #1976d2;
text-decoration: none;
}
a:hover {
color: #125699;
}
.terminal {
position: relative;
width: 80%;
max-width: 600px;
border-radius: 6px;
padding-top: 45px;
margin-top: 8px;
overflow: hidden;
background-color: rgb(15, 15, 16);
}
.terminal::before {
content: "\2022 \2022 \2022";
position: absolute;
top: 0;
left: 0;
height: 4px;
background: rgb(58, 58, 58);
color: #c2c3c4;
width: 100%;
font-size: 2rem;
line-height: 0;
padding: 14px 0;
text-indent: 4px;
}
.terminal pre {
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
color: white;
padding: 0 1rem 1rem;
margin: 0;
}
.circle-link {
height: 40px;
width: 40px;
border-radius: 40px;
margin: 8px;
background-color: white;
border: 1px solid #eeeeee;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
transition: 1s ease-out;
}
.circle-link:hover {
transform: translateY(-0.25rem);
box-shadow: 0px 3px 15px rgba(0, 0, 0, 0.2);
}
footer {
margin-top: 8px;
display: flex;
align-items: center;
line-height: 20px;
}
footer a {
display: flex;
align-items: center;
}
.github-star-badge {
color: #24292e;
display: flex;
align-items: center;
font-size: 12px;
padding: 3px 10px;
border: 1px solid rgba(27,31,35,.2);
border-radius: 3px;
background-image: linear-gradient(-180deg,#fafbfc,#eff3f6 90%);
margin-left: 4px;
font-weight: 600;
}
.github-star-badge:hover {
background-image: linear-gradient(-180deg,#f0f3f6,#e6ebf1 90%);
border-color: rgba(27,31,35,.35);
background-position: -.5em;
}
.github-star-badge .material-icons {
height: 16px;
width: 16px;
margin-right: 4px;
}
svg#clouds {
position: fixed;
bottom: -160px;
left: -230px;
z-index: -10;
width: 1920px;
}
/* Responsive Styles */
@media screen and (max-width: 767px) {
.card-container > *:not(.circle-link) ,
.terminal {
width: 100%;
}
.card:not(.highlight-card) {
height: 16px;
margin: 8px 0;
}
.card.highlight-card span {
margin-left: 72px;
}
svg#rocket-smoke {
right: 120px;
transform: rotate(-5deg);
}
}
@media screen and (max-width: 575px) {
svg#rocket-smoke {
display: none;
visibility: hidden;
}
}
</style>
<!-- Toolbar --> | {
"end_byte": 5881,
"start_byte": 574,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html_5882_9600 | <div class="toolbar" role="banner">
<img
width="40"
alt="Angular Logo"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="
/>
<span>Welcome</span>
<div class="spacer"></div>
<a aria-label="Angular on X" target="_blank" rel="noopener" href="https://twitter.com/angular" title="X">
<svg id="twitter-logo" xmlns="http://www.w3.org/2000/svg" height="24" width="24" data-name="Logo" viewBox="0 0 512 512" fill="#fff">
<path d="M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z"/>
</svg>
</a>
<a aria-label="Angular on YouTube" target="_blank" rel="noopener" href="https://youtube.com/angular" title="YouTube">
<svg id="youtube-logo" height="24" width="24" data-name="Logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff">
<path d="M0 0h24v24H0V0z" fill="none"/>
<path d="M21.58 7.19c-.23-.86-.91-1.54-1.77-1.77C18.25 5 12 5 12 5s-6.25 0-7.81.42c-.86.23-1.54.91-1.77 1.77C2 8.75 2 12 2 12s0 3.25.42 4.81c.23.86.91 1.54 1.77 1.77C5.75 19 12 19 12 19s6.25 0 7.81-.42c.86-.23 1.54-.91 1.77-1.77C22 15.25 22 12 22 12s0-3.25-.42-4.81zM10 15V9l5.2 3-5.2 3z"/>
</svg>
</a>
</div>
<div class="content" role="main">
<!-- Highlight Card -->
<div class="card highlight-card card-small">
<svg id="rocket" xmlns="http://www.w3.org/2000/svg" width="101.678" height="101.678" viewBox="0 0 101.678 101.678">
<title>Rocket Ship</title>
<g id="Group_83" data-name="Group 83" transform="translate(-141 -696)">
<circle id="Ellipse_8" data-name="Ellipse 8" cx="50.839" cy="50.839" r="50.839" transform="translate(141 696)" fill="#dd0031"/>
<g id="Group_47" data-name="Group 47" transform="translate(165.185 720.185)">
<path id="Path_33" data-name="Path 33" d="M3.4,42.615a3.084,3.084,0,0,0,3.553,3.553,21.419,21.419,0,0,0,12.215-6.107L9.511,30.4A21.419,21.419,0,0,0,3.4,42.615Z" transform="translate(0.371 3.363)" fill="#fff"/>
<path id="Path_34" data-name="Path 34" d="M53.3,3.221A3.09,3.09,0,0,0,50.081,0,48.227,48.227,0,0,0,18.322,13.437c-6-1.666-14.991-1.221-18.322,7.218A33.892,33.892,0,0,1,9.439,25.1l-.333.666a3.013,3.013,0,0,0,.555,3.553L23.985,43.641a2.9,2.9,0,0,0,3.553.555l.666-.333A33.892,33.892,0,0,1,32.647,53.3c8.55-3.664,8.884-12.326,7.218-18.322A48.227,48.227,0,0,0,53.3,3.221ZM34.424,9.772a6.439,6.439,0,1,1,9.106,9.106,6.368,6.368,0,0,1-9.106,0A6.467,6.467,0,0,1,34.424,9.772Z" transform="translate(0 0.005)" fill="#fff"/>
</g>
</g>
</svg>
<span>{{ title }} app is running!</span>
<svg id="rocket-smoke" xmlns="http://www.w3.org/2000/svg" width="516.119" height="1083.632" viewBox="0 0 516.119 1083.632">
<title>Rocket Ship Smoke</title>
<path id="Path_40" data-name="Path 40" d="M644.6,141S143.02,215.537,147.049,870.207s342.774,201.755,342.774,201.755S404.659,847.213,388.815,762.2c-27.116-145.51-11.551-384.124,271.9-609.1C671.15,139.365,644.6,141,644.6,141Z" transform="translate(-147.025 -140.939)" fill="#f5f5f5"/>
</svg>
</div>
<!-- Resources -->
<h2>Resources</h2>
<p>Here are some links to help you get started:</p> | {
"end_byte": 9600,
"start_byte": 5882,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html_9604_13329 | <div class="card-container">
<a class="card" target="_blank" rel="noopener" href="https://angular.dev/tutorials/learn-angular">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M5 13.18v4L12 21l7-3.82v-4L12 17l-7-3.82zM12 3L1 9l11 6 9-4.91V17h2V9L12 3z"/></svg>
<span>Learn Angular</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg> </a>
<a class="card" target="_blank" rel="noopener" href="https://angular.dev/tools/cli">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/></svg>
<span>CLI Documentation</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
</a>
<a class="card" target="_blank" rel="noopener" href="https://material.angular.io">
<svg xmlns="http://www.w3.org/2000/svg" style="margin-right: 8px" width="21.813" height="23.453" viewBox="0 0 179.2 192.7"><path fill="#ffa726" d="M89.4 0 0 32l13.5 118.4 75.9 42.3 76-42.3L179.2 32 89.4 0z"/><path fill="#fb8c00" d="M89.4 0v192.7l76-42.3L179.2 32 89.4 0z"/><path fill="#ffe0b2" d="m102.9 146.3-63.3-30.5 36.3-22.4 63.7 30.6-36.7 22.3z"/><path fill="#fff3e0" d="M102.9 122.8 39.6 92.2l36.3-22.3 63.7 30.6-36.7 22.3z"/><path fill="#fff" d="M102.9 99.3 39.6 68.7l36.3-22.4 63.7 30.6-36.7 22.4z"/></svg>
<span>Angular Material</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
</a>
<a class="card" target="_blank" rel="noopener" href="https://blog.angular.dev">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M13.5.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 17.41 3.8 13.5.67zM11.71 19c-1.78 0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 1.77-.36 3.6-1.21 4.62-2.58.39 1.29.59 2.65.59 4.04 0 2.65-2.15 4.8-4.8 4.8z"/></svg>
<span>Angular Blog</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
</a>
<a class="card" target="_blank" rel="noopener" href="https://angular.dev/tools/devtools">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><g><path d="M14.73,13.31C15.52,12.24,16,10.93,16,9.5C16,5.91,13.09,3,9.5,3S3,5.91,3,9.5C3,13.09,5.91,16,9.5,16 c1.43,0,2.74-0.48,3.81-1.27L19.59,21L21,19.59L14.73,13.31z M9.5,14C7.01,14,5,11.99,5,9.5S7.01,5,9.5,5S14,7.01,14,9.5 S11.99,14,9.5,14z"/><polygon points="10.29,8.44 9.5,6 8.71,8.44 6.25,8.44 8.26,10.03 7.49,12.5 9.5,10.97 11.51,12.5 10.74,10.03 12.75,8.44"/></g></g></svg>
<span>Angular DevTools</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
</a>
</div>
<!-- Next Steps -->
<h2>Next Steps</h2>
<p>What do you want to do next with your app?</p>
<input type="hidden" #selection>
| {
"end_byte": 13329,
"start_byte": 9604,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html_13329_15679 | <div class="card-container">
<button class="card card-small" (click)="selection.value = 'component'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>New Component</span>
</button>
<button class="card card-small" (click)="selection.value = 'material'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Angular Material</span>
</button>
<button class="card card-small" (click)="selection.value = 'pwa'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Add PWA Support</span>
</button>
<button class="card card-small" (click)="selection.value = 'dependency'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Add Dependency</span>
</button>
<button class="card card-small" (click)="selection.value = 'test'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Run and Watch Tests</span>
</button>
<button class="card card-small" (click)="selection.value = 'build'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Build for Production</span>
</button>
</div>
<!-- Terminal -->
<div class="terminal" [ngSwitch]="selection.value">
<pre *ngSwitchDefault>ng generate component xyz</pre>
<pre *ngSwitchCase="'material'">ng add @angular/material</pre>
<pre *ngSwitchCase="'pwa'">ng add @angular/pwa</pre>
<pre *ngSwitchCase="'dependency'">ng add _____</pre>
<pre *ngSwitchCase="'test'">ng test</pre>
<pre *ngSwitchCase="'build'">ng build</pre>
</div>
<!-- Links -->
<div class="card-container"> | {
"end_byte": 15679,
"start_byte": 13329,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html_15684_18867 | <a class="circle-link" title="Find a Local Meetup" href="https://www.meetup.com/find/?keywords=angular" target="_blank" rel="noopener">
<svg xmlns="http://www.w3.org/2000/svg" width="24.607" height="23.447" viewBox="0 0 24.607 23.447">
<title>Meetup Logo</title>
<path id="logo--mSwarm" d="M21.221,14.95A4.393,4.393,0,0,1,17.6,19.281a4.452,4.452,0,0,1-.8.069c-.09,0-.125.035-.154.117a2.939,2.939,0,0,1-2.506,2.091,2.868,2.868,0,0,1-2.248-.624.168.168,0,0,0-.245-.005,3.926,3.926,0,0,1-2.589.741,4.015,4.015,0,0,1-3.7-3.347,2.7,2.7,0,0,1-.043-.38c0-.106-.042-.146-.143-.166a3.524,3.524,0,0,1-1.516-.69A3.623,3.623,0,0,1,2.23,14.557a3.66,3.66,0,0,1,1.077-3.085.138.138,0,0,0,.026-.2,3.348,3.348,0,0,1-.451-1.821,3.46,3.46,0,0,1,2.749-3.28.44.44,0,0,0,.355-.281,5.072,5.072,0,0,1,3.863-3,5.028,5.028,0,0,1,3.555.666.31.31,0,0,0,.271.03A4.5,4.5,0,0,1,18.3,4.7a4.4,4.4,0,0,1,1.334,2.751,3.658,3.658,0,0,1,.022.706.131.131,0,0,0,.1.157,2.432,2.432,0,0,1,1.574,1.645,2.464,2.464,0,0,1-.7,2.616c-.065.064-.051.1-.014.166A4.321,4.321,0,0,1,21.221,14.95ZM13.4,14.607a2.09,2.09,0,0,0,1.409,1.982,4.7,4.7,0,0,0,1.275.221,1.807,1.807,0,0,0,.9-.151.542.542,0,0,0,.321-.545.558.558,0,0,0-.359-.534,1.2,1.2,0,0,0-.254-.078c-.262-.047-.526-.086-.787-.138a.674.674,0,0,1-.617-.75,3.394,3.394,0,0,1,.218-1.109c.217-.658.509-1.286.79-1.918a15.609,15.609,0,0,0,.745-1.86,1.95,1.95,0,0,0,.06-1.073,1.286,1.286,0,0,0-1.051-1.033,1.977,1.977,0,0,0-1.521.2.339.339,0,0,1-.446-.042c-.1-.092-.2-.189-.307-.284a1.214,1.214,0,0,0-1.643-.061,7.563,7.563,0,0,1-.614.512A.588.588,0,0,1,10.883,8c-.215-.115-.437-.215-.659-.316a2.153,2.153,0,0,0-.695-.248A2.091,2.091,0,0,0,7.541,8.562a9.915,9.915,0,0,0-.405.986c-.559,1.545-1.015,3.123-1.487,4.7a1.528,1.528,0,0,0,.634,1.777,1.755,1.755,0,0,0,1.5.211,1.35,1.35,0,0,0,.824-.858c.543-1.281,1.032-2.584,1.55-3.875.142-.355.28-.712.432-1.064a.548.548,0,0,1,.851-.24.622.622,0,0,1,.185.539,2.161,2.161,0,0,1-.181.621c-.337.852-.68,1.7-1.018,2.552a2.564,2.564,0,0,0-.173.528.624.624,0,0,0,.333.71,1.073,1.073,0,0,0,.814.034,1.22,1.22,0,0,0,.657-.655q.758-1.488,1.511-2.978.35-.687.709-1.37a1.073,1.073,0,0,1,.357-.434.43.43,0,0,1,.463-.016.373.373,0,0,1,.153.387.7.7,0,0,1-.057.236c-.065.157-.127.316-.2.469-.42.883-.846,1.763-1.262,2.648A2.463,2.463,0,0,0,13.4,14.607Zm5.888,6.508a1.09,1.09,0,0,0-2.179.006,1.09,1.09,0,0,0,2.179-.006ZM1.028,12.139a1.038,1.038,0,1,0,.01-2.075,1.038,1.038,0,0,0-.01,2.075ZM13.782.528a1.027,1.027,0,1,0-.011,2.055A1.027,1.027,0,0,0,13.782.528ZM22.21,6.95a.882.882,0,0,0-1.763.011A.882.882,0,0,0,22.21,6.95ZM4.153,4.439a.785.785,0,1,0,.787-.78A.766.766,0,0,0,4.153,4.439Zm8.221,18.22a.676.676,0,1,0-.677.666A.671.671,0,0,0,12.374,22.658ZM22.872,12.2a.674.674,0,0,0-.665.665.656.656,0,0,0,.655.643.634.634,0,0,0,.655-.644A.654.654,0,0,0,22.872,12.2ZM7.171-.123A.546.546,0,0,0,6.613.43a.553.553,0,1,0,1.106,0A.539.539,0,0,0,7.171-.123ZM24.119,9.234a.507.507,0,0,0-.493.488.494.494,0,0,0,.494.494.48.48,0,0,0,.487-.483A.491.491,0,0,0,24.119,9.234Zm-19.454,9.7a.5.5,0,0,0-.488-.488.491.491,0,0,0-.487.5.483.483,0,0,0,.491.479A.49.49,0,0,0,4.665,18.936Z" transform="translate(0 0.123)" fill="#f64060"/>
</svg>
</a> | {
"end_byte": 18867,
"start_byte": 15684,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html_18873_22286 | <a class="circle-link" title="Join the Conversation on Discord" href="https://discord.gg/angular" target="_blank" rel="noopener">
<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 245 240">
<title>Discord Logo</title>
<path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zM140.9 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/>
<path d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/>
</svg>
</a>
</div>
<!-- Footer -->
<footer>
Love Angular?
<a href="https://github.com/angular/angular" target="_blank" rel="noopener"> Give our repo a star.
<div class="github-star-badge">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/></svg>
Star
</div>
</a>
<a href="https://github.com/angular/angular" target="_blank" rel="noopener">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" fill="#1976d2"/><path d="M0 0h24v24H0z" fill="none"/></svg>
</a>
</footer>
<svg id="clouds" xmlns="http://www.w3.org/2000/svg" width="2611.084" height="485.677" viewBox="0 0 2611.084 485.677">
<title>Gray Clouds Background</title>
<path id="Path_39" data-name="Path 39" d="M2379.709,863.793c10-93-77-171-168-149-52-114-225-105-264,15-75,3-140,59-152,133-30,2.83-66.725,9.829-93.5,26.25-26.771-16.421-63.5-23.42-93.5-26.25-12-74-77-130-152-133-39-120-212-129-264-15-54.084-13.075-106.753,9.173-138.488,48.9-31.734-39.726-84.4-61.974-138.487-48.9-52-114-225-105-264,15a162.027,162.027,0,0,0-103.147,43.044c-30.633-45.365-87.1-72.091-145.206-58.044-52-114-225-105-264,15-75,3-140,59-152,133-53,5-127,23-130,83-2,42,35,72,70,86,49,20,106,18,157,5a165.625,165.625,0,0,0,120,0c47,94,178,113,251,33,61.112,8.015,113.854-5.72,150.492-29.764a165.62,165.62,0,0,0,110.861-3.236c47,94,178,113,251,33,31.385,4.116,60.563,2.495,86.487-3.311,25.924,5.806,55.1,7.427,86.488,3.311,73,80,204,61,251-33a165.625,165.625,0,0,0,120,0c51,13,108,15,157-5a147.188,147.188,0,0,0,33.5-18.694,147.217,147.217,0,0,0,33.5,18.694c49,20,106,18,157,5a165.625,165.625,0,0,0,120,0c47,94,178,113,251,33C2446.709,1093.793,2554.709,922.793,2379.709,863.793Z" transform="translate(142.69 -634.312)" fill="#eee"/>
</svg>
</div>
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --> | {
"end_byte": 22286,
"start_byte": 18873,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html_22287_22745 | <!-- * * * * * * * * * * * The content above * * * * * * * * * * * -->
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<router-outlet></router-outlet> | {
"end_byte": 22745,
"start_byte": 22287,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app-routing.module.ts_0_245 | import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
| {
"end_byte": 245,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app-routing.module.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.spec.ts_0_1029 | import { TestBed } from '@angular/core/testing';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(() => TestBed.configureTestingModule({
imports: [RouterModule.forRoot([])],
declarations: [AppComponent]
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title '18-ssr-project-webpack'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('18-ssr-project-webpack');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('18-ssr-project-webpack app is running!');
});
});
| {
"end_byte": 1029,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.spec.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.module.ts_0_449 | import { NgModule } from '@angular/core';
import { BrowserModule, provideClientHydration } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [
provideClientHydration()
],
bootstrap: [AppComponent]
})
export class AppModule { }
| {
"end_byte": 449,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.module.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.ts_0_226 | import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = '18-ssr-project-webpack';
}
| {
"end_byte": 226,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.module.server.ts_0_318 | import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
@NgModule({
imports: [
AppModule,
ServerModule,
],
bootstrap: [AppComponent],
})
export class AppServerModule {}
| {
"end_byte": 318,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.module.server.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/README.md_0_1112 | # 17SsrProjectWebpack
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.2.10.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate --help` to see all the available schematics you can generate.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview](https://angular.dev/tools/cli) and [Command Reference](https://angular.dev/cli) pages.
| {
"end_byte": 1112,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/README.md"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/server.ts_0_2238 | import 'zone.js/node';
import { APP_BASE_HREF } from '@angular/common';
import { CommonEngine } from '@angular/ssr/node';
import * as express from 'express';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import AppServerModule from './src/main.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const distFolder = join(process.cwd(), 'dist/18-ssr-project-webpack/browser');
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
? join(distFolder, 'index.original.html')
: join(distFolder, 'index.html');
const commonEngine = new CommonEngine();
server.set('view engine', 'html');
server.set('views', distFolder);
// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get('*.*', express.static(distFolder, {
maxAge: '1y'
}));
// All regular routes use the Angular engine
server.get('*', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;
commonEngine
.render({
bootstrap: AppServerModule,
documentFilePath: indexHtml,
url: `${protocol}://${headers.host}${originalUrl}`,
publicPath: distFolder,
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
})
.then((html) => res.send(html))
.catch((err) => next(err));
});
return server;
}
function run(): void {
const port = process.env['PORT'] || 4000;
// Start up the Node server
const server = app();
server.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
});
}
// Webpack will replace 'require' with '__webpack_require__'
// '__non_webpack_require__' is a proxy to Node 'require'
// The below code is to ensure that the server is run only when not requiring the bundle.
declare const __non_webpack_require__: NodeRequire;
const mainModule = __non_webpack_require__.main;
const moduleFilename = mainModule && mainModule.filename || '';
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
run();
}
export default AppServerModule;
| {
"end_byte": 2238,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/server.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/index.html_0_305 | <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>17SsrProjectWebpack</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
| {
"end_byte": 305,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/index.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/main.ts_0_214 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
| {
"end_byte": 214,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/main.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/styles.css_0_80 | /* You can add global styles to this file, and also import other style files */
| {
"end_byte": 80,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/styles.css"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/main.server.ts_0_70 | export { AppServerModule as default } from './app/app.module.server';
| {
"end_byte": 70,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/main.server.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html_0_572 | <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * * * The content below * * * * * * * * * * * -->
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * Delete the template below * * * * * * * * * * -->
<!-- * * * * * * * to get started with your project! * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --> | {
"end_byte": 572,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html_574_5881 | <style>
:host {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 14px;
color: #333;
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 8px 0;
}
p {
margin: 0;
}
.spacer {
flex: 1;
}
.toolbar {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 60px;
display: flex;
align-items: center;
background-color: #1976d2;
color: white;
font-weight: 600;
}
.toolbar img {
margin: 0 16px;
}
.toolbar #twitter-logo {
height: 40px;
margin: 0 8px;
}
.toolbar #youtube-logo {
height: 40px;
margin: 0 16px;
}
.toolbar #twitter-logo:hover,
.toolbar #youtube-logo:hover {
opacity: 0.8;
}
.content {
display: flex;
margin: 82px auto 32px;
padding: 0 16px;
max-width: 960px;
flex-direction: column;
align-items: center;
}
svg.material-icons {
height: 24px;
width: auto;
}
svg.material-icons:not(:last-child) {
margin-right: 8px;
}
.card svg.material-icons path {
fill: #888;
}
.card-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-top: 16px;
}
.card {
all: unset;
border-radius: 4px;
border: 1px solid #eee;
background-color: #fafafa;
height: 40px;
width: 200px;
margin: 0 8px 16px;
padding: 16px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
transition: all 0.2s ease-in-out;
line-height: 24px;
}
.card-container .card:not(:last-child) {
margin-right: 0;
}
.card.card-small {
height: 16px;
width: 168px;
}
.card-container .card:not(.highlight-card) {
cursor: pointer;
}
.card-container .card:not(.highlight-card):hover {
transform: translateY(-3px);
box-shadow: 0 4px 17px rgba(0, 0, 0, 0.35);
}
.card-container .card:not(.highlight-card):hover .material-icons path {
fill: rgb(105, 103, 103);
}
.card.highlight-card {
background-color: #1976d2;
color: white;
font-weight: 600;
border: none;
width: auto;
min-width: 30%;
position: relative;
}
.card.card.highlight-card span {
margin-left: 60px;
}
svg#rocket {
width: 80px;
position: absolute;
left: -10px;
top: -24px;
}
svg#rocket-smoke {
height: calc(100vh - 95px);
position: absolute;
top: 10px;
right: 180px;
z-index: -10;
}
a,
a:visited,
a:hover {
color: #1976d2;
text-decoration: none;
}
a:hover {
color: #125699;
}
.terminal {
position: relative;
width: 80%;
max-width: 600px;
border-radius: 6px;
padding-top: 45px;
margin-top: 8px;
overflow: hidden;
background-color: rgb(15, 15, 16);
}
.terminal::before {
content: "\2022 \2022 \2022";
position: absolute;
top: 0;
left: 0;
height: 4px;
background: rgb(58, 58, 58);
color: #c2c3c4;
width: 100%;
font-size: 2rem;
line-height: 0;
padding: 14px 0;
text-indent: 4px;
}
.terminal pre {
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
color: white;
padding: 0 1rem 1rem;
margin: 0;
}
.circle-link {
height: 40px;
width: 40px;
border-radius: 40px;
margin: 8px;
background-color: white;
border: 1px solid #eeeeee;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
transition: 1s ease-out;
}
.circle-link:hover {
transform: translateY(-0.25rem);
box-shadow: 0px 3px 15px rgba(0, 0, 0, 0.2);
}
footer {
margin-top: 8px;
display: flex;
align-items: center;
line-height: 20px;
}
footer a {
display: flex;
align-items: center;
}
.github-star-badge {
color: #24292e;
display: flex;
align-items: center;
font-size: 12px;
padding: 3px 10px;
border: 1px solid rgba(27,31,35,.2);
border-radius: 3px;
background-image: linear-gradient(-180deg,#fafbfc,#eff3f6 90%);
margin-left: 4px;
font-weight: 600;
}
.github-star-badge:hover {
background-image: linear-gradient(-180deg,#f0f3f6,#e6ebf1 90%);
border-color: rgba(27,31,35,.35);
background-position: -.5em;
}
.github-star-badge .material-icons {
height: 16px;
width: 16px;
margin-right: 4px;
}
svg#clouds {
position: fixed;
bottom: -160px;
left: -230px;
z-index: -10;
width: 1920px;
}
/* Responsive Styles */
@media screen and (max-width: 767px) {
.card-container > *:not(.circle-link) ,
.terminal {
width: 100%;
}
.card:not(.highlight-card) {
height: 16px;
margin: 8px 0;
}
.card.highlight-card span {
margin-left: 72px;
}
svg#rocket-smoke {
right: 120px;
transform: rotate(-5deg);
}
}
@media screen and (max-width: 575px) {
svg#rocket-smoke {
display: none;
visibility: hidden;
}
}
</style>
<!-- Toolbar --> | {
"end_byte": 5881,
"start_byte": 574,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html_5882_9600 | <div class="toolbar" role="banner">
<img
width="40"
alt="Angular Logo"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="
/>
<span>Welcome</span>
<div class="spacer"></div>
<a aria-label="Angular on X" target="_blank" rel="noopener" href="https://twitter.com/angular" title="X">
<svg id="twitter-logo" xmlns="http://www.w3.org/2000/svg" height="24" width="24" data-name="Logo" viewBox="0 0 512 512" fill="#fff">
<path d="M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z"/>
</svg>
</a>
<a aria-label="Angular on YouTube" target="_blank" rel="noopener" href="https://youtube.com/angular" title="YouTube">
<svg id="youtube-logo" height="24" width="24" data-name="Logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff">
<path d="M0 0h24v24H0V0z" fill="none"/>
<path d="M21.58 7.19c-.23-.86-.91-1.54-1.77-1.77C18.25 5 12 5 12 5s-6.25 0-7.81.42c-.86.23-1.54.91-1.77 1.77C2 8.75 2 12 2 12s0 3.25.42 4.81c.23.86.91 1.54 1.77 1.77C5.75 19 12 19 12 19s6.25 0 7.81-.42c.86-.23 1.54-.91 1.77-1.77C22 15.25 22 12 22 12s0-3.25-.42-4.81zM10 15V9l5.2 3-5.2 3z"/>
</svg>
</a>
</div>
<div class="content" role="main">
<!-- Highlight Card -->
<div class="card highlight-card card-small">
<svg id="rocket" xmlns="http://www.w3.org/2000/svg" width="101.678" height="101.678" viewBox="0 0 101.678 101.678">
<title>Rocket Ship</title>
<g id="Group_83" data-name="Group 83" transform="translate(-141 -696)">
<circle id="Ellipse_8" data-name="Ellipse 8" cx="50.839" cy="50.839" r="50.839" transform="translate(141 696)" fill="#dd0031"/>
<g id="Group_47" data-name="Group 47" transform="translate(165.185 720.185)">
<path id="Path_33" data-name="Path 33" d="M3.4,42.615a3.084,3.084,0,0,0,3.553,3.553,21.419,21.419,0,0,0,12.215-6.107L9.511,30.4A21.419,21.419,0,0,0,3.4,42.615Z" transform="translate(0.371 3.363)" fill="#fff"/>
<path id="Path_34" data-name="Path 34" d="M53.3,3.221A3.09,3.09,0,0,0,50.081,0,48.227,48.227,0,0,0,18.322,13.437c-6-1.666-14.991-1.221-18.322,7.218A33.892,33.892,0,0,1,9.439,25.1l-.333.666a3.013,3.013,0,0,0,.555,3.553L23.985,43.641a2.9,2.9,0,0,0,3.553.555l.666-.333A33.892,33.892,0,0,1,32.647,53.3c8.55-3.664,8.884-12.326,7.218-18.322A48.227,48.227,0,0,0,53.3,3.221ZM34.424,9.772a6.439,6.439,0,1,1,9.106,9.106,6.368,6.368,0,0,1-9.106,0A6.467,6.467,0,0,1,34.424,9.772Z" transform="translate(0 0.005)" fill="#fff"/>
</g>
</g>
</svg>
<span>{{ title }} app is running!</span>
<svg id="rocket-smoke" xmlns="http://www.w3.org/2000/svg" width="516.119" height="1083.632" viewBox="0 0 516.119 1083.632">
<title>Rocket Ship Smoke</title>
<path id="Path_40" data-name="Path 40" d="M644.6,141S143.02,215.537,147.049,870.207s342.774,201.755,342.774,201.755S404.659,847.213,388.815,762.2c-27.116-145.51-11.551-384.124,271.9-609.1C671.15,139.365,644.6,141,644.6,141Z" transform="translate(-147.025 -140.939)" fill="#f5f5f5"/>
</svg>
</div>
<!-- Resources -->
<h2>Resources</h2>
<p>Here are some links to help you get started:</p> | {
"end_byte": 9600,
"start_byte": 5882,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html_9604_13329 | <div class="card-container">
<a class="card" target="_blank" rel="noopener" href="https://angular.dev/tutorials/learn-angular">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M5 13.18v4L12 21l7-3.82v-4L12 17l-7-3.82zM12 3L1 9l11 6 9-4.91V17h2V9L12 3z"/></svg>
<span>Learn Angular</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg> </a>
<a class="card" target="_blank" rel="noopener" href="https://angular.dev/tools/cli">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/></svg>
<span>CLI Documentation</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
</a>
<a class="card" target="_blank" rel="noopener" href="https://material.angular.io">
<svg xmlns="http://www.w3.org/2000/svg" style="margin-right: 8px" width="21.813" height="23.453" viewBox="0 0 179.2 192.7"><path fill="#ffa726" d="M89.4 0 0 32l13.5 118.4 75.9 42.3 76-42.3L179.2 32 89.4 0z"/><path fill="#fb8c00" d="M89.4 0v192.7l76-42.3L179.2 32 89.4 0z"/><path fill="#ffe0b2" d="m102.9 146.3-63.3-30.5 36.3-22.4 63.7 30.6-36.7 22.3z"/><path fill="#fff3e0" d="M102.9 122.8 39.6 92.2l36.3-22.3 63.7 30.6-36.7 22.3z"/><path fill="#fff" d="M102.9 99.3 39.6 68.7l36.3-22.4 63.7 30.6-36.7 22.4z"/></svg>
<span>Angular Material</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
</a>
<a class="card" target="_blank" rel="noopener" href="https://blog.angular.dev">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M13.5.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 17.41 3.8 13.5.67zM11.71 19c-1.78 0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 1.77-.36 3.6-1.21 4.62-2.58.39 1.29.59 2.65.59 4.04 0 2.65-2.15 4.8-4.8 4.8z"/></svg>
<span>Angular Blog</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
</a>
<a class="card" target="_blank" rel="noopener" href="https://angular.dev/tools/devtools">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><g><path d="M14.73,13.31C15.52,12.24,16,10.93,16,9.5C16,5.91,13.09,3,9.5,3S3,5.91,3,9.5C3,13.09,5.91,16,9.5,16 c1.43,0,2.74-0.48,3.81-1.27L19.59,21L21,19.59L14.73,13.31z M9.5,14C7.01,14,5,11.99,5,9.5S7.01,5,9.5,5S14,7.01,14,9.5 S11.99,14,9.5,14z"/><polygon points="10.29,8.44 9.5,6 8.71,8.44 6.25,8.44 8.26,10.03 7.49,12.5 9.5,10.97 11.51,12.5 10.74,10.03 12.75,8.44"/></g></g></svg>
<span>Angular DevTools</span>
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
</a>
</div>
<!-- Next Steps -->
<h2>Next Steps</h2>
<p>What do you want to do next with your app?</p>
<input type="hidden" #selection>
| {
"end_byte": 13329,
"start_byte": 9604,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html_13329_15679 | <div class="card-container">
<button class="card card-small" (click)="selection.value = 'component'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>New Component</span>
</button>
<button class="card card-small" (click)="selection.value = 'material'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Angular Material</span>
</button>
<button class="card card-small" (click)="selection.value = 'pwa'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Add PWA Support</span>
</button>
<button class="card card-small" (click)="selection.value = 'dependency'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Add Dependency</span>
</button>
<button class="card card-small" (click)="selection.value = 'test'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Run and Watch Tests</span>
</button>
<button class="card card-small" (click)="selection.value = 'build'" tabindex="0">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
<span>Build for Production</span>
</button>
</div>
<!-- Terminal -->
<div class="terminal" [ngSwitch]="selection.value">
<pre *ngSwitchDefault>ng generate component xyz</pre>
<pre *ngSwitchCase="'material'">ng add @angular/material</pre>
<pre *ngSwitchCase="'pwa'">ng add @angular/pwa</pre>
<pre *ngSwitchCase="'dependency'">ng add _____</pre>
<pre *ngSwitchCase="'test'">ng test</pre>
<pre *ngSwitchCase="'build'">ng build</pre>
</div>
<!-- Links -->
<div class="card-container"> | {
"end_byte": 15679,
"start_byte": 13329,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html_15684_18867 | <a class="circle-link" title="Find a Local Meetup" href="https://www.meetup.com/find/?keywords=angular" target="_blank" rel="noopener">
<svg xmlns="http://www.w3.org/2000/svg" width="24.607" height="23.447" viewBox="0 0 24.607 23.447">
<title>Meetup Logo</title>
<path id="logo--mSwarm" d="M21.221,14.95A4.393,4.393,0,0,1,17.6,19.281a4.452,4.452,0,0,1-.8.069c-.09,0-.125.035-.154.117a2.939,2.939,0,0,1-2.506,2.091,2.868,2.868,0,0,1-2.248-.624.168.168,0,0,0-.245-.005,3.926,3.926,0,0,1-2.589.741,4.015,4.015,0,0,1-3.7-3.347,2.7,2.7,0,0,1-.043-.38c0-.106-.042-.146-.143-.166a3.524,3.524,0,0,1-1.516-.69A3.623,3.623,0,0,1,2.23,14.557a3.66,3.66,0,0,1,1.077-3.085.138.138,0,0,0,.026-.2,3.348,3.348,0,0,1-.451-1.821,3.46,3.46,0,0,1,2.749-3.28.44.44,0,0,0,.355-.281,5.072,5.072,0,0,1,3.863-3,5.028,5.028,0,0,1,3.555.666.31.31,0,0,0,.271.03A4.5,4.5,0,0,1,18.3,4.7a4.4,4.4,0,0,1,1.334,2.751,3.658,3.658,0,0,1,.022.706.131.131,0,0,0,.1.157,2.432,2.432,0,0,1,1.574,1.645,2.464,2.464,0,0,1-.7,2.616c-.065.064-.051.1-.014.166A4.321,4.321,0,0,1,21.221,14.95ZM13.4,14.607a2.09,2.09,0,0,0,1.409,1.982,4.7,4.7,0,0,0,1.275.221,1.807,1.807,0,0,0,.9-.151.542.542,0,0,0,.321-.545.558.558,0,0,0-.359-.534,1.2,1.2,0,0,0-.254-.078c-.262-.047-.526-.086-.787-.138a.674.674,0,0,1-.617-.75,3.394,3.394,0,0,1,.218-1.109c.217-.658.509-1.286.79-1.918a15.609,15.609,0,0,0,.745-1.86,1.95,1.95,0,0,0,.06-1.073,1.286,1.286,0,0,0-1.051-1.033,1.977,1.977,0,0,0-1.521.2.339.339,0,0,1-.446-.042c-.1-.092-.2-.189-.307-.284a1.214,1.214,0,0,0-1.643-.061,7.563,7.563,0,0,1-.614.512A.588.588,0,0,1,10.883,8c-.215-.115-.437-.215-.659-.316a2.153,2.153,0,0,0-.695-.248A2.091,2.091,0,0,0,7.541,8.562a9.915,9.915,0,0,0-.405.986c-.559,1.545-1.015,3.123-1.487,4.7a1.528,1.528,0,0,0,.634,1.777,1.755,1.755,0,0,0,1.5.211,1.35,1.35,0,0,0,.824-.858c.543-1.281,1.032-2.584,1.55-3.875.142-.355.28-.712.432-1.064a.548.548,0,0,1,.851-.24.622.622,0,0,1,.185.539,2.161,2.161,0,0,1-.181.621c-.337.852-.68,1.7-1.018,2.552a2.564,2.564,0,0,0-.173.528.624.624,0,0,0,.333.71,1.073,1.073,0,0,0,.814.034,1.22,1.22,0,0,0,.657-.655q.758-1.488,1.511-2.978.35-.687.709-1.37a1.073,1.073,0,0,1,.357-.434.43.43,0,0,1,.463-.016.373.373,0,0,1,.153.387.7.7,0,0,1-.057.236c-.065.157-.127.316-.2.469-.42.883-.846,1.763-1.262,2.648A2.463,2.463,0,0,0,13.4,14.607Zm5.888,6.508a1.09,1.09,0,0,0-2.179.006,1.09,1.09,0,0,0,2.179-.006ZM1.028,12.139a1.038,1.038,0,1,0,.01-2.075,1.038,1.038,0,0,0-.01,2.075ZM13.782.528a1.027,1.027,0,1,0-.011,2.055A1.027,1.027,0,0,0,13.782.528ZM22.21,6.95a.882.882,0,0,0-1.763.011A.882.882,0,0,0,22.21,6.95ZM4.153,4.439a.785.785,0,1,0,.787-.78A.766.766,0,0,0,4.153,4.439Zm8.221,18.22a.676.676,0,1,0-.677.666A.671.671,0,0,0,12.374,22.658ZM22.872,12.2a.674.674,0,0,0-.665.665.656.656,0,0,0,.655.643.634.634,0,0,0,.655-.644A.654.654,0,0,0,22.872,12.2ZM7.171-.123A.546.546,0,0,0,6.613.43a.553.553,0,1,0,1.106,0A.539.539,0,0,0,7.171-.123ZM24.119,9.234a.507.507,0,0,0-.493.488.494.494,0,0,0,.494.494.48.48,0,0,0,.487-.483A.491.491,0,0,0,24.119,9.234Zm-19.454,9.7a.5.5,0,0,0-.488-.488.491.491,0,0,0-.487.5.483.483,0,0,0,.491.479A.49.49,0,0,0,4.665,18.936Z" transform="translate(0 0.123)" fill="#f64060"/>
</svg>
</a> | {
"end_byte": 18867,
"start_byte": 15684,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html_18873_22286 | <a class="circle-link" title="Join the Conversation on Discord" href="https://discord.gg/angular" target="_blank" rel="noopener">
<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 245 240">
<title>Discord Logo</title>
<path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zM140.9 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/>
<path d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/>
</svg>
</a>
</div>
<!-- Footer -->
<footer>
Love Angular?
<a href="https://github.com/angular/angular" target="_blank" rel="noopener"> Give our repo a star.
<div class="github-star-badge">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/></svg>
Star
</div>
</a>
<a href="https://github.com/angular/angular" target="_blank" rel="noopener">
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" fill="#1976d2"/><path d="M0 0h24v24H0z" fill="none"/></svg>
</a>
</footer>
<svg id="clouds" xmlns="http://www.w3.org/2000/svg" width="2611.084" height="485.677" viewBox="0 0 2611.084 485.677">
<title>Gray Clouds Background</title>
<path id="Path_39" data-name="Path 39" d="M2379.709,863.793c10-93-77-171-168-149-52-114-225-105-264,15-75,3-140,59-152,133-30,2.83-66.725,9.829-93.5,26.25-26.771-16.421-63.5-23.42-93.5-26.25-12-74-77-130-152-133-39-120-212-129-264-15-54.084-13.075-106.753,9.173-138.488,48.9-31.734-39.726-84.4-61.974-138.487-48.9-52-114-225-105-264,15a162.027,162.027,0,0,0-103.147,43.044c-30.633-45.365-87.1-72.091-145.206-58.044-52-114-225-105-264,15-75,3-140,59-152,133-53,5-127,23-130,83-2,42,35,72,70,86,49,20,106,18,157,5a165.625,165.625,0,0,0,120,0c47,94,178,113,251,33,61.112,8.015,113.854-5.72,150.492-29.764a165.62,165.62,0,0,0,110.861-3.236c47,94,178,113,251,33,31.385,4.116,60.563,2.495,86.487-3.311,25.924,5.806,55.1,7.427,86.488,3.311,73,80,204,61,251-33a165.625,165.625,0,0,0,120,0c51,13,108,15,157-5a147.188,147.188,0,0,0,33.5-18.694,147.217,147.217,0,0,0,33.5,18.694c49,20,106,18,157,5a165.625,165.625,0,0,0,120,0c47,94,178,113,251,33C2446.709,1093.793,2554.709,922.793,2379.709,863.793Z" transform="translate(142.69 -634.312)" fill="#eee"/>
</svg>
</div>
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --> | {
"end_byte": 22286,
"start_byte": 18873,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html_22287_22745 | <!-- * * * * * * * * * * * The content above * * * * * * * * * * * -->
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<router-outlet></router-outlet> | {
"end_byte": 22745,
"start_byte": 22287,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.html"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app-routing.module.ts_0_245 | import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
| {
"end_byte": 245,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app-routing.module.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.spec.ts_0_1029 | import { TestBed } from '@angular/core/testing';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(() => TestBed.configureTestingModule({
imports: [RouterModule.forRoot([])],
declarations: [AppComponent]
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title '19-ssr-project-webpack'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('19-ssr-project-webpack');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('19-ssr-project-webpack app is running!');
});
});
| {
"end_byte": 1029,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.spec.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.module.ts_0_449 | import { NgModule } from '@angular/core';
import { BrowserModule, provideClientHydration } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [
provideClientHydration()
],
bootstrap: [AppComponent]
})
export class AppModule { }
| {
"end_byte": 449,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.module.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.ts_0_247 | import { Component } from '@angular/core';
@Component({
selector: 'app-root',
standalone: false,
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = '19-ssr-project-webpack';
}
| {
"end_byte": 247,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.component.ts"
} |
angular-cli/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.module.server.ts_0_318 | import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
@NgModule({
imports: [
AppModule,
ServerModule,
],
bootstrap: [AppComponent],
})
export class AppServerModule {}
| {
"end_byte": 318,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/legacy-cli/e2e/assets/19-ssr-project-webpack/src/app/app.module.server.ts"
} |
angular-cli/tests/schematics/update/packages/README.md_0_436 |
## Update Package Group packages
* `[email protected]` -> `update-package-group2@^1`
* `[email protected]` -> `[email protected]`
----
* `[email protected]` -> `update-package-group2@^1`
* `[email protected]` -> `[email protected]`
----
* `[email protected]` -> `update-package-group2@^2`
* `[email protected]` -> `update-package-group1@^1`
----
| {
"end_byte": 436,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/schematics/update/packages/README.md"
} |
angular-cli/tests/schematics/update/packages/update-migrations/v1_5.js_0_307 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
exports.default = function () {
return function (tree) {
tree.create('/version1_5', '');
};
};
| {
"end_byte": 307,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/schematics/update/packages/update-migrations/v1_5.js"
} |
angular-cli/tests/angular_devkit/core/json/schema/serializers/0.0.javascript_spec.ts_0_1106 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
// tslint:disable:no-any
import { schema } from '@angular-devkit/core';
const { serializers } = schema;
export function works(registry: schema.JsonSchemaRegistry, schema: any) {
const value = {
'firstName': 'Hans',
'lastName': 'Larsen',
'age': 30,
};
registry.addSchema('', schema);
const v = new serializers.JavascriptSerializer().serialize('', registry)(value);
expect(v.firstName).toBe('Hans');
expect(v.lastName).toBe('Larsen');
expect(v.age).toBe(30);
v.age = 10;
expect(v.age).toBe(10);
expect(() => (v.age = -1)).toThrow();
expect(() => (v.age = 'hello')).toThrow();
expect(() => (v.age = [])).toThrow();
expect(() => (v.age = undefined)).not.toThrow();
expect(() => (v.firstName = 0)).toThrow();
expect(() => (v.firstName = [])).toThrow();
// This should throw as the value is required.
expect(() => (v.firstName = undefined)).toThrow();
}
| {
"end_byte": 1106,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/angular_devkit/core/json/schema/serializers/0.0.javascript_spec.ts"
} |
angular-cli/tests/angular_devkit/core/json/schema/serializers/1.0.javascript_spec.ts_0_1941 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
// tslint:disable:no-any
import { schema } from '@angular-devkit/core';
const { serializers } = schema;
export function works(registry: schema.JsonSchemaRegistry, schema: any) {
const value = {
'requiredKey': 1,
};
registry.addSchema('', schema);
const v = new serializers.JavascriptSerializer().serialize('', registry)(value);
expect(v.requiredKey).toBe(1);
expect(() => delete v.requiredKey).toThrow();
expect(v.stringKeyDefault).toBe('defaultValue');
v.stringKeyDefault = 'hello';
expect(v.stringKeyDefault).toBe('hello');
delete v.stringKeyDefault;
expect(v.stringKeyDefault).toBe('defaultValue');
expect(v.objectKey1).toBe(undefined);
v.objectKey1 = { stringKey: 'str' };
expect(v.objectKey1.stringKey).toBe('str');
expect(v.objectKey1.objectKey).toBe(undefined);
v.objectKey1.objectKey = { stringKey: 'str2' };
expect(v.objectKey1.objectKey.stringKey).toBe('str2');
expect(Object.keys(v.objectKey1)).toEqual(['stringKey', 'stringKeyDefault', 'objectKey']);
}
export function accessUndefined(registry: schema.JsonSchemaRegistry, schema: any) {
const value = {
'requiredKey': 1,
};
registry.addSchema('', schema);
const v = new serializers.JavascriptSerializer({
allowAccessUndefinedObjects: true,
}).serialize(
'',
registry,
)(value);
// Access an undefined property.
v.objectKey1.stringKey = 'hello';
expect(v.objectKey1).not.toBe(undefined);
expect(v.objectKey1.stringKey).toBe('hello');
expect(v.objectKey1.numberKey).toBe(undefined);
v.objectKey1.stringKey = undefined;
expect(v.objectKey1.stringKey).toBe(undefined);
expect(v.stringKeyDefault).toBe('defaultValue');
expect(v.objectKey1.stringKeyDefault).toBe('defaultValue2');
}
| {
"end_byte": 1941,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/angular_devkit/core/json/schema/serializers/1.0.javascript_spec.ts"
} |
angular-cli/tests/angular_devkit/architect/node/jobs/BUILD.bazel_0_517 | load("//tools:defaults.bzl", "ts_library")
# Copyright Google Inc. All Rights Reserved.
#
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at https://angular.dev/license
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
ts_library(
name = "jobs_test_lib",
srcs = glob(
include = [
"**/*.ts",
],
),
deps = [
"//packages/angular_devkit/architect",
"@npm//@types/node",
],
)
| {
"end_byte": 517,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/angular_devkit/architect/node/jobs/BUILD.bazel"
} |
angular-cli/tests/angular_devkit/architect/node/jobs/add.ts_0_550 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { jobs } from '@angular-devkit/architect';
// Export the job using a createJob. We use our own spec file here to do the job.
export default jobs.createJobHandler<number[], null, number>(
(input) => {
return input.reduce((a, c) => a + c, 0);
},
{
input: { items: { type: 'number' } },
output: { type: 'number' },
},
);
| {
"end_byte": 550,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/angular_devkit/architect/node/jobs/add.ts"
} |
angular-cli/tests/angular_devkit/schematics/tools/file-system-engine-host/null-factory.ts_0_253 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
export default function () {
return () => {};
}
| {
"end_byte": 253,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/angular_devkit/schematics/tools/file-system-engine-host/null-factory.ts"
} |
angular-cli/tests/angular_devkit/schematics/tools/file-system-engine-host/BUILD.bazel_0_830 | load("//tools:defaults.bzl", "ts_library")
# Copyright Google Inc. All Rights Reserved.
#
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at https://angular.dev/license
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
ts_library(
name = "file_system_engine_host_test_lib",
srcs = glob(
include = [
"**/*.ts",
],
),
data = glob(
include = [
"**/collection.json",
"**/*.js",
],
),
deps = [
"//packages/angular_devkit/schematics",
# ":testing",
# "//packages/angular_devkit/core",
# "//packages/angular_devkit/core/node",
# "@npm//rxjs",
#
"@npm//@types/jasmine",
"@npm//@types/node",
],
)
| {
"end_byte": 830,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/angular_devkit/schematics/tools/file-system-engine-host/BUILD.bazel"
} |
angular-cli/tests/angular_devkit/schematics/tools/file-system-engine-host/file-tasks/file-task.js_0_128 | function default_1() {
return async () => {
throw new Error('task exception');
}
}
exports.default = default_1; | {
"end_byte": 128,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/angular_devkit/schematics/tools/file-system-engine-host/file-tasks/file-task.js"
} |
angular-cli/tests/angular_devkit/schematics/tools/file-system-engine-host/file-tasks/factory.ts_0_531 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
// tslint:disable-next-line:no-implicit-dependencies
import { SchematicContext, Tree } from '@angular-devkit/schematics';
export default function () {
return (_: Tree, context: SchematicContext) => {
context.addTask({
toConfiguration() {
return { name: 'file-tasks/file-task.js' };
},
});
};
}
| {
"end_byte": 531,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/angular_devkit/schematics/tools/file-system-engine-host/file-tasks/factory.ts"
} |
angular-cli/tests/angular_devkit/schematics/tools/file-system-engine-host/extra-properties/factory.ts_0_672 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
// tslint:disable-next-line:no-implicit-dependencies
import { SchematicContext, Tree } from '@angular-devkit/schematics';
export default function (options: {}) {
return (tree: Tree, context: SchematicContext) => {
// We pass information back to the test.
tree.create(
(context.schematic.description as any).extra, // tslint:disable-line:no-any
(context.schematic.collection.description as any).extra, // tslint:disable-line:no-any
);
};
}
| {
"end_byte": 672,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/tests/angular_devkit/schematics/tools/file-system-engine-host/extra-properties/factory.ts"
} |
angular-cli/docs/DEVELOPER.md_0_7012 | # Building and Testing Angular CLI
## Installation
To get started locally, follow these instructions:
1. If you haven't done it already, [make a fork of this repo](https://github.com/angular/angular-cli/fork).
1. Clone to your local computer using `git`.
1. Make sure that you have Node `v18.19` or higher installed. See instructions [here](https://nodejs.org/en/download/).
1. Make sure that you have `yarn` installed; see instructions [here](https://yarnpkg.com/lang/en/docs/install/).
1. Run `yarn` (no arguments) from the root of your clone of this project to install dependencies.
## Building and Installing the CLI
To make a local build:
```shell
yarn build --local
```
This generates a number of tarballs in the `dist/` directory. To actually use
the locally built tools, switch to another repository reproducing the specific
issue you want to fix (or just generate a local repo with `ng new`). Then
install the locally built packages:
```shell
cd "${EXAMPLE_ANGULAR_PROJECT_REPO}"
npm install -D ${CLI_REPO}/dist/*.tgz
```
Builds of this example project will use tooling created from the previous local
build and include any local changes. When using the CLI, it will automatically
check for a local install and use that if present. This means you can just run:
```shell
npm install -g @angular/cli
```
to get a global install of the latest CLI release. Then running any `ng` command
in the example project will automatically find and use the local build of the
CLI.
Note: If you are testing `ng update`, be aware that installing all the tarballs
will also update the framework (`@angular/core`) to the latest version. In this
case, simply install the CLI alone with
`npm install -D ${CLI_REPO}/dist/_angular_cli.tgz`, that way the rest of the
project remains to be upgraded with `ng update`.
## Debugging
To debug an invocation of the CLI, [build and install the CLI for an example
project](#building-and-installing-the-cli), then run the desired `ng` command
as:
```shell
node --inspect-brk node_modules/.bin/ng ...
```
This will trigger a breakpoint as the CLI starts up. You can connect to this
using the supported mechanisms for your IDE, but the simplest option is to open
Chrome to [chrome://inspect](chrome://inspect) and then click on the `inspect`
link for the `node_modules/.bin/ng` Node target.
Unfortunately, the CLI dynamically `require()`'s other files mid-execution, so
the debugger is not aware of all the source code files before hand. As a result,
it is tough to put breakpoints on files before the CLI loads them. The easiest
workaround is to use the `debugger;` statement to stop execution in the file you
are interested in, and then you should be able to step around and set breakpoints
as expected.
## Testing
There are two different test suites which can be run locally:
### Unit tests
- Run all tests: `yarn bazel test //packages/...`
- Run a subset of the tests, use the full Bazel target example: `yarn bazel test //packages/schematics/angular:angular_test`
- For a complete list of test targets use the following Bazel query: `yarn bazel query "tests(//packages/...)"`
When debugging a specific test, change `describe()` or `it()` to `fdescribe()`
and `fit()` to focus execution to just that one test. This will keep the output clean and speed up execution by not running irrelevant tests.
You can find more info about debugging [tests with Bazel in the docs.](https://github.com/angular/angular-cli/blob/main/docs/process/bazel.md#debugging-jasmine_node_test)
### End to end tests
- For a complete list of test targets use the following Bazel query: `yarn bazel query "tests(//tests/...)"`
- Run a subset of the tests: `yarn bazel test //tests/legacy-cli:e2e_node18 --config=e2e --test_filter="tests/i18n/ivy-localize-*"`
- Use `bazel run` to debug failing tests debugging: `yarn bazel run //tests/legacy-cli:e2e_node18 --config=e2e --test_arg="--glob=tests/basic/aot.ts"`
- Provide additional `e2e_runner` options using `--test_arg`: `--test_arg="--package-manager=yarn"`
When running the debug commands, Node will stop and wait for a debugger to attach.
You can attach your IDE to the debugger to stop on breakpoints and step through the code. Also, see [IDE Specific Usage](#ide-specific-usage) for a
simpler debug story.
## IDE Specific Usage
Some additional tips for developing in specific IDEs.
### Intellij IDEA / WebStorm
To load the project in Intellij products, simply `Open` the repository folder.
Do **not** `Import Project`, because that will overwrite the existing
configuration.
Once opened, the editor should automatically detect run configurations in the
workspace. Use the drop down to choose which one to run and then click the `Run`
button to start it. When executing a debug target, make sure to click the
`Debug` icon to automatically attach the debugger (if you click `Run`, Node will
wait forever for a debugger to attach).

### VS Code
In order to debug some Angular CLI behaviour using Visual Studio Code, you can run `npm run build`, and then use a launch configuration like the following:
```json
{
"type": "node",
"request": "launch",
"name": "ng serve",
"cwd": "<path to an Angular project generated with Angular-CLI>",
"program": "${workspaceFolder}/dist/@angular/cli/bin/ng",
"args": [
"<ng command>",
...other arguments
],
"console": "integratedTerminal"
}
```
Then you can add breakpoints in `dist/@angular` files.
For more information about Node.js debugging in VS Code, see the related [VS Code Documentation](https://code.visualstudio.com/docs/nodejs/nodejs-debugging).
## CPU Profiling
In order to investigate performance issues, CPU profiling is often useful.
### Creating a profile
Node.js 16+ users can use the Node.js command line argument `--cpu-prof` to create a CPU profile.
```bash
node --cpu-prof node_modules/.bin/ng build
```
In addition to this one, another, more elaborated way to capture a CPU profile using the Chrome Devtools is detailed in https://github.com/angular/angular-cli/issues/8259#issue-269908550.
#### Opening a profile
You can use the Chrome Devtools to process it. To do so:
1. open `chrome://inspect` in Chrome
1. click on "Open dedicated DevTools for Node"
1. go to the "profiler" tab
1. click on the "Load" button and select the generated `.cpuprofile` file
1. on the left panel, select the associated file
## Creating New Packages
Adding a package to this repository means running two separate commands:
1. `schematics devkit:package PACKAGE_NAME`. This will update the `.monorepo` file, and create the
base files for the new package (package.json, src/index, etc).
1. `devkit-admin templates`. This will update the README and all other template files that might
have changed when adding a new package.
For private packages, you will need to add a `"private": true` key to your package.json manually.
This will require re-running the template admin script.
| {
"end_byte": 7012,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/DEVELOPER.md"
} |
angular-cli/docs/README.md_0_522 | # `/docs` Folder
This folder is used for all documentation. It contains a number of subfolders with short
descriptions here.
## `/docs/design`
Design documents on GitHub, in Markdown format. The number of design documents available is limited.
## `/docs/process`
Description of various caretaker and workflow processes.
## `/docs/specifications`
Specifications for support of Angular CLI features. These are meant to be read directly on GitHub
by developers of libraries who want to integrate with the Angular CLI.
| {
"end_byte": 522,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/README.md"
} |
angular-cli/docs/design/ngConfig.md_0_5496 | # ngConfig - Design
## Goals
Currently, a project scaffolded with the CLI has no way of specifying options and configurations affecting their projects. There are ways to affect the build (with the `angular-cli-build.js` file), but the following questions cannot be answered without actual project options:
- Where in my directory is my karma.conf file?
- What is my firebase database URL?
- Where is my client code?
- How can I use a different lazy-loading boundary prefix (or none at all)?
- Any other backend I want to run prior to `ng serve`?
# Proposed Solution
Since the data is static, we only need to keep it in a static store somewhere.
One solution would be to keep the data in the `package.json`. Unfortunately, the metadata contains too much data and the `package.json` file would become unmanageable.
Instead of polluting the package file, a `.angular-cli.json` file will be created that contains all the values. Access to that file will be allowed to the user if he knows the structure of the file (unknown keys will be kept but ignored), and it's easy to read and write.
## Fallback
There should be two `.angular-cli.json` files; one for the project and a general one. The general one should contain information that can be useful when scaffolding new apps, or information about the user.
The project `.angular-cli.json` goes into the project root. The global configuration should live at `$HOME/.angular-cli.json`.
## Structure
The structure should be defined by a JSON schema (see [here](http://json-schema.org/)). The schema will be used to generate the `d.ts`, but that file will be kept in the file system along with the schema for IDEs.
Every PR that would change the schema should include the update to the `d.ts`.
# API
## CLI
#### Getting values
The new command `get` should be used to output values on the terminal. It takes a set of flags and an optional array of [paths](#path);
- `--glob` or `-g`; the path follows a glob format, where `*` can be replaced by any amount of characters and `?` by a single character. This will output `name=value` for each values matched.
Otherwise, outputs the value of the path passed in. If multiple paths are passed in, they follow the format of `name=value`.
#### Setting values
The new command `set` should be used to set values in the local configuration file. It takes a set of flags and an optional array of `[path](#path)=value`;
- `--global`; sets the value in the global configuration.
- `--remove`; removes the key (no value should be passed in).
The schema needs to be taken into account when setting the value of the field;
- If the field is a number, the string received from the command line is parsed. `NaN` throws an error.
- If the field is an object, an error is thrown.
- If the path is inside an object but the object hasn't been defined yet, sets the object with empty values (use the schema to create a valid object).
#### Path<a name="path"></a>
The paths are json formatted path; each `.` separates a map, while `[]` indicates an index in an array.
An example is the following:
keyA.keyB.arrayC[3].value
## Model
A model should be created that will include loading and saving the configuration, including the global configuration.
**The model should be part of the project and created on the `project` object.**
That model can be used internally by the tool to get information. It will include a proxy handler that throws if an operation doesn't respect the schema. It will also set values on globals and locals depending on which branches you access.
A simple API would return the TypeScript interface:
```typescript
class Config {
// ...
get local(): ICliConfig {
/* ... */
}
get global(): ICliConfig {
/* ... */
}
}
```
The `local` and `global` getters return proxies that respect the JSON Schema defined for the Angular config. These proxies allow users to not worry about the existence of values; those values will only be created on disc when they are set.
Also, `local` will always defer to the same key-path in `global` if a value isn't available. If a value is set and the parent exists in `global`, it should be created to `local` such that it's saved locally to the project. The proxies only care about the end points of `local` and `global`, not the existence of a parent in either.
For example, assuming the following globals/locals:
```js
// Global
{
"key1": {
"key2": {
"value": 0,
"value2": 1
}
}
}
// Local
{
"key1": {
"key2": {
"value2": 2,
"value3": 3
}
}
}
```
The following stands true:
```typescript
const config = new Config(/* ... */);
console.log(config.local.key1.key2.value); // 0, even if it doesn't exist.
console.log(config.local.key1.key2.value2); // 2, local overrides.
console.log(config.local.key1.key2.value3); // 3.
console.log(config.local.key1.key2.value4); // Schema's default value.
console.log(config.global.key1.key2.value); // 0.
console.log(config.global.key1.key2.value2); // 1, only global.
console.log(config.global.key1.key2.value3); // Schema's default value.
config.local.key1.key2.value = 1;
// Now the value is 1 inside the local. Global stays the same.
config.local.key1.key2.value3 = 5;
// The global config isn't modified.
config.global.key1.key2.value4 = 99;
// The local config stays the same.
console.log(config.local.key1.key2.value4); // 99, the global value.
config.save(); // Commits if there's a change to global and/or local.
```
| {
"end_byte": 5496,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/design/ngConfig.md"
} |
angular-cli/docs/design/build-system.md_0_6782 | # Build System
Angular CLI includes a first-party build system for Angular applications distributed as `@angular-devkit/build-angular`.
This build system is responsible for creating a standalone single-page application (SPA) from user source files and third-party dependencies.
`@angular-devkit/build-angular` itself integrates with the rest of Angular CLI by being an [Architect builder](https://angular.dev/tools/cli/cli-builder).
This document describes a top level view of the functionality in `@angular-devkit/build-angular`, referred as just the "build system".
Deprecated or soon to be removed features are not described here.
In broad strokes the main areas are:
- loading and processing sources
- code splitting
- production optimizations
- post-processing steps
Many tools are used in this process, and most of these steps happen within a [Webpack](https://webpack.js.org/) build.
We maintain a number of Webpack-centric plugins in this repository, some of these are public but most are private since they are very specific to our setup.
## Overview diagram
Below is a diagram of processing sources go through.
It's not strictly accurate because some options remove certain processing stages while adding others.
This diagram doesn't show these conditionals and only shows the possible processing steps.
Relative paths, such as `./raw-css-loader.ts`, refer to internal plugins, while other names usually refer to public npm packages.

## Loading and processing sources
Sources for Angular CLI browser apps are comprised of TypeScript files, style sheets, assets, scripts, and third party dependencies.
A given build will load these sources from disk, process them, and bundle them together.
### TypeScript and Ahead-Of-Time Compilation
Angular builds rely heavily on TypeScript-specific functionality for [Ahead-of-Time template compilation](https://angular.dev/tools/cli/aot-compiler) (AOT).
Outside Angular CLI, this is performed by the Angular Compiler (`ngc`), provided by `@angular/compiler-cli`.
To avail of Ahead-of-Time template compilation within a Webpack compilation we use and distribute the `@ngtools/webpack` Webpack plugin.
Typescript sources are loaded from disk and compiled in-memory into JavaScript files that are stored in a virtual file system and made available to Webpack.
During compilation we also perform a number of code transformations using TypeScript transformers that enable automatic usage of AOT, internationalization features, and server-side rendering.
AOT compilation requires loading HTML and CSS resources, referenced on Angular Components, as standalone strings with no external dependencies.
However, Webpack compilations operate on the basis of modules and references between them.
It's not possible to get the full compilation result for a given resource before the end of the compilation in webpack.
To obtain the standalone string for a HTML/CSS resource we compile it using a separate Webpack child compilation then extract the results.
These child compilations inherit configuration and access to the same files as the parent compilation, but have their own compilation life cycle and complete independently.
The build system allows specifying replacements for specific files by replacing what path is loaded from the virtual file system.
This is used for conditional loading of code at build time.
### Stylesheets
Two types of stylesheets are used in the build system: global stylesheets and component stylesheets.
Global stylesheets are injected into the `index.html` file, while component stylesheets are loaded directly into compiled Angular components.
The build system supports plain CSS stylesheets as well as the Sass and LESS CSS pre-processors.
Stylesheet processing functionality is provided by `sass-loader`, `less-loader`, `postcss-loader`, `postcss-import`, augmented in the build system by custom webpack plugins.
### Assets
Assets in the build system refer specifically to a list of files or directories that are meant to be copied verbatim as build artifacts.
These files are not processed and commonly include images, favicons, pdfs and other generic file types.
They are loaded into the compilation using `copy-webpack-plugin`.
### Scripts
Scripts in the build system refer specifically to JavaScript files that are meant to be loaded directly on `index.html` without being processed.
They are loaded into the compilation using a custom webpack plugin.
### Third party dependencies
Third party dependencies are mostly inside `node_modules` and are referenced via imports in source files.
Stylesheet third party dependencies are treated mostly the same as sources.
JavaScript third party dependencies suffer a more involved process.
They are first resolved to a folder in `node_modules` via [Node Module Resolution](https://nodejs.org/api/modules.html#modules_modules).
A given module might have several different entry points, for instance one for use in NodeJS and another one for using in the browser.
Although `package.json` only officially supports listing one entry point under the `main` key, it's common for npm packages to list [other entry points](https://2ality.com/2017/04/setting-up-multi-platform-packages.html).
Each entry point is listed in under a key in that module's `package.json` whose value is a string containing a relative file path.
We use `es2015 > browser > module > main` a priority list of keys, where the first key matched name determines which entry point to use.
For instance, for a module that has both `browser` and `main` entry points, we pick `browser`.
Once the actual JavaScript file is determined, it is loaded into the compilation together with it's source map.
This resolution strategy supports the [Angular Package Format](https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/edit#heading=h.k0mh3o8u5hx).
## Code splitting
Code is automatically split into different files (or chunks, for js files) based on a few different triggers.
The main TypeScript entry point and it's dependencies are bundled into the `main` chunk.
Global styles and scripts get one file per entry, named after themselves.
JavaScript code imported only via dynamic imports is automatically split into a separate chunk that is loaded asynchronously named after the file containing the dynamic import.
If multiple asynchronous chunks contain a reference to the same module, it is placed in a new asynchronously loaded chunk named after the other chunks that use it.
There is also a special chunk called `runtime` that contains the module loading logic and is loaded before the others.
| {
"end_byte": 6782,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/design/build-system.md"
} |
angular-cli/docs/design/build-system.md_6782_15515 | ## Optimizations
The build system contains optimizations aimed at improving the performance (for development builds) or the size of artifacts (for production builds).
These are often mutually exclusive and thus we cannot just default to always using them.
### Development optimizations
Development optimizations focus on reducing rebuild time on watched builds.
Although faster is always better, our threshold is to keep rebuilds even for large projects below 2 seconds.
Computation needed to bundle code grows with its total size because of the cost of string concatenation and source map operations.
Third party dependencies that are initially loaded are split into a synchronously loaded chunk called `vendor`.
Splitting the infrequently changed vendor code from the frequently changed source code thus helps make rebuilds faster.
When processing stylesheets, Webpack stores the intermediate modules as JavaScript code.
The JavaScript wrapper code makes stylesheets larger and `mini-css-extract-plugin` must be used to obtain the actually stylesheet content into a CSS file.
In development however, we skip the CSS extraction and leave it as JavaScript code for faster rebuild times.
Watched builds split the processing load of TypeScript compilation between file emission on the main process and type checking on a forked process.
Large projects can also opt-out of AOT compilation for faster rebuilds.
### Production optimizations
Angular CLI focuses on enabling tree-shaking (removing unused modules) and dead code elimination (removing unused module code).
These two categories have high potential for size reduction because of network effects: removing code can lead to more code being removed.
The main tool we use to achieve this goal are the dead code elimination capabilities of [Terser](https://github.com/terser/terser).
We also use Terser's mangling, by which names, but not properties, are renamed to shorter forms.
The main characteristics of Terser to keep in mind is that it operates via static analysis and does not support the indirection introduced by module loading.
Thus the rest of the pipeline is directed towards providing Terser with code that can be removed via static analysis in large single modules scopes.
To this end we developed [@angular-devkit/build-optimizer](https://github.com/angular/angular-cli/tree/main/packages/angular_devkit/build_optimizer), a post-processing tool for TS code.
Build Optimizer searches for code patterns produced by the TypeScript and Angular compiler that are known to inhibit dead code elimination, and converts them into equivalent structures that enable it instead (the link above contains some examples).
It also adds Terser [annotations](https://github.com/terser/terser#annotations) marking top-level functions as free from side effects for libraries that have the `sideEffects` flag set to false in `package.json`.
Webpack itself also contains two major features that enable tree-shaking and dead code elimination: [`sideEffects` flag](https://github.com/webpack/webpack/tree/master/examples/side-effects) support and [module concatenation](https://webpack.js.org/plugins/module-concatenation-plugin/).
Having the `sideEffects` flag set to false in `package.json` of a library means that library has no top-level side-effects and only exposes imports, which allows Webpack to rewrite imports to that library directly to the modules used and not including non-imported modules at all.
Module concatenation allows Webpack to collect in a single module the content of several modules, which in turn allows Terser to more easily remove unused code since there is no module loading indirection between those modules.
One significant pitfall of this optimization strategy is the use of code splitting.
Using code splitting is desirable in order to speed up loading of web apps by deferring code that is not necessary on the initial load.
But since code splitting necessarily makes use of module loading, it is at odds with Terser-based optimizations.
The use of lazy loading can not only prevent further optimizations, but also regress the currently possible ones by [preventing module concatenation](https://webpack.js.org/plugins/module-concatenation-plugin/#optimization-bailouts).
Modules that were concatenated when lazy modules are not present might not be concatenated anymore after lazy loading is introduced because these modules now need to be accessed from the lazy modules and thus get their own module scope.
Aside from tree-shaking, scripts and styles (as defined in the sources above) also undergo optimizations via [Terser](https://github.com/terser/terser) and [CleanCSS](https://github.com/jakubpawlowicz/clean-css) respectively.
## Post-processing steps
There are some steps that are meant to operate over whole applications and thus happen after the compilation finishes and outputs files.
The steps are described in the order in which they are executed during a build.
The execution order was determined based on the complexity of the step with a primary goal of minimizing the repetition of computationally expensive operations.
### Differential Loading
Differential loading is a strategy that allows your web application to support multiple browsers, but only load the necessary code that the browser needs.
When differential loading is enabled, the CLI generates two distinct variants of application bundles.
- The first contains ES2015 syntax, takes advantage of built-in support in modern browsers, ships fewer polyfills, and results in a smaller total size.
- The second contains code in the older ES5 syntax, along with all necessary polyfills for Angular to function. This results in a larger total size, but supports older browsers.
This process as designed has the advantage that only one full compilation of the application in ES2015 syntax is required.
This removes a large amount of otherwise unnecessary and duplicate processing such as module resolution and dead code elimination.
It also guarantees that the application is ES5 compliant including third-party code.
The two variants of application bundles are created by the following steps:
1. A full build of the application is performed using an ES2015 output target.
The application's global stylesheets, scripts, and assets are also processed during this step via the full build. These elements are reused for both of application variants.
2. A copy of the JavaScript output application files are transformed (commonly referred to as down-leveled) to ES5 compatible syntax.
ES2015+ syntax elements such as classes are converted into functionally equivalent ES5 code structures.
3. An additional ES5-only polyfills file is generated that contains the required Angular polyfills for ES5-only browsers.
4. A single index HTML file is created that references both application variants and is designed to only load the appropriate files for each browser.
To support loading the file sets in the appropriate browsers, the HTML `script` element's `type` and `nomodule` attributes are leveraged.
Browsers will only load a script with a known type.
The ES2015 files are referenced using a type of `module` which is only supported on browsers that support ES2015+ code.
Since browsers that do not support ES2015+ code also do not support the `module` script type, these scripts are ignored for browsers that cannot parse and execute the ES2015 code.
Browsers that support the `module` script type also support the `nomodule` attribute.
This attribute instructs a browser that supports module scripts to ignore the script with the attribute. There is one browser exception in this case: Safari 10.1.
This browser supports module scripts but does not support the `nomodule` attribute.
To support this case, a special polyfill script is included to provide a workaround for the browser.
This arrangement of script elements ensures that ES5-only browsers will only execute the ES5 script files and browsers that support ES2015+ will only execute the ES2015 script files.
### Localization (i18n)
The second of these post-processing steps is build-time localization.
The final js bundles are processed using `@angular/localize`, replacing any locale-specific translations.
This sort of localization produces one application for each locale, each in their own folders.
### Service Worker
The third and last post-processing step is the creation of a [service worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API).
A listing of final application files is taken, fingerprinted according to their content, and added to the service worker manifest.
This must be the last step because it needs each application file to not be modified further.
| {
"end_byte": 15515,
"start_byte": 6782,
"url": "https://github.com/angular/angular-cli/blob/main/docs/design/build-system.md"
} |
angular-cli/docs/design/analytics.md_0_4366 | # Usage Metrics Gathering
This document list exactly what is gathered and how.
Any change to analytics should most probably include a change to this document.
## Dimensions and Metrics
Google Analytics Custom Dimensions are used to track system values and flag values. These
dimensions are aggregated automatically on the backend.
One dimension per flag, and although technically there can be an overlap between 2 commands, for
simplicity it should remain unique across all CLI commands. The dimension is the value of the
`x-user-analytics` field in the `schema.json` files.
### Adding dimension or metic.
1. Create the dimension or metric in [Google Analytics](https://analytics.google.com/) first. These are not tracked if they aren't
defined in Google Analytics.
1. Use the ID of the dimension as the `x-user-analytics` value in the `schema.json` file.
1. New dimension and metrics PRs need to be approved by the tooling lead and require a new [Launch](http://go/launch).
### Deleting a dimension or metic.
1. Archive the dimension and metric in [Google Analytics](https://analytics.google.com/).
**DO NOT ADD `x-user-analytics` FOR VALUES THAT ARE USER IDENTIFIABLE (PII), FOR EXAMPLE A
PROJECT NAME TO BUILD OR A MODULE NAME.**
### Limits
| Item | Standard property limits |
|-------------------------------- |-------------------------- |
| Event-scoped custom dimensions | 50 |
| User-scoped custom dimensions | 25 |
| All custom metrics | 50 |
### List of User Custom Dimensions
<!--USER_DIMENSIONS_TABLE_BEGIN-->
| Name | Parameter | Type |
|:---:|:---|:---|
| UserId | `up.ng_user_id` | `string` |
| OsArchitecture | `up.ng_os_architecture` | `string` |
| NodeVersion | `up.ng_node_version` | `string` |
| NodeMajorVersion | `upn.ng_node_major_version` | `number` |
| AngularCLIVersion | `up.ng_cli_version` | `string` |
| AngularCLIMajorVersion | `upn.ng_cli_major_version` | `number` |
| PackageManager | `up.ng_package_manager` | `string` |
| PackageManagerVersion | `up.ng_pkg_manager_version` | `string` |
| PackageManagerMajorVersion | `upn.ng_pkg_manager_major_v` | `number` |
<!--USER_DIMENSIONS_TABLE_END-->
### List of Event Custom Dimensions
<!--DIMENSIONS_TABLE_BEGIN-->
| Name | Parameter | Type |
|:---:|:---|:---|
| Command | `ep.ng_command` | `string` |
| SchematicCollectionName | `ep.ng_schematic_collection_name` | `string` |
| SchematicName | `ep.ng_schematic_name` | `string` |
| Standalone | `ep.ng_standalone` | `string` |
| SSR | `ep.ng_ssr` | `string` |
| Style | `ep.ng_style` | `string` |
| Routing | `ep.ng_routing` | `string` |
| InlineTemplate | `ep.ng_inline_template` | `string` |
| InlineStyle | `ep.ng_inline_style` | `string` |
| BuilderTarget | `ep.ng_builder_target` | `string` |
| Aot | `ep.ng_aot` | `string` |
| Optimization | `ep.ng_optimization` | `string` |
<!--DIMENSIONS_TABLE_END-->
### List of Event Custom Metrics
<!--METRICS_TABLE_BEGIN-->
| Name | Parameter | Type |
|:---:|:---|:---|
| AllChunksCount | `epn.ng_all_chunks_count` | `number` |
| LazyChunksCount | `epn.ng_lazy_chunks_count` | `number` |
| InitialChunksCount | `epn.ng_initial_chunks_count` | `number` |
| ChangedChunksCount | `epn.ng_changed_chunks_count` | `number` |
| DurationInMs | `epn.ng_duration_ms` | `number` |
| CssSizeInBytes | `epn.ng_css_size_bytes` | `number` |
| JsSizeInBytes | `epn.ng_js_size_bytes` | `number` |
| NgComponentCount | `epn.ng_component_count` | `number` |
| AllProjectsCount | `epn.all_projects_count` | `number` |
| LibraryProjectsCount | `epn.libs_projects_count` | `number` |
| ApplicationProjectsCount | `epn.apps_projects_count` | `number` |
<!--METRICS_TABLE_END-->
## Debugging
Using `NG_DEBUG=1` will enable Google Analytics debug mode, To view the debug events, in Google Analytics go to `Configure > DebugView`.
## Disabling Usage Analytics
There are 2 ways of disabling usage analytics:
1. using `ng analytics disable --global` (or changing the global configuration file yourself). This is the same
as answering "No" to the prompt.
1. There is an `NG_CLI_ANALYTICS` environment variable that overrides the global configuration.
That flag is a string that represents the User ID. If the string `"false"` is used it will
disable analytics for this run.
| {
"end_byte": 4366,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/design/analytics.md"
} |
angular-cli/docs/design/deployurl-basehref.md_0_1185 | | | Deploy URL | Base HREF |
| ------------------------------------------- | :--------: | :-------: |
| Initial scripts (index.html) | ✅ 👍 | ✅ 👍 |
| Initial stylesheets (index.html) | ✅ 👍 | ✅ 👍 |
| Lazy scripts (routes/import()/etc.) | ✅ 👍 | ✅ 👍 |
| Processed CSS resources (images/fonts/etc.) | ✅ 👍 | ✅ 👍 |
| Relative template (HTML) assets | ❌ 👎 | ✅ 👍 |
| Angular Router Default Base (APP_BASE_HREF) | ❌ | ✅ \*1 |
| Single reference in deployed Application | ❌ 👎 | ✅ 👍 |
| Special resource logic within CLI | ✅ 👎 | ❌ 👍 |
| Relative fetch/XMLHttpRequest | ❌ | ✅ |
✅ - has/affects the item/trait
❌ - does not have/affect the item/trait
👍 - favorable behavior
👎 - unfavorable behavior
\*1 -- Users with more complicated setups may need to manually configure the `APP_BASE_HREF` token within the application. (e.g., application routing base is `/` but assets/scripts/etc. are at `/assets/`)
| {
"end_byte": 1185,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/design/deployurl-basehref.md"
} |
angular-cli/docs/design/third-party-libraries.md_0_8763 | # Installing third party libraries
# Abstract
The current `ng install` process is faulty; third parties have to add a `bundles/` directory
with metadata that we expect. This document explores ways to improve on the process.
# Requirements
The following use cases need to be supported by `ng install`:
1. Support for _any_ thirdparties, ultimately falling back to running `npm install` only and
doing nothing else, if necessary.
1. Not a new package manager.
1. Metadata storage by thirdparties in `package.json`. This must be accessible by plugins for
the build process or even when scaffolding.
1. Proper configuration of SystemJs in the browser.
1. SystemJS configuration managed by the user needs to be kept separated from the autogenerated
part.
1. The build process right now is faulty because the `tmp/` directory used by Broccoli is
inside the project. TypeScript when using `moduleResolution: "node"` can resolve the
`node_modules` directory (since it's in an ancestor folder), which means that TypeScript
compiles properly, but the build does not copy files used by TypeScript to `dist/`. We need
to proper map the imports and move them to `tmp` before compiling, then to `dist/` properly.
1. Potentially hook into scaffolding.
1. Potentially hook into the build.
1. Safe uninstall path.
# Usages
Here's a few stories that should work right off:
```sh
$ ng new my-app && cd my-app/
$ ng install jquery
```
^(this makes jQuery available in the index)
```sh
$ ng install angularfire2
> Please specify your Firebase database URL [my-app.firebaseio.com]: _
```
^(makes firebase available and provided to the App)
```sh
$ ng install angularfire2 --dbUrl=my-firebase-db.example.com
```
^(skip prompts for values passed on the command line)
```sh
$ ng install angularfire2 --quiet
```
^(using `--quiet` to skip all prompts and use default values)
```sh
$ ng install less
```
^(now compiles CSS files with less for the appropriate extensions)
# Proposed Solution
The `install` task will perform the following subtasks:
1. **Run `npm install ${libName}`.** On failure, fail the install process.
1. **Run `preinstall` scripts.** If any script fails, run `npm uninstall ${libName}` and fail
the install process.
1. **Copy the `appData` to the `angular.json` file of the generated app, creating it if it
doesn't exist, under the `"modules"` key.** This data will be sent to the App as is. See the
[appData](#appData) section for more information.
1. **Read the `package["angular-cli"].appPrompt` and prompt the user configuration values,
if any.** See the [appData](#appData) section for more information.
1. **Add the providers specified in `package["angular-cli"]["providers"]` to the angular.js
`providers` list.** Rebuild the `providers.js` file. See the [Providers](#providers)
section for more information.
1. **Run `package["angular-cli"].scripts["install"]` if it exists.** If the script fails,
run `npm uninstall ${libName}` and fail the install process.
1. **Detect if a package named `angular/cli-wrapper-${libName}` exist in the angular
organization.** If so, run the steps above as if ng install angular/angular-${libName}. If
this install fails, ignore the failure.
These packages can be used to wrap libraries that we want to support but can't update
easily, like Jasmine or LESS.
1. **Install typings.** See the [Typings](#typings) section.
1. **Run `postinstall` scripts.**
# Proof of Concept
A proof of concept is being developed.
# Hooks
The third party library can implement hooks into the scaffolding, and the build system. The
CLI's tasks will look for the proper hooks prior to running and execute them.
The order of execution of these hooks is breadth first, going through all node packages and
checking for the `package['angular-cli']['hooks']['${hookName}']`. The hooks are then
`require()`'d as is, from within the app root folder. Within the same level of the dependency
tree, there is no guarantee for the order of execution.
## Install Hooks
The only tricky part here is install hooks. The installed package should recursively call
its `(pre|post|)install` hooks only on packages that are newly installed. It should call
`(pre|post|)reinstall` on those who were already installed. A map of the currently installed
packages should be kept before performing `npm install`.
# <a name="appData">appData</a>
The `angular-cli` key in the generated app should be used for Angular CLI specific data.
This includes the CLI configuration itself, as well as third-parties library configuration.
Third-parties can store data that will be passed to the app, and can use that data themselves.
That data can be anything. Any keys starting with either `$` or `_` will be ignored and not
passed to the client. It could be used for builds or scaffolding information.
During installation, there's a step to prompt the user for data. The schema contains a prompt
text and a default value. The default value type is used to convert the string entered by the
user. The key used in `appPrompt` is the key saved in appData.
Example:
```typescript
{ // ...
"angular-cli": {
"appPrompt": {
"number": {
"prompt": "Please enter a number:",
"defaultValue": 0
},
"url": {
"prompt": "URL of your website:",
"defaultValue": "${homepage}"
}
}
}
}
```
The default value is necessary as a `quiet` mode is enforced, using default values to fill
in the data without user interaction. The special strings `${...}` can be used to replace
with special values in the default string values. The values are taken from the `package.json`.
We use a declarative style to enforce sensible defaults and make sure developers think about
this. _In the case where developers want more complex interaction, they can use the
install/uninstall hooks to prompt users._ But 3rd party libraries developers need to be aware
that those hooks might not prompt users (no STDIN) and throw an error.
# <a name="providers">Providers</a>
Adding Angular providers to the app should be seamless. The install process will create a
`providers.js` from all the providers contained in all the dependencies. The User can disclude
providers it doesn't want.
The `providers.js` file will always be overwritten by the `install` / `uninstall` process. It
needs to exist for toolings to be able to understand dependencies. These providers are global
to the application.
In order to prevent providers from being global, the user can use the `--no-global-providers`
flag during installation, or can change the dependencies by using `ng providers`. As an example:
```bash
ng new my-todo-app
ng generate component database
ng install --no-global-providers angularfirebase2
ng providers database angularfirebase2
```
Or, alternatively, the user can add its own providers and dependencies to its components.
# Dependencies
Because dependencies are handled by `npm`, we don't have to handle it.
# <a name="typings">Typings</a>
Typings should be added, but failure to find typings should not be a failure of installation. The
user might still want to install custom typings himself in the worst case.
The `typings` package can be used to install/verify that typings exist. If the typings do not exist natively, we should tell the user to install the ambient version if he wants to.
# Index.html
We do not touch the `index.html` file during the installation task. The default page should
link to a SystemJS configuration file that is auto generated by the CLI and not user
configurable (see SystemJS below). If the user install a third party library, like jQuery, and
wants to use it, they have to import it using `import * as $ from 'vendor/jquery'`.
The `index.html` also includes a section to configure SystemJS that can be managed by the user.
This is separate from the generated code.
# SystemJS
It is important that SystemJS works without any modifications by the user. It is also important
to leave the liberty to the user to change the SystemJS configuration so that it fits their needs.
We will not use SystemJS bundles in development. This is for better debugging, future proofing
(when moving the build system) and better CDN support, as many of the loaded files will end up
being pulled from a CDN in production. During the `ng build` process for production, the
SystemJS configuration script will be rebuilt to fetch from the CDN.
# Upgrade Strategy
The upgrade process simply uses NPM. If new appData is added, it should be added manually using
a migration hook for `postinstall`.
# Remaining Problems
1. Installing dependencies of packages need to be further sketched out.
2. Need to add a fully fledged example with Firebase.
| {
"end_byte": 8763,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/design/third-party-libraries.md"
} |
angular-cli/docs/specifications/schematic-collections-config.md_0_1280 | # Schematics Collections (`schematicCollections`)
The `schematicCollections` can be placed under the `cli` option in the global `.angular.json` configuration, at the root or at project level in `angular.json` .
```jsonc
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"cli": {
"schematicCollections": ["@schematics/angular", "@angular/material"]
}
// ...
}
```
## Rationale
When this option is not configured and a user would like to run a schematic which is not part of `@schematics/angular`,
the collection name needs to be provided to `ng generate` command in the form of `[collection-name:schematic-name]`. This make the `ng generate` command too verbose for repeated usages.
This is where the `schematicCollections` option can be useful. When adding `@angular/material` to the list of `schematicCollections`, the generate command will try to locate the schematic in the specified collections.
```
ng generate navigation
```
is equivalent to:
```
ng generate @angular/material:navigation
```
## Conflicting schematic names
When multiple collections have a schematic with the same name. Both `ng generate` and `ng new` will run the first schematic matched based on the ordering (as specified) of `schematicCollections`.
| {
"end_byte": 1280,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/specifications/schematic-collections-config.md"
} |
angular-cli/docs/specifications/update.md_0_9092 | # Update Command
`ng update` is a new command in the CLI to update one or multiple packages, its peer dependencies, and the peer dependencies that depends on it.
If there are inconsistencies, for example if peer dependencies cannot be matches by a simple semver range, the tool will error out (and nothing will be committed on the filesystem).
## Command Line Usage
```bash
ng update <package1 [package2 [...]]> [options]
```
You can specify more than one package. Each package follows the convention of `[@scope/]packageName[@version-range-or-dist-tag]`. Packages not found in your dependencies will trigger an error. Any package that has a higher version in your `package.json` will trigger an error.
| Flag | Argument | Description |
| ---------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--force` | `boolean` | If true, skip the verification step and perform the update even if some peer dependencies would be invalidated. Peer dependencies errors will still be shown as warning. Defaults to false. |
| `--next` | `boolean` | If true, allows version discovery to include Beta and RC. Defaults to false. |
| `--migrate-only` | `boolean` | If true, don't change the `package.json` file, only apply migration scripts. |
| `--from` | `version` | Apply migrations from a certain version number. |
| `--to` | `version` | Apply migrations up to a certain version number (inclusive). By default will update to the installed version. |
## Details
The schematic performs the following steps, in order:
1. Get all installed package names and versions from the `package.json` into `dependencyMap: Map<string, string>`.
1. From that map, fetch all `package.json` from the NPM repository, which contains all versions, and gather them in a `Map<string, NpmPackageJson>`.
1. At the same time, update the `Map<>` with the version of the package which is believed to be installed (largest version number matching the version range).
1. **WARNING**: this might not be the exact installed versions, unfortunately. We should have a proper `package-lock.json` loader, and support `yarn.lock` as well, but these are stretch goals (and where do we stop).
1. For each packages mentioned on the command line, update to the target version (by default largest non-beta non-rc version):
```python
# ARGV The packages being requested by the user.
# NPM A map of package name to a map of version to PackageJson structure.
# V A map of package name to available versions.
# PKG A map of package name to PackageJson structure, for the installed versions.
# next A flag for the "--next" command line argument.
# First add all updating packages' peer dependencies. This should be recursive but simplified
# here for readability.
ARGV += [ NPM[p][max([ v for v in V[p] if (not is_beta(v) or next) ])].peerDependencies
for p in ARGV ]
for p in ARGV:
x = max([ v for v in V[p] if (not is_beta(v) or next) ])
for other in set(PKG.keys()) - set([ p ]):
# Verify all packages' peer dependencies.
if has(other.peerDependencies, p) and !compatible(x, other.peerDependencies[p]):
showError('Cannot update dependency "%s": "%s" is incompatible with the updated dependency' % (x, other))
if any( has(other.peerDependencies, peer) and !compatible(x, other.peerDependencies[peer])
for peer in PKG[p].peerDependencies.keys() ):
showError('Cannot update dependency "%s": "%s" depends on an incompatible peer dependency' % (x, other))
update_package_json(p, x)
```
## Library Developers
Libraries are responsible for defining their own update schematics. The `ng update` tool will update the package.json, and if it detects the `"ng-update"` key in package.json of the library, will run the update schematic on it (with version information metadata).
If a library does not define the `"ng-update"` key in their package.json, they are considered not supporting the update workflow and `ng update` is basically equivalent to `npm install`.
### Migration
In order to implement migrations in a library, the author must add the `ng-update` key to its `package.json`. This key contains the following fields:
| Field Name | Type | Description |
| ------------------ | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `requirements` | `{ [packageName: string]: VersionRange }` | A map of package names to version to check for minimal requirement. If one of the libraries listed here does not match the version range specified in `requirements`, an error will be shown to the user to manually update those libraries. For example, `@angular/core` does not support updates from versions earlier than 5, so this field would be `{ '@angular/core': '>= 5' }`. |
| `migrations` | `string` | A relative path (or resolved using Node module resolution) to a Schematics collection definition. |
| `packageGroup` | `string[]` | A list of npm packages that are to be grouped together. When running the update schematic it will automatically include all packages as part of the packageGroup in the update (if the user also installed them). |
| `packageGroupName` | `string` | The name of the packageGroup to use. By default, uses the first package in the packageGroup. The packageGroupName needs to be part of the packageGroup and should be a valid package name. |
#### Example given:
Library my-lib wants to have 2 steps to update from version 4 -> 4.5 and 4.5 to 5. It would add this information in its `package.json`:
```json
{
"ng-update": {
"requirements": {
"my-lib": "^5"
},
"migrations": "./migrations/migration-collection.json"
}
}
```
And create a migration collection (same schema as the Schematics collection):
```json
{
"schematics": {
"migration-01": {
"version": "6",
"factory": "./update-6"
},
"migration-02": {
"version": "6.2",
"factory": "./update-6_2"
},
"migration-03": {
"version": "6.3",
"factory": "./update-6_3"
},
"migration-04": {
"version": "7",
"factory": "./update-7"
},
"migration-05": {
"version": "8",
"factory": "./update-8"
}
}
}
```
The update tool would then read the current version of library installed, check against all `version` fields and run the schematics, until it reaches the version required by the user (inclusively). If such a collection is used to update from version 5 to version 7, the `01`, `02`, `03,` and `04` functions would be called. If the current version is 7 and a `--refactor-only` flag is passed, it would run the migration `04` only. More arguments are needed to know from which version you are updating.
Running `ng update @angular/core` would be the same as `ng generate @angular/core/migrations:migration-01`.
| {
"end_byte": 9092,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/specifications/update.md"
} |
angular-cli/docs/specifications/update.md_9092_11241 | ## Use cases
### Help
`ng update`, shows what updates would be applied;
```sh
$ ng update
We analyzed your package.json, there's some packages to update:
Name Version Command to update
----------------------------------------------------------------------------
@angular/cli 1.7.0 > 6.0.0 ng update @angular/cli
@angular/core 5.4.3 > 6.0.1 ng update @angular/core
@angular/material 5.2.1 > 6.0.0 ng update @angular/material
@angular/router 5.4.3 > 6.0.1 ng update @angular/core
There might be additional packages that are outdated.
```
### Simple Multi-steps
I have a dependency on Angular, Material and CLI. I want to update the CLI, then Angular, then Material in separate steps.
#### Details
1. `ng update @angular/cli`.
Updates the CLI and packages that have a peer dependencies on the CLI (none), running refactoring tools from CLI 1 to 6.
1. `ng update @angular/core`.
Updates the Core package and all packages that have a peer dependency on it. This can get tricky if `@angular/material` get caught in the update because the version installed does not directly allow the new version of `@angular/core`. In this case
### Complex Case
package.json:
```json
{
"dependencies": {
"@angular/material": "5.0.0",
"@angular/core": "5.5.5"
}
}
```
Commands:
```bash
ng update @angular/core
```
- updates `@angular/core` to the `latest` dist-tag (6.0.0)
- sees that `@angular/material` is not compatible with 6.0.0; **error out.**
```bash
ng update @angular/material
```
- update `@angular/material` to latest version, that should be compatible with the current `@angular/core`.
- if that version is not compatible with you
- tell the user about a higher version that requires an update to `@angular/core`.
## Notes
1. if someone is on CLI 1.5, the command is not supported. The user needs to update to `@angular/cli@latest`, then `ng update @angular/cli`. Post install hook will check versions of cli configuration and show a message to run the `ng update` command.
1. NPM proxies or cache are not supported by the first version of this command.
| {
"end_byte": 11241,
"start_byte": 9092,
"url": "https://github.com/angular/angular-cli/blob/main/docs/specifications/update.md"
} |
angular-cli/docs/specifications/universal-gotchas.md_0_9523 | # Important Considerations when Using Angular Universal
## Introduction
Although the goal of the Universal project is the ability to seamlessly render an Angular
application on the server, there are some inconsistencies that you should consider. First,
there is the obvious discrepancy between the server and browser environments. When rendering
on the server, your application is in an ephemeral or "snapshot" state. The application is
fully rendered once, with the resulting HTML returned, and the remaining application state
destroyed until the next render. Next, the server environment inherently does not have the
same capabilities as the browser (and has some that likewise the browser does not). For
instance, the server does not have any concept of cookies. You can polyfill this and other
functionality, but there is no perfect solution for this. In later sections, we'll walk
through potential mitigations to reduce the scope of errors when rendering on the server.
Please also note the goal of SSR: improved initial render time for your application. This
means that anything that has the potential to reduce the speed of your application in this
initial render should be avoided or sufficiently guarded against. Again, we'll review how
to accomplish this in later sections.
## "window is not defined"
One of the most common issues when using Angular Universal is the lack of browser global
variables in the server environment. This is because the Universal project uses
[domino](https://github.com/fgnass/domino) as the server DOM rendering engine. As a result,
there is certain functionality that won't be present or supported on the server. This
includes the `window` and `document` global objects, cookies, certain HTML elements (like canvas),
and several others. There is no exhaustive list, so please be aware of the fact that if you
see an error like this, where a previously-accessible global is not defined, it's likely because
that global is not available through domino.
> Fun fact: Domino stands for "DOM in Node"
### How to fix?
#### Strategy 1: Injection
Frequently, the needed global is available through the Angular platform via Dependency Injection (DI).
For instance, the global `document` is available through the `DOCUMENT` token. Additionally, a _very_
primitive version of both `window` and `location` exist through the `DOCUMENT` object. For example:
```ts
// example.service.ts
import { Injectable, Inject } from '@angular/core';
import { DOCUMENT } from '@angular/common';
@Injectable()
export class ExampleService {
constructor(@Inject(DOCUMENT) private _doc: Document) {}
getWindow(): Window | null {
return this._doc.defaultView;
}
getLocation(): Location {
return this._doc.location;
}
createElement(tag: string): HTMLElement {
return this._doc.createElement(tag);
}
}
```
Please be judicious about using these references, and lower your expectations about their capabilities. `localStorage`
is one frequently-requested API that won't work how you want it to out of the box. If you need to write your own library
components, please consider using this method to provide similar functionality on the server (this is what Angular CDK
and Material do).
#### Strategy 2: Guards
If you can't inject the proper global value you need from the Angular platform, you can "guard" against
invocation of browser code, so long as you don't need to access that code on the server. For instance,
often invocations of the global `window` element are to get window size, or some other visual aspect.
However, on the server, there is no concept of "screen", and so this functionality is rarely needed.
You may read online and elsewhere that the recommended approach is to use `isPlatformBrowser` or
`isPlatformServer`. This guidance is **incorrect**. This is because you wind up creating platform-specific
code branches in your application code. This not only increases the size of your application unnecessarily,
but it also adds complexity that then has to be maintained. By separating code into separate platform-specific
modules and implementations, your base code can remain about business logic, and platform-specific exceptions
are handled as they should be: on a case-by-case abstraction basis. This can be accomplished using Angular's Dependency
Injection (DI) in order to remove the offending code and drop in a replacement at runtime. Here's an example:
```ts
// window-service.ts
import { Injectable } from '@angular/core';
@Injectable()
export class WindowService {
getWidth(): number {
return window.innerWidth;
}
}
```
```ts
// server-window.service.ts
import { Injectable } from '@angular/core';
import { WindowService } from './window.service';
@Injectable()
export class ServerWindowService extends WindowService {
getWidth(): number {
return 0;
}
}
```
```ts
// app-server.module.ts
import {NgModule} from '@angular/core';
import {WindowService} from './window.service';
import {ServerWindowService} from './server-window.service';
@NgModule({
providers: [{
provide: WindowService,
useClass: ServerWindowService,
}]
})
```
If you have a component provided by a third-party that is not Universal-compatible out of the box,
you can create two separate modules for browser and server (the server module you should already have),
in addition to your base app module. The base app module will contain all of your platform-agnostic code,
the browser module will contain all of your browser-specific/server-incompatible code, and vice-versa for
your server module. In order to avoid editing too much template code, you can create a no-op component
to drop in for the library component. Here's an example:
```ts
// example.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'example-component',
template: `<library-component></library-component>`, // this is provided by a third-party lib
// that causes issues rendering on Universal
})
export class ExampleComponent {}
```
```ts
// app.module.ts
import {NgModule} from '@angular/core';
import {ExampleComponent} from './example.component';
@NgModule({
declarations: [ExampleComponent],
})
```
```ts
// browser-app.module.ts
import {NgModule} from '@angular/core';
import {LibraryModule} from 'some-lib';
import {AppModule} from './app.module';
@NgModule({
imports: [AppModule, LibraryModule],
})
```
```ts
// library-shim.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'library-component',
template: '',
})
export class LibraryShimComponent {}
```
```ts
// server.app.module.ts
import { NgModule } from '@angular/core';
import { LibraryShimComponent } from './library-shim.component';
import { AppModule } from './app.module';
@NgModule({
imports: [AppModule],
declarations: [LibraryShimComponent],
})
export class ServerAppModule {}
```
#### Strategy 3: Shims
If all else fails, and you simply must have access to some sort of browser functionality, you can patch
the global scope of the server environment to include the globals you need. For instance:
```ts
// server.ts
global['window'] = {
// properties you need implemented here...
};
```
This can be applied to any undefined element. Please be careful when you do this, as playing with the global
scope is generally considered an anti-pattern.
> Fun fact: a shim is a patch for functionality that will never be supported on a given platform. A
> polyfill is a patch for functionality that is planned to be supported, or is supported on newer versions
## Application is slow, or worse, won't render
The Angular Universal rendering process is straightforward, but just as simply can be blocked or slowed down
by well-meaning or innocent-looking code. First, some background on the rendering process. When a render
request is made for platform-server (the Angular Universal platform), a single route navigation is executed.
When that navigation completes, meaning that all Zone.js macrotasks are completed, the DOM in whatever state
it's in at that time is returned to the user.
> A Zone.js macrotask is just a JavaScript macrotask that executes in/is patched by Zone.js
This means that if there is a process, like a microtask, that takes up ticks to complete, or a long-standing
HTTP request, the rendering process will not complete, or will take longer. Macrotasks include calls to globals
like `setTimeout` and `setInterval`, and `Observables`. Calling these without cancelling them, or letting them run
longer than needed on the server could result in suboptimal rendering.
> It may be worth brushing up on the JavaScript event loop and learning the difference between microtasks
> and macrotasks, if you don't know it already. [Here's](https://javascript.info/event-loop) a good reference.
## My HTTP, Firebase, WebSocket, etc. won't finish before render!
Similarly to the above section on waiting for macrotasks to complete, the flip-side is that the platform will
not wait for microtasks to complete before finishing the render. In Angular Universal, we have patched the
Angular HTTP client to turn it into a macrotask, to ensure that any needed HTTP requests complete for a given
render. However, this type of patch may not be appropriate for all microtasks, and so it is recommended you use
your best judgment on how to proceed. You can look at the code reference for how Universal wraps a task to turn
it into a macrotask, or you can simply opt to change the server behavior of the given tasks.
| {
"end_byte": 9523,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/specifications/universal-gotchas.md"
} |
angular-cli/docs/specifications/schematic-prompts.md_0_5945 | # Schematic Prompts
Schematic prompts provide the ability to introduce user interaction into the schematic execution. The schematic runtime supports the ability to allow schematic options to be configured to display a customizable question to the user and then use the response as the value for the option. These prompts are displayed before the execution of the schematic. This allows users direct the operation of the schematic without requiring indepth knowledge of the full spectrum of options available to the user.
To enable this capability, the JSON Schema used to define the schematic's options supports extensions to allow the declarative definition of the prompts and their respective behavior. No additional logic or changes are required to the JavaScript for a schematic to support the prompts.
## Basic Usage
To illustrate the addition of a prompt to an existing schematic the following example JSON schema for a hypothetical _hello world_ schematic will be used.
```json
{
"properties": {
"name": {
"type": "string",
"minLength": 1,
"default": "world"
},
"useColor": {
"type": "boolean"
}
}
}
```
Suppose it would be preferred if the user was asked for their name. This can be accomplished by augmenting the `name` property definition with an `x-prompt` field.
```json
"x-prompt": "What is your name?"
```
In most cases, only the text of the prompt is required. To minimize the amount of necessary configuration, the above _shorthand_ form is supported and will typically be all that is required. Full details regarding the _longhand_ form can be found in the **Configuration Reference** section.
Adding a prompt to allow the user to decided whether the schematic will use color when executing its hello action is also very similar. The schema with both prompts would be as follows:
```json
{
"properties": {
"name": {
"type": "string",
"minLength": 1,
"default": "world",
"x-prompt": "What is your name?"
},
"useColor": {
"type": "boolean",
"x-prompt": "Would you like the response in color?"
}
}
}
```
Prompts have several different types which provide the ability to display an input method that best represents the schematic option's potential values.
- `confirmation` - A **yes** or **no** question; ideal for boolean options
- `input` - textual input; ideal for string or number options
- `list` - a predefined set of items which may be selected
When using the _shorthand_ form, the most appropriate type will automatically be selected based on the property's schema. In the example, the `name` prompt will use an `input` type because it is a `string` property. The `useColor` prompt will use a `confirmation` type because it is a boolean property with `yes` corresponding to `true` and `no` corresponding to `false`.
It is also important that the response from the user conforms to the constraints of the property. By specifying constraints using the JSON schema, the prompt runtime will automatically validate the response provided by the user. If the value is not acceptable, the user will be asked to enter a new value. This ensures that any values passed to the schematic will meet the expectations of the schematic's implementation and removes the need to add additional checks within the schematic's code.
## Configuration Reference
The `x-prompt` field supports two alternatives to enable a prompt for a schematic option. A shorthand form when additional customization is not required and a longhand form providing the ability for more control over the prompt. All user responses are validated against the property's schema. For example, string type properties can use a minimum length or regular expression constraint to control the allowed values. In the event the response fails validation, the user will be asked to enter a new value.
### Longhand Form
In the this form, the `x-prompt` field is an object with subfields that can be used to customize the behavior of the prompt. Note that some fields only apply to specific prompt types.
| Field | Data Value | Default |
| --------- | ----------------------------------------- | --------------------------------- |
| `type` | `confirmation`, `input`, `list` | see shorthand section for details |
| `message` | string | N/A (required) |
| `items` | string and/or `label`/`value` object pair | only valid with type `list` |
### Shorthand Form
`x-prompt` [type: string] --> Question to display to the user.
For this usage, the type of the prompt is determined by the type of the containing property.
| Property Schema | Prompt Type | Notes |
| ------------------- | :------------: | :---------------------------------: |
| `"type": "boolean"` | `confirmation` | |
| `"type": "string"` | `input` | |
| `"type": "number"` | `input` | only valid numbers accepted |
| `"type": "integer"` | `input` | only valid numbers accepted |
| `"enum": [...]` | `list` | enum members become list selections |
### `x-prompt` Schema
```json
{
"oneOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"type": { "type": "string" },
"message": { "type": "string" },
"items": {
"type": "array",
"items": {
"oneOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"label": { "type": "string" },
"value": {}
},
"required": ["value"]
}
]
}
}
},
"required": ["message"]
}
]
}
```
| {
"end_byte": 5945,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/specifications/schematic-prompts.md"
} |
angular-cli/docs/process/bazel.md_0_4128 | ## Yarn Workspaces
The package architecture of `angular-cli` repository is originally setup using
yarn [workspaces](https://yarnpkg.com/lang/en/docs/workspaces/). This means the
dependencies of various `package.json` in the repository are linked and
installed together.
## Bazel
Since then, Bazel was introduced to manage some of the build dependencies in
`angular-cli` repo. However, Bazel does **not** yet support yarn workspaces,
since it requires laying out more than one `node_modules` directory. In this
mixed mode, developers ought to take extra care to synchronize the dependencies.
Since the `yarn_install` rule that installs all NPM dependencies in this
repository only reads from the **root** `package.json`, every Bazel target that
depends on packages downloaded from the NPM registry will need to have the
dependency declared in the **root** `package.json`.
In addition, if the dependency is also needed at runtime (non-dev dependencies),
the dependency on the individual package's `package.json` has to be updated as
well. This is to ensure that when users download a published version from NPM,
they will be able to install all dependencies correctly without Bazel. It is the
responsibility of the developer to keep both `package.json` in sync.
## Windows support
In general, any sort of node file lookup on Bazel should be subject to `require.resolve`.
This is how rules_nodejs resolves paths using the Bazel runfiles mechanism, where a given
Bazel target only has access to outputs from its dependencies.
In practice, this does not make a lot of difference on Linux.
A symlink forest is laid down where the target is going to actually run, and mostly the
files are resolved correctly whether you use `require.resolve` or not because the files are there.
On Windows though, that's a stricter. Bazel does not lay down a symlink forest on
windows by default. If you don't use `require.resolve`, it's still possible to correctly
resolve some files, like outputs from other rules. But other files, like node modules
dependencies and data files, need to be looked up in the runfiles.
Since the requirement is quite lax on Linux but quite strict on windows, what ends up
happening is that lack of `require.resolve` calls go unnoticed until someone tries to run
things on Windows, at which point it breaks.
## Debugging jasmine_node_test
On Linux, Bazel tests will run under a sandbox for isolation.
You can turn off this sandbox by adding the [`local = True`](https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes-tests) attribute to the rule.
You can also force local execution by passing `--test_output=streamed`.
Then you will find the intermediate test files in `bazel-out/k8-fastbuild/bin`, followed by the test target path.
Tests that are sharded, via the `shard_count` attribute, can fail if you reduce the number of tests or focus only a few.
This will cause some shards to execute 0 tests, which makes the exit with an error code.
Tests that are marked as flaky, via the `flaky` attribute, will repeat when they fail.
This will cause any focused test to be repeated multiple time, since the presence of focused tests
causes jasmine to exit with a non-zero exit code.
While testing, you can remove the `shard_count` attribute to prevent sharding and the `flaky`
attribute to prevent repetition.
Setting `--test_output=streamed` will disable sharding and `--flaky_test_attempts=1` will disable
the reruns of tests that have been marked as `flaky`.
The `.bazelrc` includes a config for running tests with remote debugging enabled:
```sh
yarn bazel test --config=debug //packages/angular/cli:angular-cli_test
# Also disable reruns of failing tests that were marked as flaky:
yarn bazel test --config=debug --config=no-sharding //packages/angular/cli:angular-cli_test
```
NB: For a few tests, sandbox is required as otherwise the rules_nodejs linker symlinks will conflict
with the yarn workspace symlinks in node_modules.
## Issues
1. Yarn workspaces is not compatible with Bazel-managed deps
[(#12736)](https://github.com/angular/angular-cli/issues/12736)
| {
"end_byte": 4128,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/process/bazel.md"
} |
angular-cli/docs/process/release.md_0_7084 | # Setting Up Local Repository
1. Clone the Angular-CLI repo. A local copy works just fine.
1. Create an upstream remote:
```bash
$ git remote add upstream https://github.com/angular/angular-cli.git
```
# Caretaker
The caretaker should triage issues, merge PR, and sheppard the release.
Caretaker rotation can be found
[here](https://rotations.corp.google.com/rotation/5117919353110528) and individual shifts can
be modified as necessary to accommodate caretaker's schedules. This automatically syncs to a
Google Calendar
[here](https://calendar.google.com/calendar/u/0/[email protected]).
Click the "+" button in the bottom right to add it to your calendar to see shifts alongside the
rest of your schedule.
The primary caretaker is responsible for both merging PRs and performing the weekly release.
The secondary caretaker does not have any _direct_ responsibilities, but they may need to take
over the primary's responsibilities if the primary is unavailable for an extended time (a day
or more) or in the event of an emergency.
At the end of each caretaker's rotation, the primary should perform a handoff in which they
provide information to the next caretaker about the current state of the repository and update
the access group to now include the next caretakers. To perform this update to the access group,
the caretaker can run:
```bash
$ yarn ng-dev caretaker handoff
```
## Merging PRs
The list of PRs which are currently ready to merge (approved with passing status checks) can
be found with [this search](https://github.com/angular/angular-cli/pulls?q=is%3Apr+is%3Aopen+label%3A%22action%3A+merge%22+-is%3Adraft).
This list should be checked daily and any ready PRs should be merged. For each PR, check the
`target` label to understand where it should be merged to. You can find which branches a specific
PR will be merged into with the `yarn ng-dev pr check-target-branches <pr>` command.
When ready to merge a PR, run the following command:
```
yarn ng-dev pr merge <pr>
```
### Maintaining LTS branches
Releases that are under Long Term Support (LTS) are listed on [angular.dev](https://angular.dev/reference/releases#support-policy-and-schedule).
Since there could be more than one LTS branch at any one time, PR authors who want to
merge commits into LTS branches must open a pull request against the specific base branch they'd like to target.
In general, cherry picks for LTS should only be done if it meets one of the criteria below:
1. It addresses a critical security vulnerability.
2. It fixes a breaking change in the external environment.
For example, this could happen if one of the dependencies is deleted from NPM.
3. It fixes a legitimate failure on CI for a particular LTS branch.
# Release
Releasing is performed using Angular's unified release tooling. Each week, two releases are expected, `latest` and `next` on npm. For major
and minor releases, some dependencies need to be manually bumped. The following files contain all the version numbers which need to be
manually updated:
- [`latest-versions.ts`](/packages/schematics/angular/utility/latest-versions.ts#L=18)
- [`latest-versions/package.json`](/packages/schematics/angular/utility/latest-versions/package.json)
- [`@angular/pwa`](/packages/angular/pwa/package.json)
- [`@angular-devkit/build-angular`](/packages/angular_devkit/build_angular/package.json)
- [`@ngtools/webpack`](/packages/ngtools/webpack/package.json)
**DURING a minor OR major CLI release:**
Once FW releases the actual minor/major release (for example: `13.0.0` or `13.1.0`), the above versions should be updated to match (remove
`-rc.0` and `-next.0`). This **must** be done as a separate PR which lands _after_ FW releases (or else CI will fail) but _before_ the CLI
release PR. Releases are built before the PR is sent for review, so any changes after that point won't be included in the release.
**AFTER a major CLI release:**
Once a major release is complete, peer dependencies in the above files will need to be updated to "undo" the above change and add the
prerelease version segment on `main`. For example, `"@angular/compiler-cli": "^13.0.0-next.0"` should become
`"@angular/compiler-cli": "^13.0.0 || ^13.1.0-next.0"`. This should be done for all the peer deps in the above files.
**AFTER a minor OR major CLI release:**
`latest-versions.ts` also needs to be updated to use `-next.0` after a major or minor release. However this needs to happen _after_ FW
publishes the initial `-next.0` release, which will happen 1 week after the major or minor release.
## Releasing the CLI
Typical patch and next releases do not require FW to release in advance, as CLI does not pin the FW
dependency.
After confirming that the above steps have been done or are not necessary, run the following and
navigate the prompts:
```sh
yarn ng-dev release publish
```
Releases should be done in "reverse semver order", meaning they should follow:
Oldest LTS -> Newest LTS -> Patch -> RC -> Next
This can skip any versions which don't need releases, so most weeks are just "Patch -> Next".
## Releasing a new package
Wombat has some special access requirements which need to be configured to publish a new NPM package.
See [this Wombat doc](http://g3doc/company/teams/cloud-client-libraries/team/automation/docs/npm-publish-service#existing-package)
and [this postmortem](http://docs/document/d/1emx2mhvF5xMzNUlDrVRYKI_u4iUOnVrg3rV6c5jk2is?resourcekey=0-qpsFbBfwioYT4f6kyUm8ZA&tab=t.0)
for more info.
Angular is _not_ an organization on NPM, therefore each package is published
independently and Wombat access needs to be managed individually. This also means
we can't rely on Wombat already having access to a new package.
In order to configure a brand new NPM package, it first needs to be published
manually so we can add Wombat access to it. Note that this step can and should be
done prior to weekly releases. The sooner this can be done, the less likely it
will block the next weekly release.
1. Check out the `main` branch, which should always have a `-next` version.
- This avoids having the initial publish actually be used in production.
1. Trigger a release build locally.
```shell
nvm install
yarn --frozen-lockfile
yarn -s ng-dev release build
```
1. Log in to NPM as `angular`.
```shell
npm login
```
- See these two Valentine entries for authentication details:
- https://valentine.corp.google.com/#/show/1460636514618735
- https://valentine.corp.google.com/#/show/1531867371192103
1. Publish the release.
```shell
(cd dist/releases/my-scope/my-pkg/ && npm publish --access public)
```
1. Add Wombat to the package.
```shell
npm owner add google-wombot @my-scope/my-pkg
```
1. Don't forget to logout.
```shell
npm logout
```
1. File a bug like [b/336626936](http://b/336626936) to ask Wombat maintainers to
accept the invite for the new package.
Once Wombat accepts the invite, regular automated releases should work as expected.
| {
"end_byte": 7084,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/docs/process/release.md"
} |
angular-cli/scripts/build.mts_0_5071 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { spawn } from 'node:child_process';
import { COPYFILE_FICLONE } from 'node:constants';
import fs from 'node:fs';
import path, { dirname, join, relative, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const baseDir = resolve(`${__dirname}/..`);
const bazelCmd = process.env.BAZEL ?? `yarn --cwd "${baseDir}" bazel`;
const distRoot = join(baseDir, '/dist');
type BuildMode = 'local' | 'snapshot' | 'release';
function _copy(from: string, to: string) {
// Create parent folder if necessary.
if (!fs.existsSync(dirname(to))) {
fs.mkdirSync(dirname(to), { recursive: true });
}
// Error out if destination already exists.
if (fs.existsSync(to)) {
throw new Error(`Path ${to} already exist...`);
}
from = relative(process.cwd(), from);
to = relative(process.cwd(), to);
fs.copyFileSync(from, to, COPYFILE_FICLONE);
}
function _recursiveCopy(from: string, to: string, logger: Console) {
if (!fs.existsSync(from)) {
logger.error(`File "${from}" does not exist.`);
process.exit(4);
}
if (fs.statSync(from).isDirectory()) {
fs.readdirSync(from).forEach((fileName) => {
_recursiveCopy(join(from, fileName), join(to, fileName), logger);
});
} else {
_copy(from, to);
}
}
function _clean(logger: Console) {
logger.info('Cleaning...');
logger.info(' Removing dist/...');
return fs.promises.rm(join(__dirname, '../dist'), {
force: true,
recursive: true,
maxRetries: 3,
});
}
function _exec(cmd: string, captureStdout: boolean, logger: Console): Promise<string> {
return new Promise((resolve, reject) => {
const proc = spawn(cmd, {
stdio: 'pipe',
shell: true,
});
let output = '';
proc.stdout.on('data', (data) => {
logger.info(data.toString().trim());
if (captureStdout) {
output += data.toString().trim();
}
});
proc.stderr.on('data', (data) => logger.info(data.toString().trim()));
proc.on('error', (error) => {
logger.error(error.message);
});
proc.on('exit', (status) => {
if (status !== 0) {
reject(`Command failed: ${cmd}`);
} else {
resolve(output);
}
});
});
}
async function _build(logger: Console, mode: BuildMode): Promise<string[]> {
logger.group(`Building (mode=${mode})...`);
logger.group('Finding targets...');
const queryTargetsCmd = `${bazelCmd} query --output=label "attr(name, npm_package_archive, //packages/...)"`;
const targets = (await _exec(queryTargetsCmd, true, logger)).split(/\r?\n/);
logger.groupEnd();
// If we are in release mode, run `bazel clean` to ensure the execroot and action cache
// are not populated. This is necessary because targets using `npm_package` rely on
// workspace status variables for the package version. Such NPM package targets are not
// rebuilt if only the workspace status variables change. This could result in accidental
// re-use of previously built package output with a different `version` in the `package.json`.
if (mode == 'release') {
logger.info('Building in release mode. Resetting the Bazel execroot and action cache.');
await _exec(`${bazelCmd} clean`, false, logger);
}
logger.group('Building targets...');
await _exec(`${bazelCmd} build --config=${mode} ${targets.join(' ')}`, false, logger);
logger.groupEnd();
logger.groupEnd();
return targets;
}
export default async function (
argv: { local?: boolean; snapshot?: boolean } = {},
): Promise<{ name: string; outputPath: string; tarPath: string }[]> {
const logger = globalThis.console;
const bazelBin = await _exec(`${bazelCmd} info bazel-bin`, true, logger);
await _clean(logger);
let buildMode: BuildMode;
if (argv.local) {
buildMode = 'local';
} else if (argv.snapshot) {
buildMode = 'snapshot';
} else {
buildMode = 'release';
}
const targets = await _build(logger, buildMode);
const output = [];
logger.group('Moving packages and tars to dist/');
for (const target of targets) {
const packageDir = target.replace(/\/\/packages\/(.*):npm_package_archive/, '$1');
const bazelOutDir = join(bazelBin, 'packages', packageDir, 'npm_package');
const tarPathInBin = `${bazelBin}/packages/${packageDir}/npm_package_archive.tgz`;
const packageJsonPath = `${bazelOutDir}/package.json`;
const packageName = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).name;
const destDir = `${distRoot}/${packageName}`;
logger.info(packageName);
_recursiveCopy(bazelOutDir, destDir, logger);
const tarPath = `${distRoot}/${packageName.replace('@', '_').replace('/', '_')}.tgz`;
_copy(tarPathInBin, tarPath);
output.push({ name: packageDir, outputPath: destDir, tarPath });
}
logger.groupEnd();
return output;
}
| {
"end_byte": 5071,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/build.mts"
} |
angular-cli/scripts/templates.mts_0_1700 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import lodash from 'lodash';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import { releasePackages } from './packages.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
async function _runTemplate(inputPath: string, outputPath: string) {
inputPath = path.resolve(__dirname, inputPath);
outputPath = path.resolve(__dirname, outputPath);
console.info(`Building ${path.relative(path.dirname(__dirname), outputPath)}...`);
// TODO(ESM): Consider making this an actual import statement.
const { COMMIT_TYPES, ScopeRequirement } = await new Function(
`return import('@angular/ng-dev');`,
)();
const monorepo = JSON.parse(fs.readFileSync('./.monorepo.json', 'utf-8'));
const content = lodash.template(fs.readFileSync(inputPath, 'utf-8'))({
monorepo,
packages: releasePackages.map(({ name }) => name),
encode: (x: string) => global.encodeURIComponent(x),
// Pass-through `ng-dev` ESM commit message information for the `contributing.ejs`
// template. EJS templates using the devkit template cannot use ESM.
COMMIT_TYPES: COMMIT_TYPES,
ScopeRequirement: ScopeRequirement,
});
fs.writeFileSync(outputPath, content, 'utf-8');
}
export default async function (_options: {}): Promise<number> {
await Promise.all([
_runTemplate('./templates/readme.ejs', '../README.md'),
_runTemplate('./templates/contributing.ejs', '../CONTRIBUTING.md'),
]);
return 0;
}
| {
"end_byte": 1700,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/templates.mts"
} |
angular-cli/scripts/circular-deps-test.conf.mjs_0_1449 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { statSync } from 'node:fs';
import { join } from 'node:path';
import { packages } from './packages.mjs';
export const baseDir = '../';
export const goldenFile = '../goldens/circular-deps/packages.json';
export const glob = '../packages/**/*.ts';
// Command that will be displayed if the golden needs to be updated.
export const approveCommand = 'yarn ts-circular-deps approve';
/**
* Custom module resolver that maps specifiers for local packages folder.
* This ensures that cross package/entry-point dependencies can be detected.
*/
const LOCAL_MAPPINGS = Object.entries(packages).map(([name, pkg]) => [name, pkg.root]);
export function resolveModule(specifier) {
let localSpecifierPath;
for (const [key, value] of LOCAL_MAPPINGS) {
if (specifier.startsWith(key)) {
localSpecifierPath = specifier.replace(key, value);
break;
}
}
if (!localSpecifierPath) {
return null;
}
const lookups = [
localSpecifierPath,
`${localSpecifierPath}.ts`,
join(localSpecifierPath, 'src/index.ts'),
join(localSpecifierPath, 'index.ts'),
];
for (const lookup of lookups) {
try {
if (statSync(lookup).isFile()) {
return lookup;
}
} catch {}
}
return null;
}
| {
"end_byte": 1449,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/circular-deps-test.conf.mjs"
} |
angular-cli/scripts/create.mts_0_3456 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import assert from 'node:assert';
import * as child_process from 'node:child_process';
import { copyFile, readFile, rm, writeFile } from 'node:fs/promises';
import * as path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import build from './build.mjs';
import { packages } from './packages.mjs';
export interface CreateOptions extends Record<string, unknown> {
_: string[];
}
const __dirname = path.dirname(fileURLToPath(import.meta.url));
async function _exec(command: string, args: string[], opts: { cwd?: string }) {
const { status, error, stderr, stdout } = child_process.spawnSync(command, args, { ...opts });
if (status != 0) {
console.error(`Command failed: ${command} ${args.map((x) => JSON.stringify(x)).join(', ')}`);
if (error) {
console.error('Error: ' + (error ? error.message : 'undefined'));
} else {
console.error(`STDERR:\n${stderr}`);
}
throw error;
}
return { stdout };
}
export default async function (args: CreateOptions, cwd: string): Promise<number> {
const { _, ...otherArgOptions } = args;
const projectName = _[0];
assert(projectName, 'Project name must be provided.');
const ngNewAdditionalOptions = Object.entries(otherArgOptions).map(
([key, value]) => `--${key}=${value}`,
);
const oldCwd = process.cwd();
console.info('Building...');
const buildResult = await build({ local: true });
const cliBuild = buildResult.find(({ name }) => name === 'angular/cli');
assert(cliBuild);
process.chdir(cwd);
// The below is needed as NPX does not guarantee that the updated version is used unless the file name changes.
const newTarballName = cliBuild.tarPath.replace('.tgz', '-' + Date.now() + '.tgz');
await copyFile(cliBuild.tarPath, newTarballName);
console.info('Creating project...');
try {
await _exec(
'npx',
[
'--yes',
pathToFileURL(newTarballName).toString(),
'new',
projectName,
'--skip-install',
'--skip-git',
'--no-interactive',
...ngNewAdditionalOptions,
],
{ cwd },
);
} finally {
await rm(newTarballName, { maxRetries: 3 });
}
console.info('Updating package.json...');
const packageJsonPath = path.join(projectName, 'package.json');
const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf-8'));
packageJson['dependencies'] ??= {};
packageJson['devDependencies'] ??= {};
packageJson['overrides'] ??= {};
// Set the dependencies to the new build we just used.
for (const packageName of packages.map(({ name }) => name)) {
const tar = path.join(__dirname, '../dist', packageName.replace(/\/|@/g, '_') + '.tgz');
if (packageName in packageJson['dependencies']) {
packageJson['dependencies'][packageName] = tar;
} else if (packageName in packageJson['devDependencies']) {
packageJson['devDependencies'][packageName] = tar;
} else {
packageJson['overrides'][packageName] = tar;
}
}
await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');
console.info('Installing npm packages...');
await _exec('npm', ['install'], { cwd: path.join(cwd, projectName) });
process.chdir(oldCwd);
return 0;
}
| {
"end_byte": 3456,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/create.mts"
} |
angular-cli/scripts/snapshots.mts_0_5993 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { execSync, spawnSync } from 'node:child_process';
import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import build from './build.mjs';
import jsonHelp, { createTemporaryProject } from './json-help.mjs';
import { PackageInfo, packages } from './packages.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// Added to the README.md of the snapshot. This is markdown.
const readmeHeaderFn = (name: string, snapshotRepo: string) => `
# Snapshot build of ${name}
This repository is a snapshot of a commit on the original repository. The original code used to
generate this is located at http://github.com/angular/angular-cli.
We do not accept PRs or Issues opened on this repository. You should not use this over a tested and
released version of this package.
To test this snapshot in your own project, use
\`\`\`bash
npm install git+https://github.com/${snapshotRepo}.git
\`\`\`
----
`;
function _copy(from: string, to: string) {
fs.readdirSync(from).forEach((name) => {
const fromPath = path.join(from, name);
const toPath = path.join(to, name);
if (fs.statSync(fromPath).isDirectory()) {
if (!fs.existsSync(toPath)) {
fs.mkdirSync(toPath);
}
_copy(fromPath, toPath);
} else {
fs.writeFileSync(toPath, fs.readFileSync(fromPath));
}
});
}
const monorepoData = JSON.parse(fs.readFileSync('./.monorepo.json', 'utf-8'));
function _exec(command: string, args: string[], opts: { cwd?: string }) {
const { status, error, stdout } = spawnSync(command, args, {
stdio: ['ignore', 'pipe', 'inherit'],
...opts,
});
if (status != 0) {
console.error(`Command failed: ${command} ${args.map((x) => JSON.stringify(x)).join(', ')}`);
throw error;
}
return stdout.toString('utf-8');
}
let gitShaCache: string | undefined;
async function _publishSnapshot(
pkg: PackageInfo,
branch: string,
message: string,
githubToken: string,
) {
const snapshotRepo = monorepoData.packages[pkg.name]?.snapshotRepo;
if (!snapshotRepo) {
console.warn(`Skipping ${pkg.name}.`);
return;
}
console.info(`Publishing ${pkg.name} to repo ${snapshotRepo}.`);
const root = process.cwd();
console.debug('Temporary directory: ' + root);
const url = `https://${githubToken ? githubToken + '@' : ''}github.com/${snapshotRepo}.git`;
const destPath = path.join(root, path.basename(snapshotRepo));
_exec('git', ['clone', url], { cwd: root });
if (branch) {
// Try to checkout an existing branch, otherwise create it.
try {
_exec('git', ['checkout', branch], { cwd: destPath });
} catch {
_exec('git', ['checkout', '-b', branch], { cwd: destPath });
}
}
// Clear snapshot directory before publishing to remove deleted build files.
try {
_exec('git', ['rm', '-rf', './'], { cwd: destPath });
} catch {
// Ignore errors on delete. :shrug:
}
_copy(path.join(__dirname, '../dist', pkg.name), destPath);
if (githubToken) {
_exec('git', ['config', 'commit.gpgSign', 'false'], { cwd: destPath });
}
// Add the header to the existing README.md (or create a README if it doesn't exist).
const readmePath = path.join(destPath, 'README.md');
let readme = readmeHeaderFn(pkg.name, snapshotRepo);
try {
readme += fs.readFileSync(readmePath, 'utf-8');
} catch {}
fs.writeFileSync(readmePath, readme);
// Make sure that every snapshots is unique (otherwise we would need to make sure git accepts
// empty commits).
fs.writeFileSync(path.join(destPath, 'uniqueId'), '' + new Date());
// Ensure we call git from within this repo
gitShaCache ??= _exec('git', ['log', '--format=%h', '-n1'], { cwd: __dirname }).trim();
// Commit and push.
_exec('git', ['add', '.'], { cwd: destPath });
_exec('git', ['commit', '-a', '-m', message], { cwd: destPath });
_exec('git', ['tag', gitShaCache], { cwd: destPath });
_exec('git', ['push', 'origin', branch], { cwd: destPath });
_exec('git', ['push', '--tags', 'origin', branch], { cwd: destPath });
}
export interface SnapshotsOptions {
force?: boolean;
githubToken?: string;
branch?: string;
}
export default async function (opts: SnapshotsOptions) {
// Get the SHA.
if (execSync(`git status --porcelain`).toString() && !opts.force) {
console.error('You cannot run snapshots with local changes.');
process.exit(1);
}
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'angular-cli-publish-'));
const message = execSync(`git log --format="%h %s" -n1`).toString().trim();
let branch = opts.branch || 'main';
// CIRCLE_BRANCH
if (typeof process.env['CIRCLE_BRANCH'] == 'string') {
branch = '' + process.env['CIRCLE_BRANCH'];
}
const githubToken = (opts.githubToken || process.env.SNAPSHOT_BUILDS_GITHUB_TOKEN || '').trim();
if (githubToken) {
console.info('Setting up global git name.');
_exec('git', ['config', '--global', 'user.email', '[email protected]'], {});
_exec('git', ['config', '--global', 'user.name', 'Angular Builds'], {});
_exec('git', ['config', '--global', 'push.default', 'simple'], {});
}
// This is needed as otherwise when we run `devkit admin create` after `bazel build` the `dist`
// will be overridden with the output of the legacy build.
const temporaryProjectRoot = await createTemporaryProject();
// Run build.
console.info('Building...');
await build({ snapshot: true });
await jsonHelp({ temporaryProjectRoot });
if (!githubToken) {
console.info('No token given, skipping actual publishing...');
return 0;
}
for (const pkg of packages) {
process.chdir(root);
await _publishSnapshot(pkg, branch, message, githubToken);
}
return 0;
}
| {
"end_byte": 5993,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/snapshots.mts"
} |
angular-cli/scripts/json-help.mts_0_3328 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { spawnSync } from 'child_process';
import { promises as fs } from 'fs';
import { fileURLToPath } from 'node:url';
import * as os from 'os';
import * as path from 'path';
import create from './create.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export async function createTemporaryProject(): Promise<string> {
console.info('Creating temporary project...');
const newProjectTempRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'angular-cli-create-'));
const newProjectName = 'help-project';
const newProjectRoot = path.join(newProjectTempRoot, newProjectName);
await create({ _: [newProjectName] }, newProjectTempRoot);
return newProjectRoot;
}
export interface JsonHelpOptions {
temporaryProjectRoot?: string;
}
export default async function ({ temporaryProjectRoot }: JsonHelpOptions) {
console.info('Gathering JSON Help...');
const newProjectRoot = temporaryProjectRoot ?? (await createTemporaryProject());
const ngPath = path.join(newProjectRoot, 'node_modules/.bin/ng');
const helpOutputRoot = path.join(__dirname, '../dist/@angular/cli/help');
await fs.mkdir(helpOutputRoot);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const runNgCommandJsonHelp = async (args: string[]): Promise<any> => {
const { stdout, status } = spawnSync(ngPath, [...args, '--json-help', '--help'], {
cwd: newProjectRoot,
maxBuffer: 200_0000,
stdio: ['ignore', 'pipe', 'inherit'],
});
if (status === 0) {
try {
return JSON.parse(stdout.toString().trim());
} catch (e) {
console.error(`${e}`);
}
}
throw new Error(`Command failed: ${ngPath} ${args.map((x) => JSON.stringify(x)).join(', ')}.`);
};
const { subcommands: commands = [] } = await runNgCommandJsonHelp([]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const commandsHelp = commands.map((command: any) =>
runNgCommandJsonHelp([command.name]).then((c) => ({
...command,
...c,
})),
);
for await (const command of commandsHelp) {
const commandName = command.name;
const commandOptionNames = new Set([
...command.options.map(({ name }: { name: string }) => name),
]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const subCommandsHelp = command.subcommands?.map((subcommand: any) =>
runNgCommandJsonHelp([command.name, subcommand.name]).then((s) => ({
...s,
...subcommand,
// Filter options which are inherited from the parent command.
// Ex: `interactive` in `ng generate lib`.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: s.options.filter((o: any) => !commandOptionNames.has(o.name)),
})),
);
const jsonOutput = JSON.stringify(
{
...command,
subcommands: subCommandsHelp ? await Promise.all(subCommandsHelp) : undefined,
},
undefined,
2,
);
const filePath = path.join(helpOutputRoot, commandName + '.json');
await fs.writeFile(filePath, jsonOutput);
console.info(filePath);
}
}
| {
"end_byte": 3328,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/json-help.mts"
} |
angular-cli/scripts/validate.mts_0_1143 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { execSync } from 'child_process';
import templates from './templates.mjs';
import validateUserAnalytics from './validate-user-analytics.mjs';
export default async function (options: { verbose: boolean }) {
let error = false;
if (execSync(`git status --porcelain`).toString()) {
console.error('There are local changes.');
if (!options.verbose) {
return 101;
}
error = true;
}
console.info('Running templates validation...');
await templates({});
if (execSync(`git status --porcelain`).toString()) {
console.error(
'Running templates updated files... Please run "devkit-admin templates" before submitting a PR.',
);
if (!options.verbose) {
process.exit(2);
}
error = true;
}
console.info('');
console.info('Running User Analytics validation...');
error = (await validateUserAnalytics({})) != 0 || error;
if (error) {
return 101;
}
return 0;
}
| {
"end_byte": 1143,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/validate.mts"
} |
angular-cli/scripts/README.md_0_1505 | # DevKit Administrative Scripts
This folder contains all the scripts that can be run using `devkit-admin`.
In order to be able to use the DevKit scripts, you must first run:
```bash
$ npm link
```
This will link the binaries included in this repository, which includes the `devkit-admin` binary. This document
describes each scripts available.
## build
Builds the repo and the pack files. The output of `build` is in `dist/` and contains 1 tgz per package which can be
installed (the result of `npm pack` on that package), and a directory using the name of the package to publish.
Flags:
- `--local`. Enable building packages with dependencies to their pack files (instead of versions).
- `--snapshot`. Enable building packages with dependencies to their snapshot repos (instead of versions).
## packages
Outputs a JSON containing all informations from the package script (main files, repo names, versions, deps, etc).
## snapshots
Create and upload snapshots. This is used in CI.
Flags:
- `--force`. Force push the snapshot to github.
- `--githubToken=<string>`. The github token to update the changelog with. Either this of `--githubTokenFile` is
required.
- `--githubTokenFile=<path>`. Reads the githubToken from a file instead of the command line (for CI).
## templates
Compile and outputs the templates. For now, only README is being built and outputted.
## validate
Performs BUILD files and license validation.
Flags:
- `--verbose`. Ignore errors and continue showing outputs.
| {
"end_byte": 1505,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/README.md"
} |
angular-cli/scripts/devkit-admin.mts_0_1284 | #!/usr/bin/env node
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import colors from 'ansi-colors';
import path, { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import yargsParser from 'yargs-parser';
const args = yargsParser(process.argv.slice(2), {
boolean: ['verbose'],
configuration: {
'camel-case-expansion': false,
},
});
const scriptName = args._.shift();
const cwd = process.cwd();
const scriptDir = dirname(fileURLToPath(import.meta.url));
process.chdir(path.join(scriptDir, '..'));
const originalConsole = { ...console };
console.warn = function (...args) {
const [m, ...rest] = args;
originalConsole.warn(colors.yellow(m), ...rest);
};
console.error = function (...args) {
const [m, ...rest] = args;
originalConsole.error(colors.red(m), ...rest);
};
try {
const script = await import(`./${scriptName}.mjs`);
const exitCode = await script.default(args, cwd);
process.exitCode = typeof exitCode === 'number' ? exitCode : 0;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
console.error(err.stack);
process.exitCode = 99;
}
| {
"end_byte": 1284,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/devkit-admin.mts"
} |
angular-cli/scripts/validate-user-analytics.mts_0_6311 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import assert from 'assert';
import glob from 'fast-glob';
import * as fs from 'fs';
import lodash from 'lodash';
import * as path from 'path';
import { fileURLToPath } from 'url';
import {
EventCustomDimension,
EventCustomMetric,
UserCustomDimension,
} from '../packages/angular/cli/src/analytics/analytics-parameters.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const userAnalyticsTable = lodash.template(
fs.readFileSync(path.join(__dirname, './templates/user-analytics-table.ejs'), 'utf-8'),
);
const dimensionsTableRe = /<!--DIMENSIONS_TABLE_BEGIN-->([\s\S]*)<!--DIMENSIONS_TABLE_END-->/m;
const userDimensionsTableRe =
/<!--USER_DIMENSIONS_TABLE_BEGIN-->([\s\S]*)<!--USER_DIMENSIONS_TABLE_END-->/m;
const metricsTableRe = /<!--METRICS_TABLE_BEGIN-->([\s\S]*)<!--METRICS_TABLE_END-->/m;
async function _checkUserDimensions(dimensionsTable: string) {
console.info('Gathering user dimensions from @angular/cli...');
const data = Object.entries(UserCustomDimension).map(([key, value]) => ({
parameter: value,
name: key,
type: value.charAt(2) === 'n' ? 'number' : 'string',
}));
if (data.length > 25) {
throw new Error(
'GA has a limit of 25 custom user dimensions. Delete and archive the ones that are not needed.',
);
}
for (const { parameter } of data) {
const param = parameter.split('.')[1];
if (param.length > 24) {
throw new Error(`User dimension parameter ${param} is more than 24 characters.`);
}
}
const generatedTable = userAnalyticsTable({ data }).trim();
if (dimensionsTable !== generatedTable) {
console.error(
'Expected user dimensions table to be the same as generated. Copy the lines below:',
);
console.error(generatedTable);
return 3;
}
return 0;
}
async function _checkDimensions(dimensionsTable: string) {
console.info('Gathering event dimensions from @angular/cli...');
const eventCustomDimensionValues = new Set(Object.values(EventCustomDimension));
console.info('Gathering options for user-analytics...');
const schemaUserAnalyticsValidator = (obj: object) => {
for (const value of Object.values(obj)) {
if (value && typeof value === 'object') {
const userAnalytics = value['x-user-analytics'];
if (userAnalytics && !eventCustomDimensionValues.has(userAnalytics)) {
throw new Error(
`Invalid value found in enum AnalyticsDimensions: ${JSON.stringify(userAnalytics)}`,
);
} else {
schemaUserAnalyticsValidator(value);
}
}
}
};
// Find all the schemas
const { packages } = await import('./packages.mjs');
const packagesPaths = packages.map(({ root }) => root);
for (const packagePath of packagesPaths) {
const schemasPaths = await glob('**/schema.json', { cwd: packagePath });
for (const schemaPath of schemasPaths) {
const schema = await fs.promises.readFile(path.join(packagePath, schemaPath), 'utf8');
schemaUserAnalyticsValidator(JSON.parse(schema));
}
}
const data = Object.entries(EventCustomDimension).map(([key, value]) => ({
parameter: value,
name: key,
type: value.charAt(2) === 'n' ? 'number' : 'string',
}));
if (data.length > 50) {
throw new Error(
'GA has a limit of 50 custom event dimensions. Delete and archive the ones that are not needed.',
);
}
for (const { parameter } of data) {
const param = parameter.split('.')[1];
if (param.length > 40) {
throw new Error(`Event dimension parameter ${param} is more than 40 characters.`);
}
}
const generatedTable = userAnalyticsTable({ data }).trim();
if (dimensionsTable !== generatedTable) {
console.error(
'Expected event dimensions table to be the same as generated. Copy the lines below:',
);
console.error(generatedTable);
return 3;
}
return 0;
}
async function _checkMetrics(metricsTable: string) {
console.info('Gathering metrics from @angular/cli...');
const data = Object.entries(EventCustomMetric).map(([key, value]) => ({
parameter: value,
name: key,
type: value.charAt(2) === 'n' ? 'number' : 'string',
}));
if (data.length > 50) {
throw new Error(
'GA has a limit of 50 custom metrics. Delete and archive the ones that are not needed.',
);
}
for (const { parameter } of data) {
const param = parameter.split('.')[1];
if (param.length > 40) {
throw new Error(`Event metric parameter ${param} is more than 40 characters.`);
}
}
const generatedTable = userAnalyticsTable({ data }).trim();
if (metricsTable !== generatedTable) {
console.error('Expected metrics table to be the same as generated. Copy the lines below:');
console.error(generatedTable);
return 4;
}
return 0;
}
/**
* Validate that the table of analytics from the analytics.md document is the same as expected /
* generated.
*/
export default async function (_options: {}): Promise<number> {
const analyticsMarkdownPath = path.join(__dirname, '../docs/design/analytics.md');
const analyticsMarkdown = fs.readFileSync(analyticsMarkdownPath, 'utf8');
const dimensionsMatch = analyticsMarkdown.match(dimensionsTableRe);
const userDimensionsMatch = analyticsMarkdown.match(userDimensionsTableRe);
const metricsMatch = analyticsMarkdown.match(metricsTableRe);
assert.ok(dimensionsMatch, 'Event dimensions table not found in analytics.md');
assert.ok(userDimensionsMatch, 'User dimensions table not found in analytics.md');
assert.ok(metricsMatch, 'Metrics table not found in analytics.md');
const userDimensionsTable = userDimensionsMatch[1].trim();
let maybeError = await _checkUserDimensions(userDimensionsTable);
if (maybeError) {
return maybeError;
}
const metricsTable = metricsMatch[1].trim();
maybeError = await _checkMetrics(metricsTable);
if (maybeError) {
return maybeError;
}
const dimensionsTable = dimensionsMatch[1].trim();
maybeError = await _checkDimensions(dimensionsTable);
if (maybeError) {
return maybeError;
}
return 0;
}
| {
"end_byte": 6311,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/validate-user-analytics.mts"
} |
angular-cli/scripts/packages.mts_0_1234 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import fastGlob from 'fast-glob';
import { readFileSync } from 'node:fs';
import { dirname } from 'node:path';
export interface PackageInfo {
name: string;
root: string;
experimental: boolean;
packageJson: Record<string, boolean | number | string | object>;
}
function getPackages(): PackageInfo[] {
const packages: PackageInfo[] = [];
const monorepoData = JSON.parse(readFileSync('./.monorepo.json', 'utf-8'));
for (const pkg of fastGlob.sync('./packages/*/*/package.json', { absolute: true })) {
const packageJson = JSON.parse(readFileSync(pkg, 'utf-8'));
if (!(packageJson.name in monorepoData.packages)) {
throw new Error(`${packageJson.name} does not exist in .monorepo.json`);
}
packages.push({
name: packageJson.name,
experimental: !!packageJson.experimental,
root: dirname(pkg),
packageJson,
});
}
return packages;
}
export const packages = getPackages();
export const releasePackages = packages.filter(({ packageJson }) => !packageJson.private);
| {
"end_byte": 1234,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/packages.mts"
} |
angular-cli/scripts/build-schema.mts_0_2039 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { spawn } from 'node:child_process';
import { rm } from 'node:fs/promises';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const baseDir = resolve(`${__dirname}/..`);
const bazelCmd = process.env.BAZEL ?? `yarn bazel`;
const distRoot = join(baseDir, '/dist-schema/');
function _clean() {
console.info('Cleaning...');
console.info(' Removing dist-schema/...');
return rm(join(__dirname, '../dist-schema'), { force: true, recursive: true, maxRetries: 3 });
}
function _exec(cmd: string, captureStdout: boolean): Promise<string> {
return new Promise((resolve, reject) => {
const proc = spawn(cmd, {
stdio: 'pipe',
shell: true,
env: {
HOME: process.env.HOME,
PATH: process.env.PATH,
},
});
let output = '';
proc.stdout.on('data', (data) => {
console.info(data.toString().trim());
if (captureStdout) {
output += data.toString().trim();
}
});
proc.stderr.on('data', (data) => console.info(data.toString().trim()));
proc.on('error', (error) => {
console.error(error.message);
});
proc.on('exit', (status) => {
if (status !== 0) {
reject(`Command failed: ${cmd}`);
} else {
resolve(output);
}
});
});
}
async function _buildSchemas(): Promise<void> {
console.info(`Building schemas...`);
const queryTargetsCmd = `${bazelCmd} query --output=label "attr(name, .*_schema, //packages/...)"`;
const targets = (await _exec(queryTargetsCmd, true)).split(/\r?\n/);
await _exec(`${bazelCmd} build ${targets.join(' ')} --symlink_prefix=${distRoot}`, false);
}
export default async function (argv: {}): Promise<void> {
await _clean();
await _buildSchemas();
}
| {
"end_byte": 2039,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/build-schema.mts"
} |
angular-cli/scripts/build-packages-dist.mts_0_6955 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/**
* Script that builds the release output of all packages which have the "release-package
* Bazel tag set. The script builds all those packages and copies the release output to the
* distribution folder within the project.
*/
import { BuiltPackage } from '@angular/ng-dev';
import { execSync } from 'node:child_process';
import { chmodSync, copyFileSync, mkdirSync, rmSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import sh from 'shelljs';
/** Name of the Bazel tag that will be used to find release package targets. */
const releaseTargetTag = 'release-package';
/** Path to the project directory. */
const projectDir = join(dirname(fileURLToPath(import.meta.url)), '../');
/** Command that runs Bazel. */
const bazelCmd = process.env.BAZEL || `yarn bazel`;
/** Command that queries Bazel for all release package targets. */
const queryPackagesCmd =
`${bazelCmd} query --output=label "attr('tags', '\\[.*${releaseTargetTag}.*\\]', //packages/...) ` +
`intersect kind('ng_package|pkg_npm', //packages/...)"`;
/** Path for the default distribution output directory. */
const defaultDistPath = join(projectDir, 'dist/releases');
/** Builds the release packages for NPM. */
export function performNpmReleaseBuild(): BuiltPackage[] {
return buildReleasePackages(defaultDistPath, /* config */ 'release');
}
/**
* Builds the release packages as snapshot build. This means that the current
* Git HEAD SHA is included in the version (for easier debugging and back tracing).
*/
export function performDefaultSnapshotBuild(): BuiltPackage[] {
return buildReleasePackages(defaultDistPath, /* config */ 'snapshot');
}
export function performLocalPackageBuild(): BuiltPackage[] {
return buildReleasePackages(defaultDistPath, /* config */ 'local');
}
/**
* Builds the release packages with the given compile mode and copies
* the package output into the given directory.
*/
function buildReleasePackages(
distPath: string,
config: 'release' | 'snapshot' | 'local',
): BuiltPackage[] {
console.log('######################################');
console.log(` Building ${config} packages...`);
console.log('######################################');
// List of targets to build. e.g. "packages/angular/cli:npm_package"
const targets = exec(queryPackagesCmd, true).split(/\r?\n/);
const packageNames = getPackageNamesOfTargets(targets);
const bazelBinPath = exec(`${bazelCmd} info bazel-bin`, true);
const getBazelOutputPath = (pkgName: string) =>
join(bazelBinPath, 'packages', pkgName, 'npm_package');
const getDistPath = (pkgName: string) => join(distPath, pkgName);
// Build with "--config=release" or `--config=snapshot` so that Bazel
// runs the workspace stamping script. The stamping script ensures that the
// version placeholder is populated in the release output.
if (!['release', 'snapshot', 'local'].includes(config)) {
throw new Error('Invalid config value: ' + config);
}
const stampConfigArg = `--config=${config}`;
// Walk through each release package and clear previous "npm_package" outputs. This is
// a workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1219. We need to
// do this to ensure that the version placeholders are properly populated.
packageNames.forEach((pkgName) => {
// Directory output is created by the npm_package target
const directoryOutputPath = getBazelOutputPath(pkgName);
// Archive output is created by the npm_package_archive target
const archiveOutputPath = directoryOutputPath + '_archive.tgz';
if (sh.test('-d', directoryOutputPath)) {
sh.chmod('-R', 'u+w', directoryOutputPath);
sh.rm('-rf', directoryOutputPath);
}
try {
chmodSync(archiveOutputPath, '0755');
rmSync(archiveOutputPath, { force: true });
} catch {}
});
// Build both the npm_package and npm_package_archive targets for each package
// TODO: Consider switching to only using the archive for publishing
const buildTargets = targets.flatMap((target) => [target, target + '_archive']);
exec(`${bazelCmd} build ${stampConfigArg} ${buildTargets.join(' ')}`);
// Delete the distribution directory so that the output is guaranteed to be clean. Re-create
// the empty directory so that we can copy the release packages into it later.
rmSync(distPath, { force: true, recursive: true, maxRetries: 3 });
mkdirSync(distPath, { recursive: true });
// Copy the package output into the specified distribution folder.
packageNames.forEach((pkgName) => {
// Directory output is created by the npm_package target
const directoryOutputPath = getBazelOutputPath(pkgName);
// Archive output is created by the npm_package_archive target
const archiveOutputPath = directoryOutputPath + '_archive.tgz';
const targetFolder = getDistPath(pkgName);
console.log(`> Copying package output to "${targetFolder}"`);
// Ensure package scope directory exists prior to copying
mkdirSync(dirname(targetFolder), { recursive: true });
// Copy package contents to target directory
sh.cp('-R', directoryOutputPath, targetFolder);
sh.chmod('-R', 'u+w', targetFolder);
// Copy archive of package to target directory
const archiveTargetPath = join(distPath, `${pkgName.replace('/', '_')}.tgz`);
copyFileSync(archiveOutputPath, archiveTargetPath);
chmodSync(archiveTargetPath, '0755');
});
return packageNames.map((pkg) => {
return {
// Package names on disk do not have the @ scope prefix and use underscores instead of dashes
name: `@${pkg.replace(/_/g, '-')}`,
outputPath: getDistPath(pkg),
};
});
}
/**
* Gets the package names of the specified Bazel targets.
* e.g. //packages/angular/cli:npm_package = angular/cli
*/
function getPackageNamesOfTargets(targets: string[]): string[] {
return targets.map((targetName) => {
const matches = targetName.match(/\/\/packages\/(.*?):/);
if (matches === null) {
throw Error(
`Found Bazel target with "${releaseTargetTag}" tag, but could not ` +
`determine release output name: ${targetName}`,
);
}
return matches[1];
});
}
/** Executes the given command in the project directory. */
function exec(command: string): void;
/** Executes the given command in the project directory and returns its stdout. */
function exec(command: string, captureStdout: true): string;
function exec(command: string, captureStdout?: true) {
const stdout = execSync(command, {
cwd: projectDir,
stdio: ['inherit', captureStdout ? 'pipe' : 'inherit', 'inherit'],
});
if (captureStdout) {
process.stdout.write(stdout);
return stdout.toString().trim();
}
}
| {
"end_byte": 6955,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/build-packages-dist.mts"
} |
angular-cli/scripts/saucelabs/start-tunnel.sh_0_1646 | #!/usr/bin/env bash
set -x -u -e -o pipefail
readonly currentDir=$(cd $(dirname $0); pwd)
readonly connectVersion="sc-4.9.2-linux"
readonly connectHash="2f8a3f87e1da4dc9a41bc45ec7c3a2ecdba4c72d72b7d0193f04ad66c5809104"
echo "Downloading Sauce Connect"
curl https://saucelabs.com/downloads/${connectVersion}.tar.gz -o ${currentDir}/${connectVersion}.tar.gz
echo "${connectHash} ${currentDir}/${connectVersion}.tar.gz" | shasum -a 256 -c
tar -xzf ${currentDir}/${connectVersion}.tar.gz -C ${currentDir}
# Command arguments that will be passed to sauce-connect. By default we disable SSL bumping for
# all requests. This is because SSL bumping is not needed for our test setup and in order
# to perform the SSL bumping, Saucelabs intercepts all HTTP requests in the tunnel VM and modifies
# them. This can cause flakiness as it makes all requests dependent on the SSL bumping middleware.
# See: https://wiki.saucelabs.com/display/DOCS/Troubleshooting+Sauce+Connect#TroubleshootingSauceConnect-DisablingSSLBumping
sauceArgs="--no-ssl-bump-domains all"
if [[ ! -z "${SAUCE_LOG_FILE:-}" ]]; then
mkdir -p $(dirname ${SAUCE_LOG_FILE})
sauceArgs="${sauceArgs} --logfile ${SAUCE_LOG_FILE}"
fi
if [[ ! -z "${SAUCE_READY_FILE:-}" ]]; then
mkdir -p $(dirname ${SAUCE_READY_FILE})
sauceArgs="${sauceArgs} --readyfile ${SAUCE_READY_FILE}"
fi
if [[ ! -z "${SAUCE_PID_FILE:-}" ]]; then
mkdir -p $(dirname ${SAUCE_PID_FILE})
sauceArgs="${sauceArgs} --pidfile ${SAUCE_PID_FILE}"
fi
echo "Starting Sauce Connect. Passed arguments: ${sauceArgs}"
${currentDir}/${connectVersion}/bin/sc -u ${SAUCE_USERNAME} -k ${SAUCE_ACCESS_KEY} ${sauceArgs}
| {
"end_byte": 1646,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/saucelabs/start-tunnel.sh"
} |
angular-cli/scripts/saucelabs/stop-tunnel.sh_0_768 | #!/usr/bin/env bash
# Disable printing of any executed command because this would cause a lot
# of spam due to the loop.
set +x -u -e -o pipefail
if [[ ! -f ${SAUCE_PID_FILE} ]]; then
echo "Could not find Saucelabs tunnel PID file. Cannot stop tunnel.."
exit 1
fi
echo "Shutting down Sauce Connect tunnel"
# The process id for the sauce-connect instance is stored inside of the pidfile.
tunnelProcessId=$(cat ${SAUCE_PID_FILE})
# Kill the process by using the PID that has been read from the pidfile. Note that
# we cannot use killall because CircleCI base container images don't have it installed.
kill ${tunnelProcessId}
while (ps -p ${tunnelProcessId} &> /dev/null); do
printf "."
sleep .5
done
echo ""
echo "Sauce Connect tunnel has been shut down"
| {
"end_byte": 768,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/saucelabs/stop-tunnel.sh"
} |
angular-cli/scripts/saucelabs/wait-for-tunnel.sh_0_800 | #!/usr/bin/env bash
# Disable printing of any executed command because this would cause a lot
# of spam due to the loop.
set +x -u -e -o pipefail
# Waits for Saucelabs Connect to be ready before executing any tests.
counter=0
while [[ ! -f ${SAUCE_READY_FILE} ]]; do
counter=$((counter + 1))
# Counter needs to be multiplied by two because the while loop only sleeps a half second.
# This has been made in favor of better progress logging (printing dots every half second)
if [ $counter -gt $[${SAUCE_READY_FILE_TIMEOUT} * 2] ]; then
echo "Timed out after ${SAUCE_READY_FILE_TIMEOUT} seconds waiting for tunnel ready file."
echo "Printing logfile output:"
echo ""
cat ${SAUCE_LOG_FILE}
exit 5
fi
printf "."
sleep 0.5
done
echo ""
echo "Connected to Saucelabs"
| {
"end_byte": 800,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/saucelabs/wait-for-tunnel.sh"
} |
angular-cli/scripts/release-checks/dependency-ranges/index.mts_0_1651 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { Log, ReleasePrecheckError, bold } from '@angular/ng-dev';
import semver from 'semver';
import { checkSchematicsAngularLatestVersion } from './latest-versions-check.mjs';
import { PackageJson, checkPeerDependencies } from './peer-deps-check.mjs';
/** Environment variable that can be used to skip this pre-check. */
const skipEnvVar = 'SKIP_DEPENDENCY_RANGE_PRECHECK';
/**
* Ensures that dependency ranges are properly updated before publishing
* a new version. This check includes:
*
* - checking of `latest-versions.ts` of `@schematics/angular`.
* - checking of peer dependencies in `@angular-devkit/build-angular`.
*
* @throws {ReleasePrecheckError} If validation fails.
*/
export async function assertValidDependencyRanges(
newVersion: semver.SemVer,
allPackages: PackageJson[],
) {
if (process.env[skipEnvVar] === '1') {
return;
}
const failures: string[] = [
...(await checkPeerDependencies(newVersion, allPackages)),
...(await checkSchematicsAngularLatestVersion(newVersion)),
];
if (failures.length !== 0) {
Log.error('Discovered errors when validating dependency ranges.');
for (const f of failures) {
Log.error(` - ${bold(f)}`);
}
Log.warn();
Log.warn('Please fix these failures before publishing a new release.');
Log.warn(`These checks can be forcibly ignored by setting: ${skipEnvVar}=1`);
Log.warn();
throw new ReleasePrecheckError();
}
}
| {
"end_byte": 1651,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/release-checks/dependency-ranges/index.mts"
} |
angular-cli/scripts/release-checks/dependency-ranges/latest-versions-check.mts_0_1075 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { readFile } from 'node:fs/promises';
import semver from 'semver';
export async function checkSchematicsAngularLatestVersion(
newVersion: semver.SemVer,
): Promise<string[]> {
const { dependencies } = JSON.parse(
await readFile('./packages/schematics/angular/utility/latest-versions/package.json', 'utf-8'),
);
const keysToCheck = ['ng-packagr', '@angular/core'];
const { major, minor } = newVersion;
const isPrerelease = !!newVersion.prerelease[0];
const failures: string[] = [];
let expectedFwDep = `^${major}.${minor}.0`;
if (isPrerelease) {
expectedFwDep = `^${major}.${minor}.0-next.0`;
}
for (const key of keysToCheck) {
if (dependencies[key] !== expectedFwDep) {
failures.push(
`latest-versions: Invalid dependency range for "${key}". Expected: ${expectedFwDep}`,
);
}
}
return failures;
}
| {
"end_byte": 1075,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/release-checks/dependency-ranges/latest-versions-check.mts"
} |
angular-cli/scripts/release-checks/dependency-ranges/peer-deps-check.mts_0_1985 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import semver from 'semver';
/** Path to the current directory. */
/** Describes a parsed `package.json` file. */
export interface PackageJson {
name?: string;
peerDependencies?: Record<string, string>;
}
export async function checkPeerDependencies(
newVersion: semver.SemVer,
allPackages: PackageJson[],
): Promise<string[]> {
const { major, minor } = newVersion;
const isPrerelease = !!newVersion.prerelease[0];
const isMajor = minor === 0;
let expectedFwPeerDep = `^${major}.0.0`;
if (isMajor && isPrerelease) {
expectedFwPeerDep += ` || ^${major}.0.0-next.0`;
} else if (isPrerelease) {
expectedFwPeerDep += ` || ^${major}.${minor}.0-next.0`;
}
const failures: string[] = [];
for (const pkgInfo of allPackages) {
failures.push(...checkPackage(pkgInfo, expectedFwPeerDep));
}
return failures;
}
/** Checks the given package and collects errors for the peer dependency ranges. */
function checkPackage(pkgJson: PackageJson, expectedFwPeerDep: string): string[] {
if (pkgJson.peerDependencies === undefined) {
return [];
}
const failures: string[] = [];
for (const [depName, range] of Object.entries(pkgJson.peerDependencies)) {
// Even though `ng-packagr` might not strictly follow the same release schedules
// like official Angular packages, we generally expect it to match. It's better
// flagging it than silently passing pre-checks. The caretaker can always forcibly
// ignore this check.
if (!depName.startsWith('@angular/') && depName !== 'ng-packagr') {
continue;
}
if (range !== expectedFwPeerDep) {
failures.push(
`${pkgJson.name}: Unexpected peer dependency range for "${depName}". Expected: ${expectedFwPeerDep}`,
);
}
}
return failures;
}
| {
"end_byte": 1985,
"start_byte": 0,
"url": "https://github.com/angular/angular-cli/blob/main/scripts/release-checks/dependency-ranges/peer-deps-check.mts"
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.