44// Provide a title to the process in `ps`
55process . title = 'angular-cli' ;
66
7- const resolve = require ( 'resolve' ) ;
8- const packageJson = require ( '../package.json' ) ;
7+ const CliConfig = require ( '../models/config' ) . CliConfig ;
98const Version = require ( '../upgrade/version' ) . Version ;
10- const yellow = require ( 'chalk' ) . yellow ;
11- const SemVer = require ( 'semver' ) . SemVer ;
9+
1210const fs = require ( 'fs' ) ;
11+ const packageJson = require ( '../package.json' ) ;
1312const path = require ( 'path' ) ;
13+ const resolve = require ( 'resolve' ) ;
14+ const stripIndents = require ( 'common-tags' ) . stripIndents ;
15+ const yellow = require ( 'chalk' ) . yellow ;
16+ const SemVer = require ( 'semver' ) . SemVer ;
1417
1518
1619function _fromPackageJson ( cwd ) {
@@ -59,6 +62,37 @@ if (process.env['NG_CLI_PROFILING']) {
5962}
6063
6164
65+ // Show the warnings due to package and version deprecation.
66+ const version = new SemVer ( process . version ) ;
67+ if ( version . compare ( new SemVer ( '6.9.0' ) ) < 0
68+ && CliConfig . fromGlobal ( ) . get ( 'warnings.nodeDeprecation' ) ) {
69+ process . stderr . write ( yellow ( stripIndents `
70+ We detected that you are using Node v${ version . version } . Unfortunately, this version will not
71+ be officially supported when the Angular CLI is released. The official Node version that will
72+ be supported is 6.9 and greater. This beta release (Beta.27) will be the last release to
73+ support Node 4.
74+
75+ This is to ensure that we can provide our users with better support for the upcoming releases.
76+ Many of our dependencies are moving to deprecating Node 4 already and that would mean that we
77+ could not update them to the latest versions which might have bug fixes and new useful features.
78+
79+ To disable this warning use "ng set --global warnings.nodeDeprecation=false".
80+ ` ) ) ;
81+ }
82+
83+
84+ if ( require ( '../package.json' ) [ 'name' ] == 'angular-cli'
85+ && CliConfig . fromGlobal ( ) . get ( 'warnings.packageDeprecation' ) ) {
86+ process . stderr . write ( yellow ( stripIndents `
87+ As a forewarning, We are moving the CLI npm package to "@angular/cli" with the next release,
88+ which will only support Node 6.9 and greater. This package will be officially deprecated
89+ shortly after.
90+
91+ To disable this warning use "ng set --global warnings.packageDeprecation=false".
92+ ` ) ) ;
93+ }
94+
95+
6296resolve ( 'angular-cli' , { basedir : process . cwd ( ) } ,
6397 function ( error , projectLocalCli ) {
6498 var cli ;
@@ -85,10 +119,14 @@ resolve('angular-cli', { basedir: process.cwd() },
85119 shouldWarn = true ;
86120 }
87121
88- if ( shouldWarn ) {
122+ if ( shouldWarn && CliConfig . fromGlobal ( ) . get ( 'warnings.versionMismatch' ) ) {
89123 // eslint-disable no-console
90- console . log ( yellow ( `Your global Angular CLI version (${ globalVersion } ) is greater than `
91- + `your local version (${ localVersion } ). The local Angular CLI version is used.` ) ) ;
124+ console . log ( yellow ( stripIndents `
125+ Your global Angular CLI version (${ globalVersion } ) is greater than your local
126+ version (${ localVersion } ). The local Angular CLI version is used.
127+
128+ To disable this warning use "ng set --global warnings.versionMismatch=false".
129+ ` ) ) ;
92130 }
93131
94132 // No error implies a projectLocalCli, which will load whatever
0 commit comments