forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidate-build-files.ts
42 lines (35 loc) · 1.2 KB
/
validate-build-files.ts
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
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { logging, tags } from '@angular-devkit/core';
import { existsSync } from 'fs';
import { join } from 'path';
import { packages } from '../lib/packages';
export default async function (_options: {}, logger: logging.Logger) {
let error = false;
for (const pkgName of Object.keys(packages)) {
const pkg = packages[pkgName];
if (pkg.packageJson.private) {
// Ignore private packages.
continue;
}
// There should be at least one BUILD file next to each package.json.
if (!existsSync(join(pkg.root, 'BUILD')) && !existsSync(join(pkg.root, 'BUILD.bazel'))) {
logger.error(tags.oneLine`
The package ${JSON.stringify(pkgName)} does not have a BUILD file associated to it. You
must either set an exception or make sure it can be built using Bazel.
`);
error = true;
}
}
// TODO: enable this to break
if (error) {
// process.exit(1);
logger.warn('Found some BUILD files missing, which will be breaking your PR soon.');
}
return 0;
}