forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathng-update-message.js
More file actions
executable file
·44 lines (35 loc) · 1.39 KB
/
ng-update-message.js
File metadata and controls
executable file
·44 lines (35 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env node
'use strict';
// Check if the current directory contains '.angular-cli.json'. If it does, show a message to the user that they
// should use the migration script.
const fs = require('fs');
const path = require('path');
const os = require('os');
let found = false;
let current = path.dirname(path.dirname(__dirname));
while (current !== path.dirname(current)) {
if (fs.existsSync(path.join(current, 'angular-cli.json'))
|| fs.existsSync(path.join(current, '.angular-cli.json'))) {
found = os.homedir() !== current || fs.existsSync(path.join(current, 'package.json'));
break;
}
if (fs.existsSync(path.join(current, 'angular.json'))
|| fs.existsSync(path.join(current, '.angular.json'))
|| fs.existsSync(path.join(current, 'package.json'))) {
break;
}
current = path.dirname(current);
}
if (found) {
// ------------------------------------------------------------------------------------------
// If changing this message, please update the same message in
// `packages/@angular/cli/models/command-runner.ts`
// eslint-disable-next-line no-console
console.error(`\u001b[31m
${'='.repeat(80)}
The Angular CLI configuration format has been changed, and your existing configuration can
be updated automatically by running the following command:
ng update @angular/cli
${'='.repeat(80)}
\u001b[39m`.replace(/^ {4}/gm, ''));
}