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:
Paul Gschwendtner
2017-06-01 17:49:44 +02:00
committed by mmalerba
parent 50f1c266ef
commit 4c9871427b
+8 -1
View File
@@ -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;
}