node_modules.conf 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. PNPM_ROOT=
  2. PNPM_SCRIPT=$PNPM_ROOT/node_modules/pnpm/dist/pnpm.cjs
  3. NPM_ROOT=
  4. NPM_SCRIPT=$NPM_ROOT/node_modules/npm/bin/npm-cli.js
  5. PM_SCRIPT=
  6. PM_TYPE=
  7. NPM_CONTRIBS_PATH=-
  8. # combined input/outputs records as list of directives ${input;hide:<path>} ${output;hide:<path>}, used in builders
  9. _NODE_MODULES_INOUTS=
  10. _YATOOL_PREBUILDER_ARG=
  11. macro CUSTOM_CONTRIB_TYPESCRIPT(P) {
  12. SET(NPM_CONTRIBS_PATH -)
  13. }
  14. macro NO_CONTRIB_TYPESCRIPT() {
  15. SET(NPM_CONTRIBS_PATH -)
  16. }
  17. ### @usage: NPM_CONTRIBS() # internal
  18. ###
  19. ### Defines special module that provides contrib tarballs from internal npm registry.
  20. ###
  21. ### @see [FROM_NPM_LOCKFILES()](#macro_FROM_NPM_LOCKFILES)
  22. module NPM_CONTRIBS: _BARE_UNIT {
  23. .CMD=TOUCH_UNIT
  24. .PEERDIR_POLICY=as_build_from
  25. .FINAL_TARGET=no
  26. .ALLOWED=FROM_NPM_LOCKFILES
  27. .RESTRICTED=PEERDIR
  28. .EXTS=_ # Ignore all files, so module is not affected by FROM_NPM output (.EXTS=* is inherited from _BARE_UNIT)
  29. SET(MODULE_TAG NPM_CONTRIBS)
  30. SET(MODULE_LANG TS)
  31. # .fake tells builder to not materialize it in results
  32. SET(MODULE_SUFFIX .fake)
  33. }
  34. ### @usage: FROM_NPM_LOCKFILES(LOCKFILES...) # internal
  35. ###
  36. ### Defines lockfile list for `NPM_CONTRIBS` module.
  37. ###
  38. ### @see [NPM_CONTRIBS()](#module_NPM_CONTRIBS)
  39. macro FROM_NPM_LOCKFILES(LOCKFILES...) {
  40. # SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS $LOCKFILES)
  41. # See implementation in build/plugins/nots.py
  42. # _FROM_NPM_LOCKFILES($LOCKFILES)
  43. MESSAGE("NPM_CONTRIBS and FROM_NPM_LOCKFILES are disabled. Please exclude them from your build process")
  44. }
  45. FROM_NPM_CWD=$ARCADIA_BUILD_ROOT/$NPM_CONTRIBS_PATH
  46. macro _FROM_NPM(TARBALL_URL, SKY_ID, INTEGRITY, INTEGRITY_ALGO, TARBALL_PATH) {
  47. .CMD=${cwd:FROM_NPM_CWD} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_npm.py"} ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/sky.py"} --tarball-url $TARBALL_URL --sky-id $SKY_ID --integrity $INTEGRITY --integrity-algorithm $INTEGRITY_ALGO --copy-to ${output;noauto:TARBALL_PATH} ${requirements;hide:"network:full"} ${kv;hide:"p TS_FNPM"} ${kv;hide:"pc magenta"}
  48. # we want output to be available for other modules without affecting NPM_CONTRIBS
  49. # we need to expose it (some details in https://st.yandex-team.ru/YMAKE-34)
  50. _EXPOSE($TARBALL_PATH)
  51. }
  52. macro _TS_ADD_NODE_MODULES_FOR_BUILDER() {
  53. # Calculate inputs and outputs of node_modules, fill `_NODE_MODULES_INOUTS` variable
  54. _NODE_MODULES_CONFIGURE()
  55. }
  56. _TARBALLS_STORE=__tarballs__
  57. _PREPARE_DEPS_INOUTS=
  58. _PREPARE_DEPS_RESOURCES=
  59. _PREPARE_DEPS_USE_RESOURCES_FLAG=
  60. _PREPARE_DEPS_CMD=$TOUCH_UNIT \
  61. && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS prepare-deps \
  62. --tarballs-store $_TARBALLS_STORE \
  63. $_PREPARE_DEPS_INOUTS \
  64. $_PREPARE_DEPS_RESOURCES \
  65. $_PREPARE_DEPS_USE_RESOURCES_FLAG \
  66. ${kv;hide:"pc magenta"} ${kv;hide:"p TS_DEP"}
  67. # In case of no deps we need to create empty outputs for graph connectivity
  68. _PREPARE_NO_DEPS_CMD=$TOUCH_UNIT \
  69. && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} \
  70. $_PREPARE_DEPS_INOUTS \
  71. ${kv;hide:"pc magenta"} ${kv;hide:"p TS_NODEP"}
  72. module _PREPARE_DEPS_BASE: _BARE_UNIT {
  73. .CMD=_PREPARE_DEPS_CMD
  74. .IGNORED=SRCS FILES TS_FILES COPY_FILE
  75. # Propagates peers to related modules
  76. .PEERDIR_POLICY=as_build_from
  77. .NODE_TYPE=Bundle
  78. .INCLUDE_TAG=no
  79. # we have several modules in the same dir (.PEERDIRSELF=TS_PREPARE_DEPS in BUILD)
  80. # we need different names for module identity file
  81. # .fake tells builder to not materialize it in results
  82. SET(MODULE_SUFFIX .prepare_deps.fake)
  83. # .NODE_TYPE=Bundle is required for peers propagation, but it also affects
  84. # how merging of pic/nopic graphs. Here we can override this merging behaviour
  85. SET(MODULE_TYPE LIBRARY)
  86. # define own tag
  87. SET(MODULE_TAG TS_PREPARE_DEPS)
  88. SET(MODULE_LANG TS)
  89. # what modules it can PEERDIR to
  90. SET(PEERDIR_TAGS TS_PREPARE_DEPS)
  91. # do not include it into "results" of graph
  92. DISABLE(START_TARGET)
  93. # we read pnpm-lock.yaml and package.json during configuration
  94. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/pnpm-lock.yaml ${CURDIR}/package-lock.json ${CURDIR}/package.json)
  95. _SET_PACKAGE_MANAGER()
  96. _PREPARE_DEPS_CONFIGURE()
  97. }