2016-06-22 3 views
4

이 튜토리얼 link을 따라 grafana 플러그인을 만듭니다. 하지만합니다 (DIST 폴더없이) 내 테스트 서버에 튜토리얼이 코드 link를 복사 npm install NPM 나던 새로운 DIST 폴더를 만들고 실행할 때 대신은 node_modules 폴더를 만듭니다.npm install dist 폴더를 만들지 않습니다

여기에 단계가 없거나 잘못 이해하고 있습니까? 나는 dist 폴더를 폴더에있는 파일에서 생성하라는 명령을 받았기 때문에?

꿀꿀 거리는 소리 파일 :

module.exports = (grunt) => { 
    require('load-grunt-tasks')(grunt); 

    grunt.loadNpmTasks('grunt-execute'); 
    grunt.loadNpmTasks('grunt-contrib-clean'); 

    grunt.initConfig({ 

    clean: ['dist'], 

    copy: { 
     src_to_dist: { 
     cwd: 'src', 
     expand: true, 
     src: ['**/*', '!**/*.js', '!**/*.scss'], 
     dest: 'dist' 
     }, 
     pluginDef: { 
     expand: true, 
     src: [ 'plugin.json', 'README.md' ], 
     dest: 'dist', 
     } 
    }, 

    watch: { 
     rebuild_all: { 
     files: ['src/**/*', 'plugin.json'], 
     tasks: ['default'], 
     options: {spawn: false} 
     }, 
    }, 

    babel: { 
     options: { 
     sourceMap: true, 
     presets: ['es2015'], 
     plugins: ['transform-es2015-modules-systemjs', 'transform-es2015-for-of'], 
     }, 
     dist: { 
     files: [{ 
      cwd: 'src', 
      expand: true, 
      src: ['*.js'], 
      dest: 'dist', 
      ext: '.js' 
     }] 
     }, 
    }, 

    }); 

    grunt.registerTask('default', ['clean', 'copy:src_to_dist', 'copy:pluginDef', 'babel']); 
}; 

package.json :

{ 
    "name": "clock-panel", 
    "version": "1.0.0", 
    "description": "Clock Panel Plugin for Grafana", 
    "main": "src/module.js", 
    "scripts": { 
    "lint": "eslint --color .", 
    "test": "echo \"Error: no test specified\" && exit 1" 
    }, 
    "keywords": [ 
    "clock", 
    "grafana", 
    "plugin", 
    "panel" 
    ], 
    "author": "Raintank", 
    "license": "MIT", 
    "devDependencies": { 
    "babel": "~6.5.1", 
    "babel-eslint": "^6.0.0", 
    "babel-plugin-transform-es2015-modules-systemjs": "^6.5.0", 
    "babel-preset-es2015": "^6.5.0", 
    "eslint": "^2.5.1", 
    "eslint-config-airbnb": "^6.2.0", 
    "eslint-plugin-import": "^1.4.0", 
    "grunt": "~0.4.5", 
    "grunt-babel": "~6.0.0", 
    "grunt-contrib-clean": "~0.6.0", 
    "grunt-contrib-copy": "~0.8.2", 
    "grunt-contrib-uglify": "~0.11.0", 
    "grunt-contrib-watch": "^0.6.1", 
    "grunt-execute": "~0.2.2", 
    "grunt-systemjs-builder": "^0.2.5", 
    "load-grunt-tasks": "~3.2.0" 
    }, 
    "dependencies": { 
    "lodash": "~4.0.0", 
    "moment": "^2.12.0" 
    } 
} 

답변

5

당신은 grunt 기본 작업을 실행 누락

당신은 실행해야합니다 : 당신이 Gruntfile에서 볼 수있는 바와 같이 grunt (사본 SRC 파일 다음

npm install

이 (의존성을 설치하는), DIST 할 수 있습니다. js copy:src_to_dist 작업)

짧게 실행하면 $ npm install && grunt

2

NPM은 명령은 프로젝트 종속성으로 사용하게 될 패키지를 설치하여 설치합니다. 현재 디렉토리에 node_modules 디렉토리를 만들고 (아직없는 경우) 디렉토리에 패키지를 다운로드합니다.