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,31 @@ 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
+ You are running version ${ version . version } of Node, which will not be supported in future
71
+ versions of the CLI. The official Node version that will be supported is 6.9 and greater.
72
+
73
+ To disable this warning use "ng set --global warnings.nodeDeprecation=false".
74
+ ` ) ) ;
75
+ }
76
+
77
+
78
+ if ( require ( '../package.json' ) [ 'name' ] == 'angular-cli'
79
+ && CliConfig . fromGlobal ( ) . get ( 'warnings.packageDeprecation' ) ) {
80
+ process . stderr . write ( yellow ( stripIndents `
81
+ As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
82
+ which will only support Node 6.9 and greater. This package will be officially deprecated
83
+ shortly after.
84
+
85
+ To disable this warning use "ng set --global warnings.packageDeprecation=false".
86
+ ` ) ) ;
87
+ }
88
+
89
+
62
90
resolve ( 'angular-cli' , { basedir : process . cwd ( ) } ,
63
91
function ( error , projectLocalCli ) {
64
92
var cli ;
@@ -85,10 +113,14 @@ resolve('angular-cli', { basedir: process.cwd() },
85
113
shouldWarn = true ;
86
114
}
87
115
88
- if ( shouldWarn ) {
116
+ if ( shouldWarn && CliConfig . fromGlobal ( ) . get ( 'warnings.versionMismatch' ) ) {
89
117
// 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.` ) ) ;
118
+ console . log ( yellow ( stripIndents `
119
+ Your global Angular CLI version (${ globalVersion } ) is greater than your local
120
+ version (${ localVersion } ). The local Angular CLI version is used.
121
+
122
+ To disable this warning use "ng set --global warnings.versionMismatch=false".
123
+ ` ) ) ;
92
124
}
93
125
94
126
// No error implies a projectLocalCli, which will load whatever
0 commit comments