aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf
diff options
context:
space:
mode:
authorzaverden <zaverden@yandex-team.com>2023-09-07 11:21:16 +0300
committerzaverden <zaverden@yandex-team.com>2023-09-07 12:03:28 +0300
commit447ddf2e497321c9b1236eb5fc733a2d0955d49e (patch)
treee3b66635caf03b3ac6a7a0459ee3e4362cd6686e /build/conf
parent7007b60c42dfde3bb60eeef4f3114e8a91e9b711 (diff)
downloadydb-447ddf2e497321c9b1236eb5fc733a2d0955d49e.tar.gz
feat(TS_PACKAGE): implement modules
Diffstat (limited to 'build/conf')
-rw-r--r--build/conf/ts/ts.conf1
-rw-r--r--build/conf/ts/ts_package.conf44
2 files changed, 45 insertions, 0 deletions
diff --git a/build/conf/ts/ts.conf b/build/conf/ts/ts.conf
index 71d3286fe8..2812035788 100644
--- a/build/conf/ts/ts.conf
+++ b/build/conf/ts/ts.conf
@@ -57,5 +57,6 @@ macro TS_FILES(Files...) {
@import "${CONF_ROOT}/conf/ts/ts_bundle.conf"
@import "${CONF_ROOT}/conf/ts/ts_library.conf"
@import "${CONF_ROOT}/conf/ts/ts_next.conf"
+@import "${CONF_ROOT}/conf/ts/ts_package.conf"
@import "${CONF_ROOT}/conf/ts/ts_test.conf"
@import "${CONF_ROOT}/conf/ts/ts_vite_bundle.conf"
diff --git a/build/conf/ts/ts_package.conf b/build/conf/ts/ts_package.conf
new file mode 100644
index 0000000000..3e94a73d50
--- /dev/null
+++ b/build/conf/ts/ts_package.conf
@@ -0,0 +1,44 @@
+_COPY_NODE_MODULES_BUNDLE_CMD=
+
+TS_PACK=$TOUCH_UNIT \
+ && $_COPY_NODE_MODULES_BUNDLE_CMD \
+ && $COPY_CMD ${input:"package.json"} ${output:"package.json"} \
+ && $_TS_FILES_COPY_CMD \
+ ${kv;hide:"p TSP"} ${kv;hide:"pc magenta"}
+
+### @usage: TS_PACKAGE()
+###
+### The TypeScript/JavaScript library module, that does not need any compilation,
+### and is just a set of files and NPM dependencies. List required files in TS_FILES macro.
+### `package.json` is included by default.
+###
+### @example
+###
+### TS_PACKAGE()
+### TS_FILES(
+### eslint.config.json
+### prettierrc.json
+### )
+### END()
+###
+multimodule TS_PACKAGE {
+ module BUILD: _TS_BASE_UNIT {
+ .CMD=TS_PACK
+ .PEERDIRSELF=NODE_MODULES
+ .ALLOWED=TS_FILES
+ .ALIASES=FILES=TS_FILES SRCS=TS_FILES
+
+ # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
+ # but we have to set it to TS for include processor to work
+ SET(MODULE_TAG TS)
+
+ # we should set _COPY_NODE_MODULES_BUNDLE_CMD conditionally,
+ # based on whether module has deps or doesn't have
+ _SET_COPY_NODE_MODULES_BUNDLE_CMD()
+ }
+
+ module NODE_MODULES: _NODE_MODULES_BASE {
+ .ALLOWED=TS_FILES
+ .ALIASES=FILES=TS_FILES SRCS=TS_FILES
+ }
+}