Skip to content

build: validate-release check for external resources #4907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tools/gulp/tasks/validate-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand Down Expand Up @@ -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;
}