| # Copyright 2025 The Chromium Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| import("../../scripts/build/typescript/typescript.gni") | |
| import("../build/ninja/copy.gni") | |
| import("../build/ninja/node.gni") | |
| copy_to_gen("copy_styles") { | |
| sources = [ "component_docs.css" ] | |
| } | |
| generated_file("component_docs_sources") { | |
| data_keys = [ "doc_sources" ] | |
| deps = [ "../../front_end:docs" ] | |
| output_conversion = "json" | |
| outputs = [ "$target_gen_dir/component_docs_sources.json" ] | |
| rebase = target_gen_dir | |
| } | |
| ts_library("docs_environment") { | |
| testonly = true | |
| sources = [ | |
| "docs_environment.ts", | |
| "toggle_dark_mode.ts", | |
| "toggle_fonts.ts", | |
| ] | |
| ts_deps = [ | |
| "../../front_end/core/common:bundle", | |
| "../../front_end/testing", | |
| "../../front_end/ui/legacy/theme_support:bundle", | |
| ] | |
| data_deps = [ "../../front_end/Images" ] | |
| } | |
| node_action("component_docs") { | |
| testonly = true | |
| script = "scripts/component_docs/generate_docs.mjs" | |
| deps = [ | |
| ":component_docs_sources", | |
| ":copy_styles", | |
| ":docs_environment", | |
| ] | |
| metadata_file = "$target_gen_dir/component_docs_sources.json" | |
| environment_setup_file = "$target_gen_dir/docs_environment.js" | |
| outputs = [ | |
| "$root_gen_dir/index.html", | |
| "$target_gen_dir/index_loader.js", | |
| ] | |
| visibility = [ "../../:*" ] | |
| args = [ | |
| "--html-output-file", | |
| rebase_path("$root_gen_dir/index.html", root_build_dir), | |
| "--js-output-file", | |
| rebase_path("$target_gen_dir/index_loader.js", root_build_dir), | |
| "--sources-file", | |
| rebase_path(metadata_file, root_build_dir), | |
| "--environment-setup-file", | |
| rebase_path(environment_setup_file, root_build_dir), | |
| ] | |
| } |