mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 02:24:10 +08:00
Updates for all angular.io links to the new angular.dev domain. Additionally, adjustment to new resources where the equivalent does not exist on the new site (e.g. Tour of Heroes tutorial)
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
/**
|
|
* @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);
|