-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBUILD.bazel
More file actions
161 lines (126 loc) · 4 KB
/
Copy pathBUILD.bazel
File metadata and controls
161 lines (126 loc) · 4 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package(default_visibility = ["//visibility:public"])
filegroup(
name = "node_modules",
srcs = glob(
["node_modules/**/*"],
exclude=["node_modules/**/test/**"]
),
)
filegroup(name = "testgroup", srcs = glob(["src/**", "public/**"]))
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
nodejs_binary(
name = "parcel",
entry_point = "parcel-bundler/bin/cli.js",
node_modules = "//:node_modules",
# data = glob(["src/**", "public/**"]) + ["package.json", ".babelrc"],
templated_args = ["--node_options=--preserve-symlinks"],
)
load(":parcelgen.bzl", "parcel")
parcel(
name = "parcel-build",
srcs = ["//:testgroup", "package.json", ".babelrc"],
node_modules="//:node_modules",
entry_point = "src/index.js",
)
##############################################################
# THIS IS ALL OLD CRAP KEEPING HERE FOR REFERENCE FOR A BIT
##############################################################
# nodejs_binary(
# name = "webpack",
# entry_point = "webpack/bin/webpack.js",
# visibility = ["//visibility:public"],
# )
# nodejs_binary(
# name = "rsbinary",
# entry_point = "react-scripts/scripts/build.js",
# node_modules = "//:node_modules",
# # templated_args = ["--node_options=--preserve-symlinks"],
# # data = ["//:testgroup", "//:package.json", "//:node_modules"],
# )
# load(":rsgen.bzl", "rs")
# rs(
# name = "rsgen",
# srcs = ["//:testgroup", "package.json", "//:node_modules"],
# )
##################################################
# This is the react scripts build... doesn"t work.
##################################################
# nodejs_binary(
# name = "reactscripts",
# entry_point = "react-scripts/bin/react-scripts.js",
# node_modules = "@noodles//:node_modules",
# # data = glob([
# # "src/**",
# # "public/**",
# # ]) + ["//:package.json"] + ["@noodles//:node_modules"],
# templated_args = ["--node_options=--preserve-symlinks"],
# )
# load(":reactscripts.bzl", "reactscripts")
# reactscripts(
# name = "reactscripts-build",
# srcs = glob([
# "src/**",
# "public/**",
# ]) + ["//:package.json"],
# )
# This doesnt work at all.
# genrule(
# name = "reactscriptsgen",
# srcs = glob([
# "src/**",
# "public/**",
# ]) + ["//:package.json"] + ["@noodles//:node_modules"],
# outs = ["build"],
# cmd = """
# ls -l external
# """,
# # tags = ["local"],
# )
##################################################
# Parcel build... works with a unsandboxed genrule but not with a .bzl extension rule.
##################################################
# genrule(
# name = "parcelgen",
# srcs = glob([
# "src/**",
# "public/**",
# ]) + ["//:package.json"] + [".babelrc"] + ["//:node_modules"],
# outs = ["build"],
# cmd = """
# parcel build src/index.js --out-dir build
# cp -R build $(@D)
# """,
# # tags = ["local"], # uncomment this to un-sandbox... build is successful with this.
# )
# genrule(
# name = "parcelwatch",
# srcs = glob([
# "src/**",
# "public/**",
# ]) + ["//:package.json"] + [".babelrc"] + ["//:node_modules"],
# outs = ["watch"],
# cmd = """
# parcel public/index.html
# """,
# # tags = ["local"], # uncomment this to un-sandbox... build is successful with this.
# )
##################################################
# Rollup build
# This isnt finished being setup. Needs rollup configuration (complicated) in order
# to parse jsx / react / es6+
# This is taken from their example: https://github.com/bazelbuild/rules_nodejs/tree/master/examples/rollup
##################################################
# nodejs_binary(
# name = "rollup",
# entry_point = "rollup/bin/rollup",
# node_modules = "@noodles//:node_modules",
# )
# load(":rollupgen.bzl", "rollup")
# rollup(
# name = "bundle",
# entry_point = "src/index.js",
# srcs = glob([
# "src/**",
# "public/**",
# ]) + ["//:package.json"] + [".babelrc"],
# )