Skip to content

Commit

Permalink
fix(@angular/cli): skip node.js compatibility checks when running com…
Browse files Browse the repository at this point in the history
…pletion

A warning at this stage could cause a broken source action (`source <(ng completion script)`) when in the shell init script.

Closes #24104

(cherry picked from commit 1e4dbfd)
  • Loading branch information
alan-agius4 authored and dgp1130 committed Oct 24, 2022
1 parent 5d54503 commit 02a3d7b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/angular/cli/bin/ng.js
Expand Up @@ -20,6 +20,16 @@ try {
process.title = 'ng';
}

const rawCommandName = process.argv[2];

if (rawCommandName === '--get-yargs-completions' || rawCommandName === 'completion') {
// Skip Node.js supported checks when running ng completion.
// A warning at this stage could cause a broken source action (`source <(ng completion script)`) when in the shell init script.
require('./bootstrap');

return;
}

// This node version check ensures that extremely old versions of node are not used.
// These may not support ES2015 features such as const/let/async/await/etc.
// These would then crash with a hard to diagnose error message.
Expand Down

0 comments on commit 02a3d7b

Please sign in to comment.