Skip to content

Commit f859853

Browse files
committed
init the grunt build enviroment.
use es6 to write modules.
1 parent 157b03a commit f859853

8 files changed

+100
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules

Gruntfile.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
module.exports = function(grunt) {
2+
require('load-grunt-tasks')(grunt);
3+
4+
grunt.initConfig({
5+
pkg: grunt.file.readJSON('package.json'),
6+
7+
jshint: {
8+
options: {
9+
esnext: true
10+
},
11+
all: ['Gruntfile.js', 'src/**/*.js']
12+
},
13+
14+
babel: {
15+
options: {
16+
sourceMap: true
17+
},
18+
dist: {
19+
files: {
20+
'dist/qiniu-uploader.js': 'src/qiniu-uploader.js'
21+
}
22+
}
23+
},
24+
25+
uglify: {
26+
options: {
27+
sourceMap: true,
28+
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
29+
},
30+
build: {
31+
src: 'dist/qiniu-uploader.js',
32+
dest: 'dist/qiniu-uploader.min.js'
33+
}
34+
},
35+
36+
watch: {
37+
scripts: {
38+
files: ['Gruntfile.js', 'src/**/*.js'],
39+
tasks: ['build'],
40+
options: {
41+
debounceDelay: 250,
42+
},
43+
},
44+
},
45+
});
46+
47+
grunt.registerTask('build', ['jshint', 'babel', 'uglify']);
48+
grunt.registerTask('default', ['build']);
49+
50+
grunt.loadNpmTasks('grunt-contrib-watch');
51+
};

dist/qiniu-uploader.js

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/qiniu-uploader.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/qiniu-uploader.min.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/qiniu-uploader.min.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "ff-qiniu-uploader",
3+
"version": "1.0.0",
4+
"description": "七牛直传组件",
5+
"main": "dist/ff-qiniu-uploader",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/FellowPlusDev/FFQiniuUploader.git"
12+
},
13+
"author": "",
14+
"license": "MIT",
15+
"bugs": {
16+
"url": "https://github.com/FellowPlusDev/FFQiniuUploader/issues"
17+
},
18+
"homepage": "https://github.com/FellowPlusDev/FFQiniuUploader#readme",
19+
"devDependencies": {
20+
"grunt": "^0.4.5",
21+
"grunt-babel": "^5.0.3",
22+
"grunt-contrib-jshint": "^0.11.3",
23+
"grunt-contrib-uglify": "^0.9.2",
24+
"grunt-contrib-watch": "^0.6.1",
25+
"load-grunt-tasks": "^3.3.0"
26+
}
27+
}

src/qiniu-uploader.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class QiniuUploader {
2+
constructor() {
3+
console.log('hello there.');
4+
}
5+
}

0 commit comments

Comments
 (0)