blob: 075a9c56741f09fff68b3b9a8e388663ec8046cf [file] [log] [blame]
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
workspace(
name = "examples_vendored_node",
managed_directories = {"@npm": ["npm/node_modules"]},
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "c9c5d60d6234d65b06f86abd5edc60cadd1699f739ee49d33a099d2d67eb1ae8",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.4.0/rules_nodejs-4.4.0.tar.gz"],
)
load("@build_bazel_rules_nodejs//nodejs:repositories.bzl", "rules_nodejs_dependencies")
rules_nodejs_dependencies()
http_archive(
name = "vendored_node_15_0_1",
build_file_content = """exports_files(["node-v15.0.1-linux-x64/bin/node"])""",
sha256 = "cc9c3eed21755b490e5333ccab208ce15b539c35f64a764eeeae77c58746a7ff",
urls = ["https://nodejs.org/dist/v15.0.1/node-v15.0.1-linux-x64.tar.xz"],
)
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "npm_install")
# This example only works on linux as it downloads the linux node distribution
# TODO(gregmagolan): make node_repositories acccept different archives for different platforms
node_repositories(
node_version = "15.0.1",
vendored_node = "@vendored_node_15_0_1//:node-v15.0.1-linux-x64",
)
npm_install(
name = "npm",
data = [
"@vendored_node_15_0_1//:node-v15.0.1-linux-x64/bin/node",
],
package_json = "//:package.json",
package_lock_json = "//:package-lock.json",
)