小编Sen*_*hil的帖子

如何检索在打字稿中构建[自定义构建系统]期间传递的命令行参数

我知道如何使用以下方式在 JS 中检索命令行参数,

`Config.getTestArgs = () => {
    try {
        return global.commandLineArgs.args["test-args"];
    }
    catch (e) {
        logger.error(`Error reading test - args from command line: ${ e } `);
        return null;
    }
};`
Run Code Online (Sandbox Code Playgroud)

当我在 Typescript 中使用相同的方式时,出现错误Cannot find module- global

如果我通过我的输入

`--build --test-args TestArument1`
Run Code Online (Sandbox Code Playgroud)

getTestArgs应返回 TestArgument1 作为输出。

考虑一下我们有自己的构建系统,它使用 NodeJs 和 Typescript。我应该考虑哪些 NodeJS 依赖项?

node.js typescript typescript-typings

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

node.js ×1

typescript ×1

typescript-typings ×1