From 4c9871427b92a50e935379b0296b070c49525085 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 1 Jun 2017 17:49:44 +0200 Subject: [PATCH] build: validate-release check for external resources (#4907) * Adds a check to the `validate-release` task that checks for any references to external resources. --- tools/gulp/tasks/validate-release.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/gulp/tasks/validate-release.ts b/tools/gulp/tasks/validate-release.ts index 36ec8ef6aaa..ba7deb6ecf0 100644 --- a/tools/gulp/tasks/validate-release.ts +++ b/tools/gulp/tasks/validate-release.ts @@ -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; }