From 9b77b43241bca5a14dcc8d19b878fd99f550dfca Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Mon, 27 Oct 2025 09:26:23 +0100 Subject: [PATCH] refactor(docs-infra): streamline adev build configuration This commit introduces a number of changes to streamline the build configuration for adev, the documentation application. (cherry picked from commit 53287bce9b08c962ec11c6188880d59fe61caf39) --- adev/BUILD.bazel | 95 +++++++++++++------------- adev/angular.json | 5 +- adev/src/assets/BUILD.bazel | 1 + adev/src/assets/images/BUILD.bazel | 5 +- adev/src/assets/others/BUILD.bazel | 5 +- adev/src/content/ai/develop-with-ai.md | 6 +- adev/src/context/BUILD.bazel | 6 +- 7 files changed, 66 insertions(+), 57 deletions(-) diff --git a/adev/BUILD.bazel b/adev/BUILD.bazel index 12430e8c105..b6fdf6222d6 100644 --- a/adev/BUILD.bazel +++ b/adev/BUILD.bazel @@ -14,7 +14,6 @@ exports_files([ ]) APPLICATION_FILES = [ - "//adev/src/context:llms_full", "//adev/src/assets/images", "//adev/src/assets/others", "//adev/src/assets/previews", @@ -31,38 +30,38 @@ APPLICATION_FILES = [ ) APPLICATION_DEPS = [ - "//adev:node_modules/@angular-devkit/build-angular", - "//adev:node_modules/@codemirror/autocomplete", - "//adev:node_modules/@codemirror/commands", - "//adev:node_modules/@codemirror/lang-angular", - "//adev:node_modules/@codemirror/lang-css", - "//adev:node_modules/@codemirror/lang-html", - "//adev:node_modules/@codemirror/lang-javascript", - "//adev:node_modules/@codemirror/lang-sass", - "//adev:node_modules/@codemirror/language", - "//adev:node_modules/@codemirror/lint", - "//adev:node_modules/@codemirror/search", - "//adev:node_modules/@codemirror/state", - "//adev:node_modules/@codemirror/view", - "//adev:node_modules/@lezer/common", - "//adev:node_modules/@lezer/highlight", - "//adev:node_modules/@lezer/javascript", - "//adev:node_modules/@stackblitz/sdk", - "//adev:node_modules/@typescript/vfs", - "//adev:node_modules/@webcontainer/api", - "//adev:node_modules/@xterm/addon-fit", - "//adev:node_modules/@xterm/xterm", - "//adev:node_modules/algoliasearch", - "//adev:node_modules/angular-split", - "//adev:node_modules/fflate", - "//adev:node_modules/marked", - "//adev:node_modules/ngx-progressbar", - "//adev:node_modules/open-in-idx", - "//adev:node_modules/tailwindcss", - "//adev:node_modules/typescript", - "//adev:node_modules/xhr2", - "//adev:node_modules/@types/node", - "//adev:node_modules/@types/dom-navigation", + ":node_modules/@angular-devkit/build-angular", + ":node_modules/@codemirror/autocomplete", + ":node_modules/@codemirror/commands", + ":node_modules/@codemirror/lang-angular", + ":node_modules/@codemirror/lang-css", + ":node_modules/@codemirror/lang-html", + ":node_modules/@codemirror/lang-javascript", + ":node_modules/@codemirror/lang-sass", + ":node_modules/@codemirror/language", + ":node_modules/@codemirror/lint", + ":node_modules/@codemirror/search", + ":node_modules/@codemirror/state", + ":node_modules/@codemirror/view", + ":node_modules/@lezer/common", + ":node_modules/@lezer/highlight", + ":node_modules/@lezer/javascript", + ":node_modules/@stackblitz/sdk", + ":node_modules/@typescript/vfs", + ":node_modules/@webcontainer/api", + ":node_modules/@xterm/addon-fit", + ":node_modules/@xterm/xterm", + ":node_modules/algoliasearch", + ":node_modules/angular-split", + ":node_modules/fflate", + ":node_modules/marked", + ":node_modules/ngx-progressbar", + ":node_modules/open-in-idx", + ":node_modules/tailwindcss", + ":node_modules/typescript", + ":node_modules/xhr2", + ":node_modules/@types/node", + ":node_modules/@types/dom-navigation", # The imports below are packages that our code does not directly import, but our upstream deps import from # these locations directly. By design, rather than hoisting these packages into the "root" node_modules the @@ -70,17 +69,17 @@ APPLICATION_DEPS = [ # a "hoisted" location within the `.aspect_rules_js/` directories in the node_modules directory. This prevents # the bundler from being able to find it as expected. We instead specifically provide it as a dep within bazel # as a mechanism of "hoisting" the package for our usage by this target. - "//adev:node_modules/@algolia/client-common", - "//adev:node_modules/@algolia/requester-browser-xhr", - "//adev:node_modules/@algolia/requester-node-http", - "//adev:node_modules/@lezer/css", - "//adev:node_modules/@lezer/html", - "//adev:node_modules/@lezer/lr", - "//adev:node_modules/@lezer/sass", - "//adev:node_modules/@marijn/find-cluster-break", - "//adev:node_modules/crelt", - "//adev:node_modules/style-mod", - "//adev:node_modules/w3c-keyname", + ":node_modules/@algolia/client-common", + ":node_modules/@algolia/requester-browser-xhr", + ":node_modules/@algolia/requester-node-http", + ":node_modules/@lezer/css", + ":node_modules/@lezer/html", + ":node_modules/@lezer/lr", + ":node_modules/@lezer/sass", + ":node_modules/@marijn/find-cluster-break", + ":node_modules/crelt", + ":node_modules/style-mod", + ":node_modules/w3c-keyname", ] TEST_FILES = APPLICATION_FILES + [ @@ -91,7 +90,7 @@ TEST_FILES = APPLICATION_FILES + [ TEST_DEPS = [ dep for dep in APPLICATION_DEPS - if dep != "//adev:node_modules/@types/node" + if dep != ":node_modules/@types/node" ] + [ "@rules_browsers//browsers/chromium", "@rules_browsers//browsers/firefox", @@ -111,7 +110,7 @@ ng_application( "NG_BUILD_PARTIAL_SSR": "1", }, ng_config = ":ng_config", - node_modules = "//adev:node_modules", + node_modules = ":node_modules", project_name = "angular-dev", serve_args = [ "--port", @@ -137,7 +136,7 @@ ng_application( "NG_BUILD_OPTIMIZE_CHUNKS": "1", }, ng_config = ":ng_config", - node_modules = "//adev:node_modules", + node_modules = ":node_modules", project_name = "angular-dev", serve_args = [ "--port", @@ -161,7 +160,7 @@ ng_test( "CHROMEDRIVER_BIN": "../" + "$(CHROMEDRIVER)", }, ng_config = ":ng_config", - node_modules = "//adev:node_modules", + node_modules = ":node_modules", project_name = "angular-dev", toolchains = [ "@rules_browsers//browsers/chromium:toolchain_alias", diff --git a/adev/angular.json b/adev/angular.json index c4f3bab1d52..eeb7555e3da 100644 --- a/adev/angular.json +++ b/adev/angular.json @@ -31,9 +31,8 @@ "assets": [ "src/favicon.ico", "src/robots.txt", - "src/assets", - "src/context", - "src/llms.txt" + "src/llms.txt", + "src/assets" ], "styles": ["@angular/docs/styles/global-styles.scss", "./src/local-styles.scss"], "scripts": [], diff --git a/adev/src/assets/BUILD.bazel b/adev/src/assets/BUILD.bazel index 1b82b4a5af4..c87a1f0aaed 100644 --- a/adev/src/assets/BUILD.bazel +++ b/adev/src/assets/BUILD.bazel @@ -133,6 +133,7 @@ copy_to_directory( name = "context", srcs = [ "//adev/src/context", + "//adev/src/context:llms_full", ], replace_prefixes = { "**/": "", diff --git a/adev/src/assets/images/BUILD.bazel b/adev/src/assets/images/BUILD.bazel index 4c4c447f717..c3e7dfbcfc4 100644 --- a/adev/src/assets/images/BUILD.bazel +++ b/adev/src/assets/images/BUILD.bazel @@ -6,7 +6,10 @@ exports_files( copy_to_bin( name = "images", - srcs = glob(["**/*"]), + srcs = glob( + include = ["**/*"], + exclude = ["BUILD.bazel"], + ), visibility = [ "//visibility:public", ], diff --git a/adev/src/assets/others/BUILD.bazel b/adev/src/assets/others/BUILD.bazel index 4cc4cbb54fe..ae30644068a 100644 --- a/adev/src/assets/others/BUILD.bazel +++ b/adev/src/assets/others/BUILD.bazel @@ -6,7 +6,10 @@ exports_files( copy_to_bin( name = "others", - srcs = glob(["**/*"]), + srcs = glob( + include = ["**/*"], + exclude = ["BUILD.bazel"], + ), visibility = [ "//visibility:public", ], diff --git a/adev/src/content/ai/develop-with-ai.md b/adev/src/content/ai/develop-with-ai.md index fa7e25216a0..f3567aad313 100644 --- a/adev/src/content/ai/develop-with-ai.md +++ b/adev/src/content/ai/develop-with-ai.md @@ -12,7 +12,7 @@ Here is a set of instructions to help LLMs generate correct code that follows An -Click here to download the best-practices.md file. +Click here to download the best-practices.md file. ## Rules Files Several editors, such as Firebase Studio have rules files useful for providing critical context to LLMs. @@ -35,8 +35,8 @@ The Angular CLI includes an experimental [Model Context Protocol (MCP) server](h `llms.txt` is a proposed standard for websites designed to help LLMs better understand and process their content. The Angular team has developed two versions of this file to help LLMs and tools that use LLMs for code generation to create better modern Angular code. -* llms.txt - an index file providing links to key files and resources. -* llms-full.txt - a more robust compiled set of resources describing how Angular works and how to build Angular applications. +* llms.txt - an index file providing links to key files and resources. +* llms-full.txt - a more robust compiled set of resources describing how Angular works and how to build Angular applications. Be sure [to check out the overview page](/ai) for more information on how to integrate AI into your Angular applications. diff --git a/adev/src/context/BUILD.bazel b/adev/src/context/BUILD.bazel index 9ae2a3a10c3..149301463f2 100644 --- a/adev/src/context/BUILD.bazel +++ b/adev/src/context/BUILD.bazel @@ -4,7 +4,11 @@ package(default_visibility = ["//adev:__subpackages__"]) filegroup( name = "context", - srcs = glob(["**"]), + srcs = glob([ + "**/*.md", + "**/*.txt", + "**/*.mdc", + ]), visibility = ["//visibility:public"], )