| # 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. |
| |
| load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") |
| load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image") |
| load("@npm//@bazel/typescript:index.bzl", "ts_project") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| ts_project( |
| name = "app", |
| srcs = glob( |
| ["*.ts"], |
| exclude = ["*.spec.ts"], |
| ), |
| declaration = True, |
| tsconfig = "//:tsconfig.json", |
| deps = [ |
| "@npm//@nestjs/common", |
| "@npm//@nestjs/core", |
| "@npm//@nestjs/platform-express", |
| "@npm//@types/node", |
| "@npm//tslib", |
| ], |
| ) |
| |
| ts_project( |
| name = "test_lib", |
| srcs = glob(["*.spec.ts"]), |
| declaration = True, |
| tsconfig = "//:tsconfig.json", |
| deps = [ |
| ":app", |
| "@npm//@nestjs/common", |
| "@npm//@types/jasmine", |
| "@npm//@types/superagent", |
| "@npm//@types/supertest", |
| "@npm//jasmine", |
| "@npm//superagent", |
| "@npm//supertest", |
| ], |
| ) |
| |
| # bazel run //src:server -- --port=4000 |
| # TODO(gregmagolan): add test for nest server with protractor rule once it is brought in |
| nodejs_binary( |
| name = "server", |
| data = [ |
| ":app", |
| "@npm//@nestjs/common", |
| "@npm//@nestjs/core", |
| "@npm//minimist", |
| ], |
| entry_point = ":main.ts", |
| ) |
| |
| # bazel build --platforms=@rules_nodejs//nodejs:linux_amd64 //src:docker |
| nodejs_image( |
| name = "docker", |
| binary = ":server", |
| include_node_repo_args = False, |
| node_repository_name = "nodejs_linux_amd64", |
| ) |