aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/ts/ts_next.conf
diff options
context:
space:
mode:
authoralexv-smirnov <alex@ydb.tech>2023-06-13 11:05:01 +0300
committeralexv-smirnov <alex@ydb.tech>2023-06-13 11:05:01 +0300
commitbf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0 (patch)
tree1d1df72c0541a59a81439842f46d95396d3e7189 /build/conf/ts/ts_next.conf
parent8bfdfa9a9bd19bddbc58d888e180fbd1218681be (diff)
downloadydb-bf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0.tar.gz
add ymake export to ydb
Diffstat (limited to 'build/conf/ts/ts_next.conf')
-rw-r--r--build/conf/ts/ts_next.conf61
1 files changed, 61 insertions, 0 deletions
diff --git a/build/conf/ts/ts_next.conf b/build/conf/ts/ts_next.conf
new file mode 100644
index 0000000000..dd4945e101
--- /dev/null
+++ b/build/conf/ts/ts_next.conf
@@ -0,0 +1,61 @@
+# NEXT_ROOT is redefined in /build/plugins/nots.py _set_resource_vars()
+NEXT_ROOT=
+TS_NEXT_CONFIG_PATH=next.config.js
+TS_NEXT_SRC_FILES=
+
+
+TS_NEXT_CMD=$TOUCH_UNIT \
+ && ${cwd:BINDIR} $NOTS_TOOL build-nextjs $NOTS_TOOL_BASE_ARGS \
+ --nextjs-resource $NEXT_ROOT \
+ --nextjs-config ${input:TS_NEXT_CONFIG_PATH} --ts-config ${input:TS_CONFIG_PATH} \
+ --node-modules-bundle $NOTS_TOOL_NODE_MODULES_BUNDLE $NODE_MODULES_BUNDLE_AS_OUTPUT ${hide:PEERS} \
+ ${input;hide:"./package.json"} ${TS_CONFIG_FILES} ${output;hide:"bundle.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 bundle.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)
+}
+