1 | 'use strict';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | const fs = require('fs');
|
8 | const path = require('path');
|
9 | const os = require('os');
|
10 |
|
11 |
|
12 | let found = false;
|
13 | let current = path.dirname(path.dirname(__dirname));
|
14 | while (current !== path.dirname(current)) {
|
15 | if (fs.existsSync(path.join(current, 'angular-cli.json'))
|
16 | || fs.existsSync(path.join(current, '.angular-cli.json'))) {
|
17 | found = os.homedir() !== current || fs.existsSync(path.join(current, 'package.json'));
|
18 | break;
|
19 | }
|
20 | if (fs.existsSync(path.join(current, 'angular.json'))
|
21 | || fs.existsSync(path.join(current, '.angular.json'))
|
22 | || fs.existsSync(path.join(current, 'package.json'))) {
|
23 | break;
|
24 | }
|
25 |
|
26 | current = path.dirname(current);
|
27 | }
|
28 |
|
29 |
|
30 | if (found) {
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | console.error(`\u001b[31m
|
37 | ${'='.repeat(80)}
|
38 | The Angular CLI configuration format has been changed, and your existing configuration can
|
39 | be updated automatically by running the following command:
|
40 |
|
41 | ng update @angular/cli
|
42 | ${'='.repeat(80)}
|
43 | \u001b[39m`.replace(/^ {4}/gm, ''));
|
44 | }
|