node.js - 如何创建 tar 压缩的 npm 模块

标签 node.js gruntjs npm tar

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

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

现在如何创建压缩后的node_modules?我猜测,它是某种压缩目录的方式,但不确定。可以通过 winzip、7zip 等工具吗?或者我是否需要再使用一个 Node 模块来实现这一目标?

最佳答案

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

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

因此,您可以尝试将实际的 node_modules 文件夹复制到名为“target-grunt”的新文件夹。

关于node.js - 如何创建 tar 压缩的 npm 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32963392/

相关文章:

javascript - Node.js module.exports 回调函数?

node.js - 如何将mean.js部署到生产环境?

macos - "npm install -g <package>"安装包在哪里?

node.js - 无法安装 react 导航和手势

javascript - 如何告诉 npm 在安装时使用父项目的依赖项构建模块?

javascript - 向 Nickjs tab.open() 函数添加 header 选项

node.js - 使用 ava 和 proxyquire 用 sinon 加载模块后无法 stub 方法

gruntjs - 发电机角度 : task "karma" not found when calling `grunt test`

javascript - Mongoose 中的 runCommand 相当于什么?

javascript - 使用 Yeoman 的生成器 webapp 配置 grunt-uncss