ts.conf 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. # .NODE_TYPE=Bundle is required for peers propagation, but it also affects
  41. # how merging of pic/nopic graphs. Here we can override this merging behaviour
  42. SET(MODULE_TYPE LIBRARY)
  43. # Include processor works only for TS tag
  44. SET(MODULE_TAG TS)
  45. # TS should peer to TS
  46. SET(PEERDIR_TAGS TS TS_PROTO)
  47. # .fake tells builder to not materialize it in results
  48. SET(MODULE_SUFFIX .ts.fake)
  49. # We read erm-packages.json during configuration, so we have to include it to configuration cache key
  50. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/$ERM_PACKAGES_PATH)
  51. # PEERDIR that reads required version of tool from package.json
  52. _PEERDIR_TS_RESOURCE(nodejs pnpm)
  53. }
  54. # tag:test
  55. ESLINT_CONFIG_PATH=.eslintrc.js
  56. _TS_LINT_SRCS_VALUE=
  57. ### _TS_CONFIG_EPILOGUE() # internal
  58. ###
  59. ### This macro executes macros which should be invoked after all user specified macros in the ya.make file
  60. macro _TS_CONFIG_EPILOGUE() {
  61. ### Fill $TS_GLOB_FILES with potential inputs.
  62. ### It will be reduced later in _TS_CONFIGURE based on `tsconfig.json` rules.
  63. _GLOB(TS_GLOB_FILES $TS_GLOB_INCLUDE EXCLUDE $TS_GLOB_EXCLUDE)
  64. _GLOB(_TS_LINT_SRCS_VALUE **/*.(ts|tsx|js|jsx) EXCLUDE $TS_EXCLUDE_DIR_GLOB $TS_COMMON_OUTDIR_GLOB $TS_GLOB_EXCLUDE_ADDITIONAL)
  65. }
  66. # Used as inputs in TS_COMPILE through `$_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES)`
  67. TS_INPUT_FILES=
  68. # List of the files, filled in _TS_CONFIG_EPILOGUE. Will be reduced in _TS_CONFIGURE macro to TS_INPUT_FILES.
  69. TS_GLOB_FILES=
  70. # Hardcoded "include" list (all other files will be ignored)
  71. TS_GLOB_INCLUDE=**/*
  72. # Hardcoded "exclude" list (reasonable default).
  73. TS_GLOB_EXCLUDE=$TS_CONFIG_PATH \
  74. ya.make a.yaml \
  75. $TS_EXCLUDE_DIR_GLOB \
  76. $TS_COMMON_OUTDIR_GLOB \
  77. $TS_GLOB_EXCLUDE_ADDITIONAL \
  78. package.json pnpm-lock.yaml .* \
  79. tests/**/* **/*.(test|spec).(ts|tsx|js|jsx)
  80. # Ugly hack for using inputs from the variable
  81. macro _AS_HIDDEN_INPUTS(IN{input}[]) {
  82. # "context=TEXT" exclude file from the "include processing"
  83. .CMD=${input;hide;context=TEXT:IN}
  84. }
  85. _TS_FILES_COPY_CMD=
  86. ### TS_FILES(Files...)
  87. ###
  88. ### Adds files to output as is. Similar to FILES but works for TS build modules
  89. macro TS_FILES(Files...) {
  90. _TS_FILES($Files)
  91. }
  92. @import "${CONF_ROOT}/conf/ts/node_modules.conf"
  93. @import "${CONF_ROOT}/conf/ts/ts_next.conf"
  94. @import "${CONF_ROOT}/conf/ts/ts_package.conf"
  95. @import "${CONF_ROOT}/conf/ts/ts_proto.conf"
  96. @import "${CONF_ROOT}/conf/ts/ts_test.conf"
  97. @import "${CONF_ROOT}/conf/ts/ts_tsc.conf"
  98. @import "${CONF_ROOT}/conf/ts/ts_vite.conf"
  99. @import "${CONF_ROOT}/conf/ts/ts_webpack.conf"