Rob Mohr | be98ead | 2019-11-14 07:16:40 -0800 | [diff] [blame] | 1 | # Copyright 2019 The Pigweed Authors |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 | # use this file except in compliance with the License. You may obtain a copy of |
| 5 | # the License at |
| 6 | # |
| 7 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations under |
| 13 | # the License. |
Matthew Soulanille | 376d797 | 2020-06-01 15:50:07 -0700 | [diff] [blame] | 14 | |
| 15 | workspace( |
| 16 | name = "pigweed", |
| 17 | managed_directories = {"@npm": ["node_modules"]}, |
| 18 | ) |
| 19 | |
| 20 | # Set up build_bazel_rules_nodejs |
| 21 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
| 22 | http_archive( |
| 23 | name = "build_bazel_rules_nodejs", |
| 24 | sha256 = "f9e7b9f42ae202cc2d2ce6d698ccb49a9f7f7ea572a78fd451696d03ef2ee116", |
| 25 | urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.6.0/rules_nodejs-1.6.0.tar.gz"], |
| 26 | ) |
| 27 | |
| 28 | load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories") |
| 29 | |
| 30 | node_repositories(package_json = ["//:package.json"]) |
| 31 | |
| 32 | # Install packages with yarn |
| 33 | load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") |
| 34 | yarn_install( |
| 35 | name = "npm", |
| 36 | package_json = "//:package.json", |
| 37 | yarn_lock = "//:yarn.lock", |
| 38 | ) |
| 39 | |
| 40 | # Install Bazel rules from npm packages |
| 41 | load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies") |
| 42 | install_bazel_dependencies() |
| 43 | |
| 44 | |
| 45 | # Setup TypeScript |
| 46 | load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace") |
| 47 | ts_setup_workspace() |