在linux上使用软件包减少grunt的大小.文件路径对Jenkins来说太长

Reduce size of grunt with packages on linux. File paths too long for Jenkins

本文关键字:路径 文件 Jenkins linux 软件包 grunt      更新时间:2023-09-26

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

  1. Grunt contrib茉莉花用于命令行茉莉花单元测试

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

  1. Grunt模板jasmine Istanbul用于代码覆盖

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

我发现我的整个文件夹非常大,我想知道是否有办法把它缩小。我在我的顶级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构建。

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

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