ts_next.conf 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # NEXT_ROOT is defined by _PEERDIR_TS_RESOURCE(next)
  2. NEXT_ROOT=
  3. TS_NEXT_OUTPUT_DIR=bundle
  4. TS_NEXT_CONFIG_PATH=next.config.js
  5. TS_NEXT_SRC_FILES=
  6. TS_NEXT_CMD=$TOUCH_UNIT \
  7. && $ADD_VCS_INFO_FILE_CMD \
  8. && ${cwd:BINDIR} $NOTS_TOOL build-nextjs $NOTS_TOOL_BASE_ARGS \
  9. --moddir $MODDIR --nextjs-resource $NEXT_ROOT \
  10. --nextjs-config ${input:TS_NEXT_CONFIG_PATH} --ts-config ${input:TS_CONFIG_PATH} \
  11. --vcs-info "${VCS_INFO_FILE}" --output-dir ${TS_NEXT_OUTPUT_DIR} \
  12. --node-modules-bundle $NOTS_TOOL_NODE_MODULES_BUNDLE $NODE_MODULES_BUNDLE_AS_OUTPUT ${hide:PEERS} \
  13. ${input;hide:"./package.json"} ${TS_CONFIG_FILES} ${output;hide:"output.tar"} \
  14. ${output;hide:"package.json"} ${kv;hide:"p TSNEXT"} ${kv;hide:"pc magenta"}
  15. ### @usage: TS_NEXT()
  16. ###
  17. ### NextJS app, built with `next build`. Requires sources to be under /src folder.
  18. ### /pages and /app on the root level ar not supported.
  19. ### Build results are output.tar.
  20. ###
  21. ### @example
  22. ###
  23. ### TS_NEXT()
  24. ### END()
  25. ###
  26. multimodule TS_NEXT {
  27. module BUILD: _TS_BASE_UNIT {
  28. .CMD=TS_NEXT_CMD
  29. .PEERDIRSELF=NODE_MODULES
  30. # epilogue is not inherited from TS_LIBRARY
  31. .EPILOGUE=_TS_NEXT_EPILOG
  32. # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
  33. # but we have to set it to TS for include processor to work
  34. SET(MODULE_TAG TS)
  35. _PEERDIR_TS_RESOURCE(next)
  36. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/${TS_CONFIG_PATH} ${CURDIR}/package.json)
  37. SET(TS_CONFIG_DEDUCE_OUT no)
  38. _TS_CONFIGURE($TS_CONFIG_PATH)
  39. # we should set NODE_MODULES_BUNDLE_AS_OUTPUT conditionally,
  40. # based on whether module has deps or doesn't have
  41. _SET_NODE_MODULES_BUNDLE_AS_OUTPUT()
  42. }
  43. module NODE_MODULES: _NODE_MODULES_BASE {
  44. }
  45. }
  46. macro TS_NEXT_CONFIG(Path) {
  47. SET(TS_NEXT_CONFIG_PATH $Path)
  48. }
  49. macro _TS_NEXT_EPILOG() {
  50. _TS_CONFIG_EPILOGUE()
  51. _GLOB(TS_NEXT_SRC_FILES ${CURDIR}/src/pages/**/* ${CURDIR}/pages/**/* ${CURDIR}/src/app/**/* ${CURDIR}/app/**/* ${CURDIR}/public/**/*)
  52. SRCS($TS_NEXT_SRC_FILES)
  53. }
  54. ### @usage: TS_NEXT_OUTPUT(DirName)
  55. ###
  56. ### Macro sets the output directory name for TS_NEXT module.
  57. ###
  58. ### - DirName - output directory name ("bundle" by default).
  59. macro TS_NEXT_OUTPUT(DirName) {
  60. SET(TS_NEXT_OUTPUT_DIR $DirName)
  61. }