aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/ts/ts_package.conf
blob: 3e94a73d50d6dca5e7d1a2945cae6ba13b5a388f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
    }
}