mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: validate-release check for external resources (#4907)
* Adds a check to the `validate-release` task that checks for any references to external resources.
This commit is contained in:
committed by
mmalerba
parent
50f1c266ef
commit
4c9871427b
@@ -6,7 +6,10 @@ import {green, red} from 'chalk';
|
||||
import {sequenceTask} from '../util/task_helpers';
|
||||
|
||||
/** RegExp that matches Angular component inline styles that contain a sourcemap reference. */
|
||||
const inlineStylesSourcemapRegex = /styles: ?\[(?:"|').*sourceMappingURL=.*(?:"|')/;
|
||||
const inlineStylesSourcemapRegex = /styles: ?\[["'].*sourceMappingURL=.*["']/;
|
||||
|
||||
/** RegExp that matches Angular component metadata properties that refer to external resources. */
|
||||
const externalReferencesRegex = /(templateUrl|styleUrls): *["'[]/;
|
||||
|
||||
task('validate-release', sequenceTask(':publish:build-releases', 'validate-release:check-bundles'));
|
||||
|
||||
@@ -38,5 +41,9 @@ function checkPackageBundle(bundlePath: string): string[] {
|
||||
failures.push('Bundles contain sourcemap references in component styles.');
|
||||
}
|
||||
|
||||
if (externalReferencesRegex.exec(bundleContent) !== null) {
|
||||
failures.push('Bundles are including references to external resources (templates or styles)');
|
||||
}
|
||||
|
||||
return failures;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user