Skip to content

Commit 4c98714

Browse files
devversionmmalerba
authored andcommitted
build: validate-release check for external resources (#4907)
* Adds a check to the `validate-release` task that checks for any references to external resources.
1 parent 50f1c26 commit 4c98714

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/gulp/tasks/validate-release.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import {green, red} from 'chalk';
66
import {sequenceTask} from '../util/task_helpers';
77

88
/** RegExp that matches Angular component inline styles that contain a sourcemap reference. */
9-
const inlineStylesSourcemapRegex = /styles: ?\[(?:"|').*sourceMappingURL=.*(?:"|')/;
9+
const inlineStylesSourcemapRegex = /styles: ?\[["'].*sourceMappingURL=.*["']/;
10+
11+
/** RegExp that matches Angular component metadata properties that refer to external resources. */
12+
const externalReferencesRegex = /(templateUrl|styleUrls): *["'[]/;
1013

1114
task('validate-release', sequenceTask(':publish:build-releases', 'validate-release:check-bundles'));
1215

@@ -38,5 +41,9 @@ function checkPackageBundle(bundlePath: string): string[] {
3841
failures.push('Bundles contain sourcemap references in component styles.');
3942
}
4043

44+
if (externalReferencesRegex.exec(bundleContent) !== null) {
45+
failures.push('Bundles are including references to external resources (templates or styles)');
46+
}
47+
4148
return failures;
4249
}

0 commit comments

Comments
 (0)