Skip to content

Commit 8ef3d4c

Browse files
alan-agius4dgp1130
authored andcommitted
refactor: source best practices from @angular/core
The best practices markdown file is now sourced directly from `@angular/core/resources/best-practices.md`. This change eliminates duplication and ensures consistency across packages. - `packages/angular/cli/src/commands/mcp/resources/best-practices.md` is now generated from the `@angular/core` resource. - `packages/schematics/angular/ai-config/files/__rulesName__.template` is also generated from the `@angular/core` resource, with additional frontmatter. (cherry picked from commit 240d96c)
1 parent 4187d46 commit 8ef3d4c

File tree

4 files changed

+26
-98
lines changed

4 files changed

+26
-98
lines changed

packages/angular/cli/BUILD.bazel

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ package(default_visibility = ["//visibility:public"])
1515

1616
npm_link_all_packages()
1717

18+
genrule(
19+
name = "angular_best_practices",
20+
srcs = [
21+
"//:node_modules/@angular/core/dir",
22+
],
23+
outs = ["src/commands/mcp/resources/best-practices.md"],
24+
cmd = """
25+
cp "$(location //:node_modules/@angular/core/dir)/resources/best-practices.md" $@
26+
""",
27+
)
28+
1829
RUNTIME_ASSETS = glob(
1930
include = [
2031
"bin/**/*",
@@ -27,6 +38,7 @@ RUNTIME_ASSETS = glob(
2738
) + [
2839
"//packages/angular/cli:lib/config/schema.json",
2940
"//packages/angular/cli:lib/code-examples.db",
41+
":angular_best_practices",
3042
]
3143

3244
ts_project(

packages/angular/cli/src/commands/mcp/resources/best-practices.md

Lines changed: 0 additions & 47 deletions
This file was deleted.

packages/schematics/angular/BUILD.bazel

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,24 @@ copy_to_bin(
4545
srcs = glob(["**/schema.json"]),
4646
)
4747

48+
genrule(
49+
name = "angular_best_practices",
50+
srcs = [
51+
"//:node_modules/@angular/core/dir",
52+
],
53+
outs = ["ai-config/files/__rulesName__.template"],
54+
cmd = """
55+
echo -e "<% if (frontmatter) { %><%= frontmatter %>\\n<% } %>" > $@
56+
cat "$(location //:node_modules/@angular/core/dir)/resources/best-practices.md" >> $@
57+
""",
58+
)
59+
4860
RUNTIME_ASSETS = [
4961
"collection.json",
5062
"migrations/migration-collection.json",
5163
"package.json",
5264
"utility/latest-versions/package.json",
65+
":angular_best_practices",
5366
] + glob(
5467
include = [
5568
"*/schema.json",
@@ -115,13 +128,12 @@ ts_project(
115128
include = [
116129
"**/*_spec.ts",
117130
"utility/test/**/*.ts",
118-
"refactor/jasmine-vitest/test-helpers.ts",
119131
],
120132
exclude = [
121133
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
122134
"node_modules/**",
123135
],
124-
),
136+
) + ["refactor/jasmine-vitest/test-helpers.ts"],
125137
deps = [
126138
":angular",
127139
":node_modules/@angular-devkit/core",

packages/schematics/angular/ai-config/files/__rulesName__.template

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)