-
-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy pathBUILD.bazel
More file actions
86 lines (77 loc) · 1.96 KB
/
BUILD.bazel
File metadata and controls
86 lines (77 loc) · 1.96 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
load("@aspect_rules_js//contrib/nextjs:defs.bzl", "nextjs_standalone_build", "nextjs_standalone_server")
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@bazel_lib//lib:write_source_files.bzl", "write_source_files")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@npm//nextjs:next/package_json.bzl", next_bin = "bin")
npm_link_all_packages()
# The nextjs binary target to used by nextjs:defs.bzl
next_bin.next_binary(
name = "next_js_binary",
visibility = ["//visibility:public"],
)
js_library(
name = "lib",
srcs = glob([
"src/**",
"public/**",
]),
deps = [
":node_modules/next",
":node_modules/react",
":node_modules/react-dom",
],
)
js_library(
name = "nextjs-css",
srcs = [
"postcss.config.mjs",
],
deps = [
":node_modules/@tailwindcss/postcss",
":node_modules/tailwindcss",
],
)
# The standard nextjs build/start/dev workflow
# nextjs(
# name = "app",
# srcs = [
# "jsconfig.json",
# ":nextjs-css",
# ":lib",
# ],
# config = "next.config.mjs",
# next_js_binary = ":next_js_binary",
# )
# A standalone nextjs build
nextjs_standalone_build(
name = "standalone",
srcs = [
"jsconfig.json",
":lib",
":nextjs-css",
],
config = "next.standalone.mjs",
next_js_binary = ":next_js_binary",
silent_on_success = False,
)
# A standalone server
nextjs_standalone_server(
name = "server",
app = ":standalone",
)
# Verify next (which has optional platform/os specific dependencies) can be built
build_test(
name = "next_build_test",
targets = [":node_modules/next"],
)
write_source_files(
name = "write_next_links_defs",
files = {
"snapshots/next_links_defs.bzl": "@npm__next__14.2.35_1816342077__links//:defs.bzl",
},
tags = [
"skip-on-bazel8",
"skip-on-bazel9",
],
)