aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkhoden <khoden@yandex-team.com>2024-04-16 22:18:51 +0300
committerkhoden <khoden@yandex-team.com>2024-04-16 22:28:58 +0300
commitbd8653253d9e381a5c5d7c544ee1519bae3e04c3 (patch)
treed12a29b5a4ef8c56a1b0ed8a62a0243924f3a2f4
parentf8eaebae946ddd400311b072bc5d2599db5ada14 (diff)
downloadydb-bd8653253d9e381a5c5d7c544ee1519bae3e04c3.tar.gz
conf: Макросы для переопределения переменных (как абстракцию для пользователей)
В конфигурации добавил макросы для определения внутренних переменных: TS_CONFIG() (также разрешил использовать его внутри определения модуля) TS_ESLINT_CONFIG() TS_EXCLUDE_FILES_GLOB() TS_VITE_CONFIG() TS_WEBPACK_CONFIG() В глоссарий добавил ссылок на оф. сайты (удобно!) В FAQ добавил пункт о VCS_INFO_FILE 228a61b486a4a7b580019a29fe78a64c148b5518
-rw-r--r--build/conf/ts/ts.conf37
-rw-r--r--build/conf/ts/ts_next.conf38
-rw-r--r--build/conf/ts/ts_proto.conf4
-rw-r--r--build/conf/ts/ts_tsc.conf2
-rw-r--r--build/conf/ts/ts_vite.conf40
-rw-r--r--build/conf/ts/ts_webpack.conf38
-rw-r--r--build/plugins/nots.py3
7 files changed, 118 insertions, 44 deletions
diff --git a/build/conf/ts/ts.conf b/build/conf/ts/ts.conf
index 4d419a0bd5..f819587468 100644
--- a/build/conf/ts/ts.conf
+++ b/build/conf/ts/ts.conf
@@ -3,11 +3,24 @@ NODEJS_BIN=$NODEJS_ROOT/node
TS_TRACE=no
TS_LOCAL_CLI=no
-# Use outdir defined in tsconfig
+# Use outdir defined in tsconfig (actual not for bundlers, they use own way to define output directory)
TS_CONFIG_USE_OUTDIR=
NOTS_TOOL=${tool:"devtools/frontend_build_platform/nots/builder"}
+
+TS_CONFIG_PATH=tsconfig.json
+
+### @usage: TS_CONFIG(ConfigPath)
+###
+### Macro sets the path for "TypeScript Config".
+###
+### - ConfigPath - config path (one at least)
+macro TS_CONFIG(FirstConfigPath, ConfigPath...) {
+ SET(TS_CONFIG_PATH $FirstConfigPath $ConfigPath)
+}
+
+
# Arguments for the all commands of the `nots/builder`, passed before the command
NOTS_TOOL_BASE_ARGS=\
--arcadia-root $ARCADIA_ROOT \
@@ -29,13 +42,23 @@ NOTS_TOOL_COMMON_BUILDER_ARGS=\
ERM_PACKAGES_PATH=devtools/frontend_build_platform/erm/erm-packages.json
-TS_CONFIG_PATH=tsconfig.json
TS_OUTPUT_FILE=output.tar
TS_OUTPUT_FILE_UUID=output.tar.uuid
TS_EXCLUDE_DIR_GLOB=(.idea|.vscode|node_modules)/**/*
TS_COMMON_OUTDIR_GLOB=(build|dist|bundle|\${join=|:WEBPACK_OUTPUT_DIR}|$TS_NEXT_OUTPUT_DIR|$VITE_OUTPUT_DIR)/**/*
+
TS_GLOB_EXCLUDE_ADDITIONAL=
+### @usage: TS_EXCLUDE_FILES_GLOB(GlobExpression)
+###
+### Macro sets glob to mark some files to ignore while building.
+### These files won't be copied to BINDIR.
+###
+### - GlobExpression - glob expression
+macro TS_EXCLUDE_FILES_GLOB(GlobExpression) {
+ SET(TS_GLOB_EXCLUDE_ADDITIONAL $GlobExpression)
+}
+
module _TS_BASE_UNIT: _BARE_UNIT {
# Propagates peers to related modules
.PEERDIR_POLICY=as_build_from
@@ -65,6 +88,16 @@ module _TS_BASE_UNIT: _BARE_UNIT {
# tag:test
ESLINT_CONFIG_PATH=.eslintrc.js
+
+### @usage: TS_ESLINT_CONFIG(ConfigPath)
+###
+### Macro sets the path for ESLint config file.
+###
+### - ConfigPath - config path
+macro TS_ESLINT_CONFIG(ConfigName) {
+ SET(TS_GLOB_EXCLUDE_ADDITIONAL $GlobExpression)
+}
+
_TS_LINT_SRCS_VALUE=
### _TS_CONFIG_EPILOGUE() # internal
###
diff --git a/build/conf/ts/ts_next.conf b/build/conf/ts/ts_next.conf
index b4f1c63a5c..1201fa6267 100644
--- a/build/conf/ts/ts_next.conf
+++ b/build/conf/ts/ts_next.conf
@@ -1,6 +1,26 @@
-TS_NEXT_OUTPUT_DIR=.next
TS_NEXT_CONFIG_PATH=next.config.js
+### @usage: TS_NEXT_CONFIG(ConfigPath)
+###
+### Macro sets the config path for TS_NEXT module.
+###
+### - ConfigPath - config path
+macro TS_NEXT_CONFIG(ConfigPath) {
+ SET(TS_NEXT_CONFIG_PATH $ConfigPath)
+}
+
+
+TS_NEXT_OUTPUT_DIR=.next
+
+### @usage: TS_NEXT_OUTPUT(DirName)
+###
+### Macro sets the output directory name for TS_NEXT module.
+###
+### - DirName - output directory name
+macro TS_NEXT_OUTPUT(DirName) {
+ SET(TS_NEXT_OUTPUT_DIR $DirName)
+}
+
TS_NEXT_CMD=$TOUCH_UNIT \
&& $_TS_FILES_COPY_CMD \
&& $ADD_VCS_INFO_FILE_CMD \
@@ -38,7 +58,7 @@ multimodule TS_NEXT {
DISABLE(TS_CONFIG_DEDUCE_OUT)
DISABLE(TS_CONFIG_USE_OUTDIR)
- _TS_CONFIGURE($TS_CONFIG_PATH)
+ _TS_CONFIGURE()
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
_TS_ADD_NODE_MODULES_FOR_BUILDER()
@@ -48,17 +68,3 @@ multimodule TS_NEXT {
}
}
-
-macro TS_NEXT_CONFIG(Path) {
- SET(TS_NEXT_CONFIG_PATH $Path)
-}
-
-
-### @usage: TS_NEXT_OUTPUT(DirName)
-###
-### Macro sets the output directory name for TS_NEXT module.
-###
-### - DirName - output directory name ("bundle" by default).
-macro TS_NEXT_OUTPUT(DirName) {
- SET(TS_NEXT_OUTPUT_DIR $DirName)
-}
diff --git a/build/conf/ts/ts_proto.conf b/build/conf/ts/ts_proto.conf
index 115ec0f498..c2cde484fc 100644
--- a/build/conf/ts/ts_proto.conf
+++ b/build/conf/ts/ts_proto.conf
@@ -33,7 +33,7 @@ module _TS_PROTO_IMPL: _TS_BASE_UNIT {
DISABLE(TS_CONFIG_DEDUCE_OUT)
ENABLE(TS_CONFIG_USE_OUTDIR)
- _TS_CONFIGURE($TS_CONFIG_PATH)
+ _TS_CONFIGURE()
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
_TS_ADD_NODE_MODULES_FOR_BUILDER()
@@ -42,4 +42,4 @@ module _TS_PROTO_IMPL: _TS_BASE_UNIT {
### @usage: _TS_PROTO_SRCS(path1 path2) # internal
macro _TS_PROTO_SRCS(FILES...) {
_SET_APPEND_WITH_DIRECTIVE(_TS_PROTO_SRCS_FILES input $FILES)
-} \ No newline at end of file
+}
diff --git a/build/conf/ts/ts_tsc.conf b/build/conf/ts/ts_tsc.conf
index cba05e44a8..b96e1751bc 100644
--- a/build/conf/ts/ts_tsc.conf
+++ b/build/conf/ts/ts_tsc.conf
@@ -32,7 +32,7 @@ multimodule TS_TSC {
DISABLE(TS_CONFIG_DEDUCE_OUT)
ENABLE(TS_CONFIG_USE_OUTDIR)
- _TS_CONFIGURE($TS_CONFIG_PATH)
+ _TS_CONFIGURE()
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
_TS_ADD_NODE_MODULES_FOR_BUILDER()
diff --git a/build/conf/ts/ts_vite.conf b/build/conf/ts/ts_vite.conf
index d34520e97c..10a1a21602 100644
--- a/build/conf/ts/ts_vite.conf
+++ b/build/conf/ts/ts_vite.conf
@@ -1,6 +1,33 @@
-VITE_OUTPUT_DIR=dist
VITE_CONFIG_PATH=vite.config.ts
+### @usage: TS_VITE_CONFIG(ConfigPath)
+###
+### Macro sets the config path for TS_VITE module.
+###
+### - ConfigPath - config path
+macro TS_VITE_CONFIG(ConfigPath) {
+ SET(VITE_CONFIG_PATH $ConfigPath)
+}
+
+
+VITE_OUTPUT_DIR=dist
+
+### @usage: TS_VITE_OUTPUT(DirName)
+###
+### Macro sets the output directory name for TS_VITE module.
+###
+### - DirName - output directory name
+macro TS_VITE_OUTPUT(DirName) {
+ SET(VITE_OUTPUT_DIR $DirName)
+}
+
+# tag:deprecated
+macro VITE_OUTPUT(DirName) {
+ MESSAGE(WARNING "VITE_OUTPUT is deprecated, use TS_VITE_OUTPUT instead")
+ SET(VITE_OUTPUT_DIR $DirName)
+}
+
+
TS_VITE_CMD=$TOUCH_UNIT \
&& $_TS_FILES_COPY_CMD \
&& $ADD_VCS_INFO_FILE_CMD \
@@ -12,15 +39,6 @@ TS_VITE_CMD=$TOUCH_UNIT \
${output;hide:"package.json"} \
${kv;hide:"pc magenta"} ${kv;hide:"p TS_VIT"}
-### @usage: VITE_OUTPUT(DirName)
-###
-### Macro sets the output directory name for TS_VITE module.
-###
-### - DirName - output directory name ("dist" by default).
-macro VITE_OUTPUT(DirName) {
- SET(VITE_OUTPUT_DIR $DirName)
-}
-
### @usage: TS_VITE([name])
###
### The Vite bundle, bundles JavaScript code.
@@ -46,7 +64,7 @@ multimodule TS_VITE {
DISABLE(TS_CONFIG_DEDUCE_OUT)
DISABLE(TS_CONFIG_USE_OUTDIR)
- _TS_CONFIGURE($TS_CONFIG_PATH)
+ _TS_CONFIGURE()
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
_TS_ADD_NODE_MODULES_FOR_BUILDER()
diff --git a/build/conf/ts/ts_webpack.conf b/build/conf/ts/ts_webpack.conf
index 36638af41d..38a74600b0 100644
--- a/build/conf/ts/ts_webpack.conf
+++ b/build/conf/ts/ts_webpack.conf
@@ -1,6 +1,31 @@
-WEBPACK_OUTPUT_DIR=bundle
WEBPACK_CONFIG_PATH=webpack.config.js
+### @usage: TS_WEBPACK_CONFIG(ConfigPath)
+###
+### Macro sets the config path for TS_WEBPACK module.
+###
+### - ConfigPath - config path
+macro TS_WEBPACK_CONFIG(ConfigPath) {
+ SET(WEBPACK_CONFIG_PATH $ConfigPath)
+}
+
+WEBPACK_OUTPUT_DIR=bundle
+
+### @usage: TS_WEBPACK_OUTPUT(FirstDirName DirNames)
+###
+### Macro sets the output directory names (one at least) for TS_WEBPACK module.
+###
+### - DirNames - output directory names (one at least)
+macro TS_WEBPACK_OUTPUT(FirstDirName, DirNames...) {
+ SET(WEBPACK_OUTPUT_DIR $FirstDirName $DirNames)
+}
+
+# tag:deprecated
+macro WEBPACK_OUTPUT(FirstDirName, DirNames...) {
+ MESSAGE(WARNING "WEBPACK_OUTPUT is deprecated, use TS_WEBPACK_OUTPUT instead")
+ SET(WEBPACK_OUTPUT_DIR $FirstDirName $DirNames)
+}
+
TS_WEBPACK_CMD=$TOUCH_UNIT \
&& $_TS_FILES_COPY_CMD \
&& $ADD_VCS_INFO_FILE_CMD \
@@ -12,15 +37,6 @@ TS_WEBPACK_CMD=$TOUCH_UNIT \
${output;hide:"package.json"} \
${kv;hide:"pc magenta"} ${kv;hide:"p TS_WPK"}
-### @usage: WEBPACK_OUTPUT(FirstDirName DirNames)
-###
-### Macro sets the output directory names (one at least) for TS_WEBPACK module.
-###
-### - DirNames - output directory names (one at least) ("bundle" by default).
-macro WEBPACK_OUTPUT(FirstDirName, DirNames...) {
- SET(WEBPACK_OUTPUT_DIR $FirstDirName $DirNames)
-}
-
### @usage: TS_WEBPACK([name])
###
### The Webpack bundle, bundles JavaScript code.
@@ -46,7 +62,7 @@ multimodule TS_WEBPACK {
DISABLE(TS_CONFIG_DEDUCE_OUT)
DISABLE(TS_CONFIG_USE_OUTDIR)
- _TS_CONFIGURE($TS_CONFIG_PATH)
+ _TS_CONFIGURE()
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
_TS_ADD_NODE_MODULES_FOR_BUILDER()
diff --git a/build/plugins/nots.py b/build/plugins/nots.py
index f40e2b4155..9b0f854e17 100644
--- a/build/plugins/nots.py
+++ b/build/plugins/nots.py
@@ -203,12 +203,13 @@ def on_peerdir_ts_resource(unit, *resources):
@_with_report_configure_error
-def on_ts_configure(unit, *tsconfig_paths):
+def on_ts_configure(unit):
# type: (Unit, *str) -> None
from lib.nots.package_manager.base import PackageJson
from lib.nots.package_manager.base.utils import build_pj_path
from lib.nots.typescript import TsConfig
+ tsconfig_paths = unit.get("TS_CONFIG_PATH").split()
# for use in CMD as inputs
__set_append(
unit, "TS_CONFIG_FILES", _build_cmd_input_paths(tsconfig_paths, hide=True, disable_include_processor=True)