4
4
// Provide a title to the process in `ps`
5
5
process . title = 'angular-cli' ;
6
6
7
- const resolve = require ( 'resolve' ) ;
8
- const packageJson = require ( '../package.json' ) ;
7
+ const CliConfig = require ( '../models/config' ) . CliConfig ;
9
8
const Version = require ( '../upgrade/version' ) . Version ;
10
- const yellow = require ( 'chalk' ) . yellow ;
11
- const SemVer = require ( 'semver' ) . SemVer ;
9
+
12
10
const fs = require ( 'fs' ) ;
11
+ const packageJson = require ( '../package.json' ) ;
13
12
const 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 ;
14
17
15
18
16
19
function _fromPackageJson ( cwd ) {
@@ -59,6 +62,37 @@ if (process.env['NG_CLI_PROFILING']) {
59
62
}
60
63
61
64
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
+
62
96
resolve ( 'angular-cli' , { basedir : process . cwd ( ) } ,
63
97
function ( error , projectLocalCli ) {
64
98
var cli ;
@@ -85,10 +119,14 @@ resolve('angular-cli', { basedir: process.cwd() },
85
119
shouldWarn = true ;
86
120
}
87
121
88
- if ( shouldWarn ) {
122
+ if ( shouldWarn && CliConfig . fromGlobal ( ) . get ( 'warnings.versionMismatch' ) ) {
89
123
// 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
+ ` ) ) ;
92
130
}
93
131
94
132
// No error implies a projectLocalCli, which will load whatever
0 commit comments