ts.conf 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. NODEJS_ROOT=
  2. NODEJS_BIN=$NODEJS_ROOT/node
  3. TS_TRACE=no
  4. TS_LOCAL_CLI=no
  5. # Use outdir defined in tsconfig
  6. TS_CONFIG_USE_OUTDIR=
  7. NOTS_TOOL=${tool:"devtools/frontend_build_platform/nots/builder"}
  8. # Arguments for the all commands of the `nots/builder`, passed before the command
  9. NOTS_TOOL_BASE_ARGS=\
  10. --arcadia-root $ARCADIA_ROOT \
  11. --arcadia-build-root $ARCADIA_BUILD_ROOT \
  12. --moddir $MODDIR \
  13. --local-cli $TS_LOCAL_CLI \
  14. --nodejs-bin $NODEJS_BIN \
  15. --pnpm-script $PNPM_SCRIPT \
  16. --contribs $NPM_CONTRIBS_PATH \
  17. --trace $TS_TRACE \
  18. --verbose $TS_LOG \
  19. $_YATOOL_PREBUILDER_ARG
  20. # Arguments for builders' commands, passed after the command
  21. NOTS_TOOL_COMMON_BUILDER_ARGS=\
  22. --output-file ${output:TS_OUTPUT_FILE} ${output;hide:TS_OUTPUT_FILE_UUID} \
  23. --tsconfigs $TS_CONFIG_PATH \
  24. --vcs-info "${VCS_INFO_FILE}"
  25. ERM_PACKAGES_PATH=devtools/frontend_build_platform/erm/erm-packages.json
  26. TS_CONFIG_PATH=tsconfig.json
  27. TS_OUTPUT_FILE=output.tar
  28. TS_OUTPUT_FILE_UUID=output.tar.uuid
  29. TS_EXCLUDE_DIR_GLOB=(.idea|.vscode|node_modules)/**/*
  30. TS_COMMON_OUTDIR_GLOB=(build|dist|bundle|$WEBPACK_OUTPUT_DIR|$TS_NEXT_OUTPUT_DIR|$VITE_OUTPUT_DIR)/**/*
  31. TS_GLOB_EXCLUDE_ADDITIONAL=
  32. module _TS_BASE_UNIT: _BARE_UNIT {
  33. # Propagates peers to related modules
  34. .PEERDIR_POLICY=as_build_from
  35. .NODE_TYPE=Bundle
  36. # Needed for DEPENDS in tests to choose right submodule from multimodule
  37. .FINAL_TARGET=yes
  38. # use TS_FILES instead of FILES
  39. .ALIASES=FILES=TS_FILES
  40. # TODO: remove this. YMAKE-1096 / FBP-1184
  41. _NEVERCACHE()
  42. # .NODE_TYPE=Bundle is required for peers propagation, but it also affects
  43. # how merging of pic/nopic graphs. Here we can override this merging behaviour
  44. SET(MODULE_TYPE LIBRARY)
  45. # Include processor works only for TS tag
  46. SET(MODULE_TAG TS)
  47. # TS should peer to TS
  48. SET(PEERDIR_TAGS TS TS_PROTO)
  49. # .fake tells builder to not materialize it in results
  50. SET(MODULE_SUFFIX .ts.fake)
  51. # We read erm-packages.json during configuration, so we have to include it to configuration cache key
  52. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/$ERM_PACKAGES_PATH)
  53. # PEERDIR that reads required version of tool from package.json
  54. _PEERDIR_TS_RESOURCE(nodejs pnpm)
  55. }
  56. # tag:test
  57. ESLINT_CONFIG_PATH=.eslintrc.js
  58. _TS_LINT_SRCS_VALUE=
  59. ### _TS_CONFIG_EPILOGUE() # internal
  60. ###
  61. ### This macro executes macros which should be invoked after all user specified macros in the ya.make file
  62. macro _TS_CONFIG_EPILOGUE() {
  63. ### Fill $TS_GLOB_FILES with potential inputs.
  64. ### It will be reduced later in _TS_CONFIGURE based on `tsconfig.json` rules.
  65. _GLOB(TS_GLOB_FILES $TS_GLOB_INCLUDE EXCLUDE $TS_GLOB_EXCLUDE)
  66. _GLOB(_TS_LINT_SRCS_VALUE **/*.(ts|tsx|js|jsx) EXCLUDE $TS_EXCLUDE_DIR_GLOB $TS_COMMON_OUTDIR_GLOB $TS_GLOB_EXCLUDE_ADDITIONAL)
  67. _SETUP_EXTRACT_NODE_MODULES_RECIPE(${MODDIR})
  68. }
  69. # Used as inputs in TS_COMPILE through `$_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES)`
  70. TS_INPUT_FILES=
  71. # List of the files, filled in _TS_CONFIG_EPILOGUE. Will be reduced in _TS_CONFIGURE macro to TS_INPUT_FILES.
  72. TS_GLOB_FILES=
  73. # Hardcoded "include" list (all other files will be ignored)
  74. TS_GLOB_INCLUDE=**/*
  75. # Hardcoded "exclude" list (reasonable default).
  76. TS_GLOB_EXCLUDE=$TS_CONFIG_PATH \
  77. ya.make a.yaml \
  78. $TS_EXCLUDE_DIR_GLOB \
  79. $TS_COMMON_OUTDIR_GLOB \
  80. $TS_GLOB_EXCLUDE_ADDITIONAL \
  81. package.json pnpm-lock.yaml .* \
  82. tests/**/* **/*.(test|spec).(ts|tsx|js|jsx)
  83. # Ugly hack for using inputs from the variable
  84. macro _AS_HIDDEN_INPUTS(IN{input}[]) {
  85. # "context=TEXT" exclude file from the "include processing"
  86. .CMD=${input;hide;context=TEXT:IN}
  87. }
  88. _TS_FILES_COPY_CMD=
  89. ### TS_FILES(Files...)
  90. ###
  91. ### Adds files to output as is. Similar to FILES but works for TS build modules
  92. macro TS_FILES(Files...) {
  93. _TS_FILES($Files)
  94. }
  95. @import "${CONF_ROOT}/conf/ts/node_modules.conf"
  96. @import "${CONF_ROOT}/conf/ts/ts_next.conf"
  97. @import "${CONF_ROOT}/conf/ts/ts_package.conf"
  98. @import "${CONF_ROOT}/conf/ts/ts_proto.conf"
  99. @import "${CONF_ROOT}/conf/ts/ts_test.conf"
  100. @import "${CONF_ROOT}/conf/ts/ts_tsc.conf"
  101. @import "${CONF_ROOT}/conf/ts/ts_vite.conf"
  102. @import "${CONF_ROOT}/conf/ts/ts_webpack.conf"