blob: e69f271ceb051b27f35a90be37f8e87d1f1a3c6f [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 = "8f5f192ba02319254aaf2cdcca00ec12eaafeb979a80a1e946773c520ae0a2c9",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.7.0/rules_nodejs-3.7.0.tar.gz"],
)
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",
)