Skip to content

Commit

Permalink
Working local_repository setup
Browse files Browse the repository at this point in the history
Note: bazel hung on npm install the first time build was attempted,
but restarting it worked fine.
  • Loading branch information
mdittmer committed Apr 23, 2022
1 parent 0473d04 commit 07c0810
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 28 deletions.
31 changes: 17 additions & 14 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,34 @@ workspace(
name = "multi-nodejs-proof-of-concept",
)

# load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# http_archive(
# name = "build_bazel_rules_nodejs",
# sha256 = "2b2004784358655f334925e7eadc7ba80f701144363df949b3293e1ae7a2fb7b",
# urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.4.0/rules_nodejs-5.4.0.tar.gz"],
# )
# load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
# build_bazel_rules_nodejs_dependencies()
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "2b2004784358655f334925e7eadc7ba80f701144363df949b3293e1ae7a2fb7b",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.4.0/rules_nodejs-5.4.0.tar.gz"],
)
load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
build_bazel_rules_nodejs_dependencies()

# load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")
load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")

# yarn_install(
# name = "npm",
# package_json = "//js/alpha:package.json",
# yarn_lock = "//js/alpha:yarn.lock",
# )

# npm_install(
# name = "npm",
# package_json = "//js/alpha:package.json",
# package_lock_json = "//js/alpha:package-lock.json",
# )
npm_install(
name = "npm_alpha",
package_json = "@alpha//:package.json",
package_lock_json = "@alpha//:package-lock.json",
)

local_repository(
name = "alpha",
path = "js/alpha",
repo_mapping = {
"@npm": "@npm_alpha",
},
)
28 changes: 14 additions & 14 deletions js/alpha/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ workspace(
name = "alpha",
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "2b2004784358655f334925e7eadc7ba80f701144363df949b3293e1ae7a2fb7b",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.4.0/rules_nodejs-5.4.0.tar.gz"],
)
load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
build_bazel_rules_nodejs_dependencies()
# http_archive(
# name = "build_bazel_rules_nodejs",
# sha256 = "2b2004784358655f334925e7eadc7ba80f701144363df949b3293e1ae7a2fb7b",
# urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.4.0/rules_nodejs-5.4.0.tar.gz"],
# )
# load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
# build_bazel_rules_nodejs_dependencies()

load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")
# load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")

# yarn_install(
# name = "npm",
# package_json = "//:package.json",
# yarn_lock = "//:yarn.lock",
# )

npm_install(
name = "npm",
package_json = "//:package.json",
package_lock_json = "//:package-lock.json",
)
# npm_install(
# name = "npm",
# package_json = "//:package.json",
# package_lock_json = "//:package-lock.json",
# )

0 comments on commit 07c0810

Please sign in to comment.