Files
angular__angular/vscode-ng-language-service/BUILD.bazel
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

95 lines
2.8 KiB
Python
Raw Normal View History

load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template_rule")
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
load("@aspect_rules_ts//ts:defs.bzl", "ts_config")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@npm//vscode-ng-language-service:@vscode/vsce/package_json.bzl", vsce_bin = "bin")
npm_link_all_packages(name = "node_modules")
js_library(
name = "package_json",
srcs = ["package.json"],
visibility = ["//vscode-ng-language-service/syntaxes/test:__pkg__"],
)
ts_config(
name = "tsconfig",
src = "tsconfig.json",
visibility = ["//visibility:public"],
)
expand_template_rule(
name = "package_json_expanded",
out = "package_expanded.json",
stamp_substitutions = {
"0.0.0-PLACEHOLDER": "{{BUILD_SCM_VERSION}}",
},
substitutions = {
"../dist/bin/vscode-ng-language-service/client/index": "./index",
},
template = "package.json",
)
npm_package(
name = "vsix_sandbox",
srcs = [
"package_expanded.json",
"angular.png",
"CHANGELOG.md",
"README.md",
"//vscode-ng-language-service/client:index.js",
"//vscode-ng-language-service/server:npm_files",
"//vscode-ng-language-service/syntaxes:npm_files",
# Transitive closure of npm deps that are marked as "external" in esbuild needed for vsce;
# this set was determined manually by running `bazel build //:vsix` and burning down missing packages.
# We do this so that we don't have to run an additional `npm install` action to create a node_modules within the
# //:npm npm_package where the vsce build takes place.
"//vscode-ng-language-service:node_modules/@angular/language-service",
],
exclude_srcs_patterns = [
"*.map",
"**/*.map",
],
include_srcs_packages = [
"**",
],
replace_prefixes = {
"package_expanded.json": "package.json",
"server/package_expanded.json": "server/package.json",
"client/": "",
"syntaxes/src/": "syntaxes/",
},
)
vsce_bin.vsce(
name = "vsix",
srcs = [
":vsix_sandbox",
],
outs = ["ng-template.vsix"],
args = [
"package",
"-o",
"../ng-template.vsix",
"--allow-package-env-file",
"--allow-package-all-secrets",
],
chdir = "vscode-ng-language-service/vsix_sandbox",
# vsce requires npm on the PATH; we can get this from the Bazel rules_nodejs but it is not
# included by default in rules_js binary rules so we include it here explicitly
include_npm = True,
)
npm_package(
name = "npm",
srcs = [
":vsix",
":vsix_sandbox",
],
root_paths = [
"vsix_sandbox",
],
visibility = ["//vscode-ng-language-service/integration:__subpackages__"],
)