Skip to content

build: initial attempt to fix docs site deployment #30372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions material.angular.io/tools/lighthouse-audit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ async function _main(args) {
onError('Lighthouse failed to return any results.');
}
const success = await processResults(results, minScores, logFile);
console.log(`\nCompleted audit of ${url} in ${((Date.now() - startTime) / 1000).toFixed(1)}s\n`);
console.log(
`\nCompleted audit of ${url} in ${((Date.now() - startTime) / 1000).toFixed(1)}s\n`,
);

if (!success) {
onError('One or more scores are below the minimum required.');
Expand Down Expand Up @@ -191,12 +193,12 @@ function parseInput(args) {
if (unknownCategories.length > 0) {
onError(
`Invalid arguments: <min-scores> contains unknown category(-ies): ${unknownCategories.join(
', '
)}`
', ',
)}`,
);
} else if (!allValuesValid) {
onError(
`Invalid arguments: <min-scores> has non-numeric or out-of-range values: ${minScoresRaw}`
`Invalid arguments: <min-scores> has non-numeric or out-of-range values: ${minScoresRaw}`,
);
}

Expand Down Expand Up @@ -232,7 +234,7 @@ function parseMinScores(raw) {

if (minScores.hasOwnProperty('all')) {
AUDIT_CATEGORIES.forEach(
cat => minScores.hasOwnProperty(cat) || (minScores[cat] = minScores.all)
cat => minScores.hasOwnProperty(cat) || (minScores[cat] = minScores.all),
);
delete minScores.all;
}
Expand Down Expand Up @@ -273,7 +275,7 @@ async function processResults(results, minScores, logFile) {
console.log(
` - ${paddedTitle} ${formatScore(score)} (Required: ${formatScore(minScore)}) ${
passed ? 'OK' : 'FAILED'
}`
}`,
);

return aggr && passed;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@angular/cli": "^19.1.0-rc.0",
"@angular/compiler-cli": "^19.1.0-rc.0",
"@angular/localize": "^19.1.0-rc.0",
"@angular/ng-dev": "https://github.com/angular/dev-infra-private-ng-dev-builds.git#36946be4df61f6549ae3829c026022e47674eae2",
"@angular/ng-dev": "https://github.com/angular/dev-infra-private-ng-dev-builds.git#1fa3a08b6a111de820da092799319ed47c058849",
"@angular/platform-browser-dynamic": "^19.1.0-rc.0",
"@angular/platform-server": "^19.1.0-rc.0",
"@angular/router": "^19.1.0-rc.0",
Expand Down
6 changes: 6 additions & 0 deletions scripts/docs-deploy/clone-docs-repo.mts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ export const docsRepoUrl = 'https://github.com/angular/material.angular.io.git';
*
* @returns An absolute path to the temporary directory.
*/
// TODO: Remove this function as it shouldn't be needed long term.
export async function cloneDocsRepositoryForMajor(major: number): Promise<string> {
// As for v19, we use the checked-in code inside the monorepo.
if (major >= 19) {
return path.join(projectDir, 'material.angular.io');
}

const repoTmpDir = path.join(projectDir, 'tmp/docs-repo');
const baseCloneArgs = [docsRepoUrl, repoTmpDir, '--single-branch', '--depth=1'];
const majorDocsBranchName = getDocsBranchNameForMajor(major);
Expand Down
8 changes: 5 additions & 3 deletions scripts/docs-deploy/docs-deps-install.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {$} from 'zx';
import {$, cd} from 'zx';
import {resolveYarnScriptForProject} from '@angular/ng-dev';

export interface InstallOptions {
/** Whether dependencies should be installed with the lockfile being frozen. */
Expand All @@ -10,11 +11,12 @@ export async function installDepsForDocsSite(
repoDirPath: string,
options: InstallOptions = {frozenLockfile: true},
) {
const yarnBin = await resolveYarnScriptForProject(repoDirPath);
const additionalArgs = [];

if (options.frozenLockfile) {
additionalArgs.push('--frozen-lockfile');
additionalArgs.push(yarnBin.legacy ? '--frozen-lock-file' : '--immutable');
}

await $`yarn --cwd ${repoDirPath} install ${additionalArgs}`;
await $`${yarnBin.binary} ${yarnBin.args} --cwd ${repoDirPath} install ${additionalArgs}`;
}
Loading
Loading