如何创建 tar-ed npm 模块

How to create tar-ed npm modules

我正在使用 https://github.com/allegro/grunt-maven-plugin 构建我的 Java + Angular JS 应用程序,我不想每次构建它时都下载节点模块。

根据 https://github.com/allegro/grunt-maven-plugin 上的说明,它说在每次构建期间使用 tar-ed node_modules 而不是 运行 npm install。

现在如何创建 tar-ed node_modules?我猜,它是某种压缩目录但不完全确定。是否可以通过 winzip、7zip 等工具?或者我是否需要再使用一个节点模块来实现这一目标?

正在阅读 https://github.com/allegro/grunt-maven-plugin 我知道您不需要 tar 您的模块。

重要的一点是,如果存在一个名为 "target-grunt" 的文件夹,其中包含一个名为 "node_modules" 的文件夹,则使用离线工作流程。

所以您可以尝试将实际的 node_modules 文件夹复制到名为 "target-grunt" 的新文件夹。

看来我没有深入了解 7zip 的细节。使用 7zip,我们可以创建 tar 个文件夹文件。

更新: 但是输出 tar 文件已损坏,现在正在检查它损坏 tar 文件的原因。

Update 运行 7zip 以管理员身份打开 tar 文件正常。我觉得我现在很好。

如果您使用的是 Unix,则使用 tar 创建包含所有文件的单个存档。请参阅:https://github.com/allegro/grunt-maven-plugin/issues/90