| # 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. |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| load("@npm_bazel_typescript//:index.bzl", "ts_library") |
| |
| ts_library( |
| name = "app", |
| srcs = glob(["*.ts"]), |
| deps = [ |
| "@npm//@nestjs/common", |
| "@npm//@nestjs/core", |
| "@npm//@types/node", |
| "@npm//tslib", |
| ], |
| ) |
| |
| load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") |
| |
| # 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//@nestjs/platform-express", |
| "@npm//minimist", |
| ], |
| entry_point = ":main.ts", |
| ) |
| |
| load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image") |
| |
| # bazel build --platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64 //src:docker |
| nodejs_image( |
| name = "docker", |
| data = [ |
| ":app", |
| ], |
| entry_point = ":main.ts", |
| # TODO: switch to fine grained deps -- see bazelbuild/rules_docker#1000 |
| # and add test for docker image |
| node_modules = "@npm//:node_modules", |
| ) |