aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/ts/ts_library.conf
blob: 6cc4442885f124c4a70a5944d9a1db6c599d7531 (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
45
# TYPESCRIPT_ROOT is redefined in /build/plugins/nots.py _set_resource_vars()
TYPESCRIPT_ROOT=
TS_CONFIG_PATH=tsconfig.json
TS_COMPILE=$TOUCH_UNIT \
    && ${cwd:BINDIR} $NOTS_TOOL compile-ts $NOTS_TOOL_BASE_ARGS --tsc-resource $TYPESCRIPT_ROOT \
    --moddir $MODDIR --ts-config ${input:TS_CONFIG_PATH} --node-modules-bundle $NOTS_TOOL_NODE_MODULES_BUNDLE \
    $NODE_MODULES_BUNDLE_AS_OUTPUT ${hide:PEERS} ${input;hide:"./package.json"} ${TS_CONFIG_FILES} \
    ${output;hide:"package.json"} ${output;hide:TS_COMPILE_OUTPUT} ${kv;hide:"p TSC"} ${kv;hide:"pc magenta"}

### @usage: TS_LIBRARY([name])
###
### The TypeScript/JavaScript library module, compiles TypeScript sources to JavaScript.
### Build results are JavaScript files, typings and source mappings (depending on local tsconfig.json settings).
###
### @example
###
###     TS_LIBRARY()
###         SRCS(src/index.ts)
###     END()
###
multimodule TS_LIBRARY {
    module BUILD: _TS_BASE_UNIT {
        .CMD=TS_COMPILE
        .PEERDIRSELF=NODE_MODULES
        # epilogue is not inherited from TS_LIBRARY
        .EPILOGUE=_TS_CONFIG_EPILOGUE

        # 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)

        SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/${TS_CONFIG_PATH} ${CURDIR}/package.json)

        SET(TS_CONFIG_DEDUCE_OUT yes)

        # we should set NODE_MODULES_BUNDLE_AS_OUTPUT conditionally,
        # based on whether module has deps or doesn't have
        _SET_NODE_MODULES_BUNDLE_AS_OUTPUT()

        _TS_CONFIGURE($TS_CONFIG_PATH)
    }

    module NODE_MODULES: _NODE_MODULES_BASE {
    }
}