Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.DS_Store
Gruntfile.js
node_modules
bower_components
4 changes: 3 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@
// Enviroments
"browser": true, // globals exposed by modern browsers, like document, window, etc.
"devel": true, // globals that are usually used for logging poor-man's debugging: console, alert, etc.
"jquery": true // jquery library
"jquery": true, // jquery library

"node": true
}
11 changes: 10 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@ language: node_js
node_js:
- "0.12"
- "iojs"
- "iojs-v1.0.4"
- "iojs-v1.0.4"
cache:
directories:
- node_modules
- bower_components
install:
- npm install
- bower install
script:
- grunt
59 changes: 0 additions & 59 deletions Gruntfile.coffee

This file was deleted.

85 changes: 85 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
module.exports = function( grunt ) {

"use strict";

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
dist: {
src: [ "dist/qiniu.js" ],
options: {
jshintrc: ".jshintrc"
}
},
grunt: {
src: [ "Gruntfile.js" ],
options: {
jshintrc: ".jshintrc"
}
},
},
build: {
all: {
dest: "dist/qiniu.js",
src: ["src/qiniu.js"]
}
},
uglify: {
all: {
files: {
"dist/qiniu.min.js": [ "dist/qiniu.js" ]
},
options: {
banner: "/*! <%= pkg.name %> v<%= pkg.version %> | Copyright 2015 by Qiniu */",
sourceMap: "dist/qiniu.min.map",
compress: {
hoist_funs: false,
join_vars: false,
loops: false,
unused: false
},
beautify: {
ascii_only: true
}
}
}
}
});

grunt.registerMultiTask(
"build",
"Embed date/version",
function() {

var source = grunt.file.read( "src/qiniu.js" ),
version = grunt.config( "pkg.version" );

// Embed Version
// Embed Date
source = source.replace( /@VERSION/g, version )
.replace( "@DATE", function () {
var date = new Date();

// YYYY-MM-DD
return [
date.getFullYear(),
date.getMonth() + 1,
date.getDate()
].join( "-" );
});

// Write concatenated source to file
grunt.file.write( "dist/qiniu.js", source );

// Otherwise, print a success message.
grunt.log.writeln( "File 'dist/qiniu.js' created." );
});

grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-concat");

grunt.registerTask( "default", [ "build", "jshint", "uglify" ] );
};
25 changes: 25 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "qiniu-js-sdk",
"description": "基于七牛API及Plupload开发的前端JavaScript SDK",
"main": "dist/qiniu.js",
"license": "GPL V2",
"homepage": "https://github.com/qiniu/js-sdk",
"moduleType": [],
"private": false,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"plupload": "~2.1.8"
},
"devDependencies": {
"bootstrap": "~3.3.6",
"highlight": "~8.9.1",
"jquery": "~1.9.1",
"respond": "~1.4.2"
}
}
Loading