Skip to content

Commit 9bc386e

Browse files
josephperrottAndrewKushnir
authored andcommitted
refactor(docs-infra): create fast mode (angular#54364)
Creates a "fast mode" for building the adev site, currently only disabling prerender during fast build. This is intended to be used for local development. PR Close angular#54364
1 parent abf6371 commit 9bc386e

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

.bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ test:saucelabs --flaky_test_attempts=1
177177

178178
# --ng_perf will ask the Ivy compiler to produce performance results for each build.
179179
build --flag_alias=ng_perf=//packages/compiler-cli:ng_perf
180+
# --adev_fast will run adev build/serve in a faster mode, skipping things like prerendering
181+
# for local development.
182+
build --flag_alias=fast_adev=//adev:fast_build_mode
180183

181184
####################################################
182185
# User bazel configuration

adev/BUILD.bazel

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("//:packages.bzl", "link_packages")
2+
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
23
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
34
load("@npm//@angular-devkit/architect-cli:index.bzl", "architect", "architect_test")
45

@@ -96,12 +97,36 @@ copy_to_bin(
9697
srcs = APPLICATION_FILES,
9798
)
9899

100+
bool_flag(
101+
name = "fast_build_mode",
102+
build_setting_default = False,
103+
)
104+
105+
config_setting(
106+
name = "fast",
107+
flag_values = {
108+
":fast_build_mode": "true",
109+
},
110+
)
111+
112+
config_setting(
113+
name = "full",
114+
flag_values = {
115+
":fast_build_mode": "false",
116+
},
117+
)
118+
119+
config_based_architect_flags = select({
120+
":fast": ["--no-prerender"],
121+
":full": ["--prerender"],
122+
})
123+
99124
architect(
100125
name = "build",
101126
args = [
102127
"angular-dev:build",
103128
"--output-path=build",
104-
],
129+
] + config_based_architect_flags,
105130
chdir = "$(RULEDIR)",
106131
data = APPLICATION_DEPS + [
107132
":application_files_bin",
@@ -116,7 +141,7 @@ architect(
116141
"--poll=1000",
117142
"--live-reload",
118143
"--watch",
119-
],
144+
] + config_based_architect_flags,
120145
chdir = package_name(),
121146
data = APPLICATION_DEPS + [
122147
":application_files_bin",

adev/angular.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"index": "src/index.html",
2727
"browser": "src/main.ts",
2828
"server": "src/main.server.ts",
29-
"prerender": true,
3029
"polyfills": ["src/polyfills.ts", "zone.js"],
3130
"tsConfig": "tsconfig.app.json",
3231
"inlineStyleLanguage": "scss",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
"devtools:build:chrome": "bazelisk build --config snapshot-build --//devtools/projects/shell-browser/src:flag_browser=chrome -- devtools/projects/shell-browser/src:prodapp",
4444
"devtools:build:firefox": "bazelisk build --config snapshot-build --//devtools/projects/shell-browser/src:flag_browser=firefox -- devtools/projects/shell-browser/src:prodapp",
4545
"devtools:test": "bazelisk test --config snapshot-build --//devtools/projects/shell-browser/src:flag_browser=chrome -- //devtools/...",
46-
"docs": "yarn bazel run --config=aio_local_deps //adev:serve",
47-
"docs:build": "yarn bazel build --config=aio_local_deps //adev:build",
46+
"docs": "[[ -n $CI ]] && echo 'Cannot run this yarn script on CI' && exit 1 || yarn bazel run --config=aio_local_deps //adev:serve --fast_adev",
47+
"docs:build": "[[ -n $CI ]] && echo 'Cannot run this yarn script on CI' && exit 1 || yarn bazel build --config=aio_local_deps //adev:build --fast_adev",
4848
"benchmarks": "ts-node --esm scripts/benchmarks/index.mts"
4949
},
5050
"// 1": "dependencies are used locally and by bazel",

0 commit comments

Comments
 (0)