/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular/create/src/index.ts
34 строки
1 KB
Alan Agius
feat(@angular/cli): remove direct support for `cnpm`
20 авг 2025, 22:22
20 авг 2025, 22:22
f513089
Код
Авторство
О чём код?
#!/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 { spawnSync } from 'node:child_process'; import { join } from 'node:path'; const binPath = join(require.resolve('@angular/cli/package.json'), '../bin/ng.js'); const args = process.argv.slice(2); const hasPackageManagerArg = args.some((a) => a.startsWith('--package-manager')); if (!hasPackageManagerArg) { // Ex: yarn/1.22.18 npm/? node/v16.15.1 linux x64 const packageManager = process.env['npm_config_user_agent']?.split('/')[0]; if (packageManager && ['npm', 'pnpm', 'yarn', 'bun'].includes(packageManager)) { args.push('--package-manager', packageManager); } } // Invoke ng new with any parameters provided. const { error } = spawnSync(process.execPath, [binPath, 'new', ...args], { stdio: 'inherit', }); if (error) { // eslint-disable-next-line no-console console.error(error); process.exitCode = 1; }