mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Replaces the 'tmp' package with native 'node:os' and 'node:fs' APIs to create temporary files in the system temp directory.
76 lines
2.1 KiB
TypeScript
76 lines
2.1 KiB
TypeScript
import {
|
|
fetchLongTermSupportBranchesFromNpm,
|
|
ActiveReleaseTrains,
|
|
AuthenticatedGitClient,
|
|
ReleaseConfig,
|
|
} from '@angular/ng-dev';
|
|
|
|
export interface Deployment {
|
|
branch: string;
|
|
redirect?: {
|
|
from: string;
|
|
to: string;
|
|
};
|
|
destination?: string;
|
|
servingUrl: string;
|
|
}
|
|
|
|
export type Deployments = Map<string, Deployment>;
|
|
|
|
export async function getDeployments(): Promise<Deployments> {
|
|
const {github} = await AuthenticatedGitClient.get();
|
|
const releaseTrains = await ActiveReleaseTrains.fetch({
|
|
api: github,
|
|
name: 'angular',
|
|
owner: 'angular',
|
|
nextBranchName: 'main',
|
|
});
|
|
const ltsBranches = await fetchLongTermSupportBranchesFromNpm({
|
|
representativeNpmPackage: '@angular/core',
|
|
} as ReleaseConfig);
|
|
|
|
const docSites = new Map<string, Deployment>();
|
|
|
|
[...ltsBranches.active, ...ltsBranches.inactive].forEach((branch) => {
|
|
docSites.set(branch.name, {
|
|
branch: branch.name,
|
|
destination: `v${branch.version.major}-angular-dev`,
|
|
servingUrl: `https://v${branch.version.major}.angular.dev/`,
|
|
});
|
|
});
|
|
|
|
docSites.set(releaseTrains.latest.branchName, {
|
|
branch: releaseTrains.latest.branchName,
|
|
redirect: {
|
|
from: `v${releaseTrains.latest.version.major}-angular-dev`,
|
|
to: 'https://angular.dev',
|
|
},
|
|
servingUrl: 'https://angular.dev/',
|
|
destination: 'angular-dev-site',
|
|
});
|
|
|
|
if (releaseTrains.releaseCandidate) {
|
|
docSites.set(releaseTrains.next.branchName, {
|
|
branch: releaseTrains.next.branchName,
|
|
servingUrl: 'https://next.angular.dev/',
|
|
});
|
|
|
|
docSites.set(releaseTrains.releaseCandidate.branchName, {
|
|
branch: releaseTrains.releaseCandidate.branchName,
|
|
destination: 'next-angular-dev',
|
|
redirect: {
|
|
from: `v${releaseTrains.releaseCandidate.version.major}-angular-dev`,
|
|
to: 'https://next.angular.dev',
|
|
},
|
|
servingUrl: 'https://next.angular.dev/',
|
|
});
|
|
} else {
|
|
docSites.set(releaseTrains.next.branchName, {
|
|
branch: releaseTrains.next.branchName,
|
|
destination: 'next-angular-dev',
|
|
servingUrl: 'https://next.angular.dev/',
|
|
});
|
|
}
|
|
|
|
return docSites;
|
|
}
|