aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/ts/ts_package.conf
blob: b93ac6216af1c42b803201e818433a79869dc6ee (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
46
47
TS_PACK=$TOUCH_UNIT \
    && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-package $_NODE_MODULES_INOUTS \
    && $COPY_CMD ${input:"package.json"} ${output:"package.json"} \
    && $_TS_FILES_COPY_CMD \
    ${kv;hide:"p TS_PKG"} ${kv;hide:"pc magenta"}

macro _TS_PACKAGE_EPILOGUE() {
  _TS_PACKAGE_CHECK_FILES()
}

### @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
        .EPILOGUE=_TS_PACKAGE_EPILOGUE
        .ALLOWED=TS_FILES
        .ALIASES=FILES=TS_FILES SRCS=TS_FILES
        .PEERDIRSELF=TS_PREPARE_DEPS

        # 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(MODULE_LANG TS)

        SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml)
        _TS_ADD_NODE_MODULES_FOR_BUILDER()
    }

    module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE {

    }
}