/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
scripts/docs-deploy/install-built-packages.mts
25 строк
1 KB
Paul Gschwendtner
build: account for new dev-infra packages `@angular/ng-dev` and `@angular/build-tooling` (#25345)
26 июл 2022, 18:05
Не верифицирован
26 июл 2022, 18:05
00ee53a
Код
Авторство
О чём код?
import * as fs from 'fs'; import * as url from 'url'; import {BuiltPackage} from '@angular/ng-dev'; import {getPackageJsonOfProject} from './utils.mjs'; export async function installBuiltPackagesInRepo(repoPath: string, builtPackages: BuiltPackage[]) { const {parsed: packageJson, path: packageJsonPath} = await getPackageJsonOfProject(repoPath); for (const builtPackage of builtPackages) { const pkgName = builtPackage.name; const destinationUrl = url.pathToFileURL(builtPackage.outputPath); // Override the dependencies to point to the local files instead of the version on npm. // Note that we don't want to change the `resolutions` to point to the same files, because it // can cause duplicated dependencies (see #24992). packageJson.dependencies[pkgName] = destinationUrl; // In case this dependency was previously a dev dependency, just remove it because we // re-added it as a normal dependency for simplicity. delete packageJson.devDependencies[pkgName]; } await fs.promises.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2)); }