-
Notifications
You must be signed in to change notification settings - Fork 12k
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
refactor(@angular/ssr): bundle Critters #28228
Changes from 1 commit
0b7679d
99c9e7a
f1d3fe0
1c70f47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") | ||
load("@bazel_skylib//rules:diff_test.bzl", "diff_test") | ||
load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test") | ||
load("//tools:defaults.bzl", "ts_library") | ||
|
||
|
@@ -8,28 +9,50 @@ ts_library( | |
srcs = glob(["**/*.ts"]), | ||
deps = [ | ||
"@npm//@bazel/runfiles", | ||
"@npm//@types/diff", | ||
], | ||
) | ||
|
||
jasmine_node_test( | ||
name = "test", | ||
srcs = [":unit_test_lib"], | ||
data = [ | ||
"THIRD_PARTY_LICENSES.txt.golden", | ||
"//packages/angular/ssr:npm_package", | ||
"@npm//diff", | ||
], | ||
) | ||
|
||
nodejs_binary( | ||
name = "test.accept", | ||
testonly = True, | ||
data = [ | ||
"THIRD_PARTY_LICENSES.txt.golden", | ||
":unit_test_lib", | ||
genrule( | ||
name = "critters_license_file", | ||
srcs = [ | ||
"//packages/angular/ssr:npm_package", | ||
"@npm//diff", | ||
], | ||
entry_point = ":update-package-golden.ts", | ||
outs = [ | ||
"THIRD_PARTY_LICENSES.txt", | ||
], | ||
cmd = """ | ||
cp $(location //packages/angular/ssr:npm_package)/third_party/critters/THIRD_PARTY_LICENSES.txt $(location :THIRD_PARTY_LICENSES.txt) | ||
""", | ||
) | ||
|
||
diff_test( | ||
name = "critters_license_test", | ||
failure_message = """ | ||
|
||
To accept the new golden file, execute: | ||
yarn bazel run //packages/angular/ssr/test/npm_package:critters_license_test.accept | ||
""", | ||
file1 = ":THIRD_PARTY_LICENSES.txt.golden", | ||
file2 = ":critters_license_file", | ||
) | ||
|
||
write_file( | ||
name = "critters_license_test.accept", | ||
out = "critters_license_file_accept.sh", | ||
content = | ||
[ | ||
"#!/usr/bin/env bash", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Neat trick with One limitation here is that this will only work for Unix developers, not Windows devs. It's probably not a huge deal, especially since anyone could manually copy over the text, even if that is a bit annoying. Maybe once we get on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could create a macro that creates a CMD instead a bash for Windows. But as mentioned there are workaround, and likely the update of the golden will be done by one of team which at the moment use Linux or Mac. |
||
"cd ${BUILD_WORKSPACE_DIRECTORY}", | ||
"yarn bazel build //packages/angular/ssr:npm_package", | ||
"cp -fv dist/bin/packages/angular/ssr/npm_package/third_party/critters/THIRD_PARTY_LICENSES.txt packages/angular/ssr/test/npm_package/THIRD_PARTY_LICENSES.txt.golden", | ||
], | ||
is_executable = True, | ||
) |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Would
@bazel/runfiles
make more sense in the rootpackage.json
? I'm kinda surprised it's not there already.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is there: https://github.com/angular/angular-cli/pull/28228/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R86