ts_bundle.conf 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # WEBPACK_ROOT is defined by _PEERDIR_TS_RESOURCE(webpack)
  2. WEBPACK_ROOT=
  3. WEBPACK_OUTPUT_DIR=bundle
  4. WEBPACK_CONFIG_PATH=webpack.config.js
  5. TS_BUNDLE_WEBPACK=$TOUCH_UNIT \
  6. && $ADD_VCS_INFO_FILE_CMD \
  7. && ${cwd:BINDIR} $NOTS_TOOL bundle-webpack $NOTS_TOOL_BASE_ARGS --webpack-resource $WEBPACK_ROOT \
  8. --moddir $MODDIR --webpack-config ${input:WEBPACK_CONFIG_PATH} --ts-config ${input:TS_CONFIG_PATH} \
  9. --vcs-info "${VCS_INFO_FILE}" --output-dir ${WEBPACK_OUTPUT_DIR} \
  10. --node-modules-bundle $NOTS_TOOL_NODE_MODULES_BUNDLE $NODE_MODULES_BUNDLE_AS_OUTPUT ${hide:PEERS} \
  11. ${input;hide:"./package.json"} ${TS_CONFIG_FILES} ${output;hide:"output.tar"} \
  12. ${output;hide:"package.json"} ${kv;hide:"p TSWP"} ${kv;hide:"pc magenta"}
  13. ### @usage: WEBPACK_OUTPUT(DirName)
  14. ###
  15. ### Macro sets the output directory name for TS_BUNDLE module.
  16. ###
  17. ### - DirName - output directory name ("bundle" by default).
  18. macro WEBPACK_OUTPUT(DirName) {
  19. SET(WEBPACK_OUTPUT_DIR $DirName)
  20. }
  21. ### @usage: TS_BUNDLE([name])
  22. ###
  23. ### The Webpack bundle, bundles JavaScript code.
  24. ### Build results are packed as `output.tar`.
  25. ###
  26. ### @example
  27. ###
  28. ### TS_BUNDLE()
  29. ### SRCS(src/index.ts)
  30. ### END()
  31. ###
  32. multimodule TS_BUNDLE {
  33. module BUILD: _TS_BASE_UNIT {
  34. .CMD=TS_BUNDLE_WEBPACK
  35. .PEERDIRSELF=NODE_MODULES
  36. # epilogue is not inherited from TS_LIBRARY
  37. .EPILOGUE=_TS_CONFIG_EPILOGUE
  38. # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
  39. # but we have to set it to TS for include processor to work
  40. SET(MODULE_TAG TS)
  41. _PEERDIR_TS_RESOURCE(webpack)
  42. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/${TS_CONFIG_PATH} ${CURDIR}/package.json)
  43. SET(TS_CONFIG_DEDUCE_OUT no)
  44. _TS_CONFIGURE($TS_CONFIG_PATH)
  45. # we should set NODE_MODULES_BUNDLE_AS_OUTPUT conditionally,
  46. # based on whether module has deps or doesn't have
  47. _SET_NODE_MODULES_BUNDLE_AS_OUTPUT()
  48. }
  49. module NODE_MODULES: _NODE_MODULES_BASE {
  50. }
  51. }