-
Notifications
You must be signed in to change notification settings - Fork 122
/
BUILD.bazel
109 lines (102 loc) · 3.16 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@aspect_rules_js//js/private:expand_template.bzl", "expand_template")
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//:vsce/package_json.bzl", vsce_bin = "bin")
npm_link_all_packages(name = "node_modules")
js_library(
name = "package_json",
srcs = ["package.json"],
visibility = ["//syntaxes/test:__pkg__"],
)
ts_config(
name = "tsconfig",
src = "tsconfig.json",
visibility = ["//visibility:public"],
)
expand_template(
name = "package_json_expanded",
out = "package_expanded.json",
stamp_substitutions = {
"0.0.0-PLACEHOLDER": "{{BUILD_SCM_VERSION}}",
},
substitutions = {
"./bazel-bin/client/src/extension": "./index",
},
template = "package.json",
)
npm_package(
name = "vsix_sandbox",
srcs = [
"package_expanded.json",
"angular.png",
"CHANGELOG.md",
"README.md",
"//client:index.js",
"//server:npm_files",
"//syntaxes:npm_files",
# Transitive closure of npm deps 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.
":node_modules/@angular/language-service",
":node_modules/balanced-match",
":node_modules/brace-expansion",
":node_modules/concat-map",
":node_modules/lru-cache",
":node_modules/minimatch",
":node_modules/semver",
":node_modules/typescript",
":node_modules/vscode-jsonrpc",
":node_modules/vscode-html-languageservice",
":node_modules/vscode-languageclient",
":node_modules/vscode-languageserver-protocol",
":node_modules/vscode-languageserver-textdocument",
":node_modules/vscode-languageserver-types",
":node_modules/vscode-languageserver",
":node_modules/vscode-nls",
":node_modules/vscode-uri",
":node_modules/yallist",
],
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",
],
chdir = "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 = ["//integration:__subpackages__"],
)