Typescript 如何计算.ts文件中的行总数

Typescript 如何计算.ts文件中的行总数,typescript,angular6,Typescript,Angular6,我有一个应用程序文件夹,下面有很多模块和组件。我只需要计算.ts文件的代码行数。那么有没有VS代码的插件或者其他方法请推荐?您可以使用命令行工具CLOC(计算代码行数) 安装: npm安装-g cloc 用法: cloc my/app/folder——include lang=TypeScript 您将得到如下输出: 88 text files. 88 unique files. 32 files ignored. github.com/AlDanial

我有一个应用程序文件夹,下面有很多模块和组件。我只需要计算.ts文件的代码行数。那么有没有VS代码的插件或者其他方法请推荐?

您可以使用命令行工具CLOC(计算代码行数)

安装:

npm安装-g cloc
用法:

cloc my/app/folder——include lang=TypeScript
您将得到如下输出:

      88 text files.
      88 unique files.
      32 files ignored.

github.com/AlDanial/cloc v 1.82  T=0.12 s (516.3 files/s, 19421.4 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
TypeScript                      60            276            101           1880
-------------------------------------------------------------------------------
SUM:                            60            276            101           1880
-------------------------------------------------------------------------------

在Unix上,您可以使用
wc
计算文档行数

wc-l**/*.ts

您可以尝试安装此软件包:

要安装:

npm i -g sloc

否则,如果您使用的是vscode,则可以安装行计数器插件

在cmd(
cloc my/app/folder--include lang=TypeScript
)中尝试您的命令,但其显示的“perl”无法识别为内部或外部命令、可操作程序或批处理文件。您使用的是Windows吗?有关更多信息,请参阅as