Skip to content

Commit

Permalink
bzlmod angular architect example
Browse files Browse the repository at this point in the history
  • Loading branch information
hubbabubba656 authored and alexeagle committed Jan 14, 2025
1 parent 8743b8e commit 068d61f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 156 deletions.
3 changes: 3 additions & 0 deletions angular/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ import %workspace%/.aspect/bazelrc/bazel6.bazelrc
# should be last statement in this config so the user configuration is able to overwrite flags from
# this file. See https://bazel.build/configure/best-practices#bazelrc-file.
try-import %workspace%/.aspect/bazelrc/user.bazelrc

# Enable Bzlmod for every Bazel command
common --enable_bzlmod
30 changes: 30 additions & 0 deletions angular/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,33 @@
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################
module(
name = "angular-example",
compatibility_level = 1,
)

bazel_dep(name = "aspect_rules_js", version = "2.1.2")
bazel_dep(name = "aspect_bazel_lib", version = "2.10.0")
bazel_dep(name = "rules_nodejs", version = "6.3.2")

node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node", dev_dependency = True)

### Use default Node
node.toolchain()

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
npm.npm_translate_lock(
name = "npm",
bins = {
"@angular/compiler-cli": [
"ngcc=./bundles/ngcc/main-ngcc.js",
],
},
custom_postinstalls = {
"ng2-dragula": "ngcc --source .",
},
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
use_repo(npm, "npm")
110 changes: 0 additions & 110 deletions angular/MODULE.bazel.lock

This file was deleted.

46 changes: 0 additions & 46 deletions angular/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,46 +0,0 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "aspect_rules_js",
sha256 = "dcd1567d4a93a8634ec0b888b371a60b93c18d980f77dace02eb176531a71fcf",
strip_prefix = "rules_js-1.26.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.26.0/rules_js-v1.26.0.tar.gz",
)

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")

rules_js_dependencies()

load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "register_jq_toolchains")

aspect_bazel_lib_dependencies()

register_jq_toolchains()

load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")

nodejs_register_toolchains(
name = "nodejs",
node_version = DEFAULT_NODE_VERSION,
)

load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")

npm_translate_lock(
name = "npm",
bins = {
"@angular/compiler-cli": {
"ngcc": "./bundles/ngcc/main-ngcc.js",
},
},
custom_postinstalls = {
"ng2-dragula": "ngcc --source .",
},
pnpm_lock = "//:pnpm-lock.yaml",
npmrc = "//:.npmrc",
verify_node_modules_ignored = "//:.bazelignore",
)

load("@npm//:repositories.bzl", "npm_repositories")

npm_repositories()

0 comments on commit 068d61f

Please sign in to comment.