File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
angular/cli/src/utilities
schematics/angular/workspace Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,8 @@ export class PackageManagerUtils {
221221 @memoize
222222 private getVersion ( name : PackageManager ) : string | undefined {
223223 try {
224- const versionArg = name !== PackageManager . Deno ? '--version' : '-v' ;
224+ const isDeno = name === PackageManager . Deno ;
225+ const versionArg = isDeno ? '-v' : '--version' ;
225226 const version = execSync ( `${ name } ${ versionArg } ` , {
226227 encoding : 'utf8' ,
227228 stdio : [ 'ignore' , 'pipe' , 'ignore' ] ,
@@ -233,12 +234,8 @@ export class PackageManagerUtils {
233234 } ,
234235 } ) . trim ( ) ;
235236
236- if ( name === PackageManager . Deno ) {
237- // Deno CLI outputs "deno 2.5.6"
238- return version . replace ( 'deno ' , '' ) ;
239- }
240-
241- return version ;
237+ // Deno CLI outputs "deno 2.5.6"
238+ return isDeno ? version . replace ( 'deno ' , '' ) : version ;
242239 } catch {
243240 return undefined ;
244241 }
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import {
1818} from '@angular-devkit/schematics' ;
1919import { execSync } from 'node:child_process' ;
2020import { latestVersions } from '../utility/latest-versions' ;
21- import { Schema as WorkspaceOptions } from './schema' ;
21+ import { Schema as WorkspaceOptions , PackageManager } from './schema' ;
2222
2323export default function ( options : WorkspaceOptions ) : Rule {
2424 return ( ) => {
@@ -28,7 +28,9 @@ export default function (options: WorkspaceOptions): Rule {
2828 if ( packageManager ) {
2929 let packageManagerVersion : string | undefined ;
3030 try {
31- packageManagerVersion = execSync ( `${ packageManager } --version` , {
31+ const isDeno = packageManager === PackageManager . Deno ;
32+ const versionArg = isDeno ? '-v' : '--version' ;
33+ packageManagerVersion = execSync ( `${ packageManager } ${ versionArg } ` , {
3234 encoding : 'utf8' ,
3335 stdio : 'pipe' ,
3436 env : {
@@ -38,6 +40,11 @@ export default function (options: WorkspaceOptions): Rule {
3840 NPM_CONFIG_UPDATE_NOTIFIER : 'false' ,
3941 } ,
4042 } ) . trim ( ) ;
43+
44+ if ( isDeno ) {
45+ // Deno CLI outputs "deno 2.5.6"
46+ packageManagerVersion = packageManagerVersion . replace ( 'deno ' , '' ) ;
47+ }
4148 } catch { }
4249
4350 if ( packageManagerVersion ) {
You can’t perform that action at this time.
0 commit comments