blob: a291d26c73d759fe27550f97ba1cf8876869b75a (
plain) (
blame)
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
|
# NEXT_ROOT is defined by _PEERDIR_TS_RESOURCE(next)
NEXT_ROOT=
TS_NEXT_OUTPUT_DIR=bundle
TS_NEXT_CONFIG_PATH=next.config.js
TS_NEXT_SRC_FILES=
TS_NEXT_CMD=$TOUCH_UNIT \
&& $ADD_VCS_INFO_FILE_CMD \
&& ${cwd:BINDIR} $NOTS_TOOL build-nextjs $NOTS_TOOL_BASE_ARGS \
--moddir $MODDIR --nextjs-resource $NEXT_ROOT \
--nextjs-config ${input:TS_NEXT_CONFIG_PATH} --ts-config ${input:TS_CONFIG_PATH} \
--vcs-info "${VCS_INFO_FILE}" --output-dir ${TS_NEXT_OUTPUT_DIR} \
--node-modules-bundle $NOTS_TOOL_NODE_MODULES_BUNDLE $NODE_MODULES_BUNDLE_AS_OUTPUT ${hide:PEERS} \
${input;hide:"./package.json"} ${TS_CONFIG_FILES} ${output;hide:"output.tar"} \
${output;hide:"package.json"} ${kv;hide:"p TSNEXT"} ${kv;hide:"pc magenta"}
### @usage: TS_NEXT()
###
### NextJS app, built with `next build`. Requires sources to be under /src folder.
### /pages and /app on the root level ar not supported.
### Build results are output.tar.
###
### @example
###
### TS_NEXT()
### END()
###
multimodule TS_NEXT {
module BUILD: _TS_BASE_UNIT {
.CMD=TS_NEXT_CMD
.PEERDIRSELF=NODE_MODULES
# epilogue is not inherited from TS_LIBRARY
.EPILOGUE=_TS_NEXT_EPILOG
# by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
# but we have to set it to TS for include processor to work
SET(MODULE_TAG TS)
_PEERDIR_TS_RESOURCE(next)
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/${TS_CONFIG_PATH} ${CURDIR}/package.json)
SET(TS_CONFIG_DEDUCE_OUT no)
_TS_CONFIGURE($TS_CONFIG_PATH)
# we should set NODE_MODULES_BUNDLE_AS_OUTPUT conditionally,
# based on whether module has deps or doesn't have
_SET_NODE_MODULES_BUNDLE_AS_OUTPUT()
}
module NODE_MODULES: _NODE_MODULES_BASE {
}
}
macro TS_NEXT_CONFIG(Path) {
SET(TS_NEXT_CONFIG_PATH $Path)
}
macro _TS_NEXT_EPILOG() {
_TS_CONFIG_EPILOGUE()
_GLOB(TS_NEXT_SRC_FILES ${CURDIR}/src/pages/**/* ${CURDIR}/pages/**/* ${CURDIR}/src/app/**/* ${CURDIR}/app/**/* ${CURDIR}/public/**/*)
SRCS($TS_NEXT_SRC_FILES)
}
### @usage: TS_NEXT_OUTPUT(DirName)
###
### Macro sets the output directory name for TS_NEXT module.
###
### - DirName - output directory name ("bundle" by default).
macro TS_NEXT_OUTPUT(DirName) {
SET(TS_NEXT_OUTPUT_DIR $DirName)
}
|