【问题标题】:Reduce size of grunt with packages on linux. File paths too long for Jenkins使用 linux 上的软件包减少 grunt 的大小。詹金斯的文件路径太长
【发布时间】:2015-05-28 08:29:35
【问题描述】:

我最近在我的 linux 机器上下载了带有 2 个软件包的 grunt。

  1. 用于命令行 jasmine 单元测试的 Grunt-contrib-jasmine。

我遵循的指南:https://github.com/gruntjs/grunt-contrib-jasmine

  1. Grunt-template-jasmine-Istanbul 用于代码覆盖率。

我遵循的指南:https://github.com/maenu/grunt-template-jasmine-istanbul

我发现我的整个 grunt 文件夹非常大,我想知道是否有任何方法可以缩小它。我的顶级 node_modules 文件夹中有包:grunt、grunt-contrib-jasmine 和 grunt-template-jasmine-Istanbul。我试过删除我认为多余的文件,但似乎大多数库即使重复也是需要的。

我将发布我的 GruntFile 封装它会有任何帮助:

module.exports = function(grunt) {
  grunt.initConfig({
      jasmine: {
      coverage: {
          src: 'src/*.js',
          options: {
          specs: 'spec/*Spec.js',
          helpers: 'spec/*Helper.js',
          vendor: ['lib/jquery.js', 'lib/angular.js', 'lib/angular-touch.js', 'lib/angular-route.js', 'lib/angular-cookies.js', 
               'lib/ui-bootstrap.js', 'lib/jasmine-jquery.js', 'lib/angular-mocks.js'],

          template: require('grunt-template-jasmine-istanbul'),
          templateOptions: {
              coverage: 'coverage/coverage.json',
              report: {
              type: 'cobertura',
              options: {
                  dir: 'coverage/cobertura'
              }
              },
              thresholds: {
              lines: 50,
              statements: 50,
              branches: 50,
              functions: 50
              }
          }
          }
      }
      }
  });

  // Register tasks.
  grunt.loadNpmTasks('grunt-contrib-jasmine');

  // Default task.
  grunt.registerTask('default', 'jasmine');
};

感谢任何帮助。

编辑:文件路径太长,因为重复 node_modules 不允许 jenkins 构建。

【问题讨论】:

  • 这个问题背后的基本原理是什么?您想节省 10Mb 的空间吗? /me 去查看日历上的年份和消费级驱动器的 Gb 价格。
  • 如果可以,为什么不缩小尺寸呢?我只是看到使用了相同的 node_modules,所以认为存在冗余。不过我会同意你的看法,不会强调这么小的空间。
  • 我现在取消删除帖子,因为我遇到了问题。文件路径太大,无法在 jenkins 中构建(大约 255 个窗口字符限制)。
  • 所以相应地编辑整个问题,使其与大小无关。

标签: javascript linux gruntjs jasmine grunt-contrib-jasmine


【解决方案1】:

我解决这个问题的方法是在安装包时使用 npmd 的 --greedy 标志而不是 npm。

Npmd:https://github.com/dominictarr/npmd

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    • 2020-01-19
    • 1970-01-01
    • 2017-12-08
    • 1970-01-01
    相关资源
    最近更新 更多