Clean up gruntfile and package.json, use grunt for yuidocs
This commit is contained in:
parent
41e8a6eafa
commit
066228cc33
3 changed files with 156 additions and 127 deletions
237
Gruntfile.js
237
Gruntfile.js
|
@ -1,79 +1,113 @@
|
||||||
module.exports = function(grunt){
|
module.exports = function(grunt) {
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-qunit');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-yuidoc');
|
||||||
|
|
||||||
"use strict";
|
var root = 'src/pixi/',
|
||||||
|
debug = 'bin/pixi.dev.js',
|
||||||
|
srcFiles = [
|
||||||
|
'<%= dirs.src %>/Pixi.js',
|
||||||
|
'<%= dirs.src %>/Point.js',
|
||||||
|
'<%= dirs.src %>/Rectangle.js',
|
||||||
|
'<%= dirs.src %>/DisplayObject.js',
|
||||||
|
'<%= dirs.src %>/DisplayObjectContainer.js',
|
||||||
|
'<%= dirs.src %>/Sprite.js',
|
||||||
|
'<%= dirs.src %>/MovieClip.js',
|
||||||
|
'<%= dirs.src %>/InteractionManager.js',
|
||||||
|
'<%= dirs.src %>/Stage.js',
|
||||||
|
'<%= dirs.src %>/utils/Utils.js',
|
||||||
|
'<%= dirs.src %>/utils/EventTarget.js',
|
||||||
|
'<%= dirs.src %>/utils/Matrix.js',
|
||||||
|
'<%= dirs.src %>/utils/Detector.js',
|
||||||
|
'<%= dirs.src %>/renderers/WebGLShaders.js',
|
||||||
|
'<%= dirs.src %>/renderers/WebGLRenderer.js',
|
||||||
|
'<%= dirs.src %>/renderers/WebGLBatch.js',
|
||||||
|
'<%= dirs.src %>/renderers/CanvasRenderer.js',
|
||||||
|
'<%= dirs.src %>/extras/Strip.js',
|
||||||
|
'<%= dirs.src %>/extras/Rope.js',
|
||||||
|
'<%= dirs.src %>/textures/BaseTexture.js',
|
||||||
|
'<%= dirs.src %>/textures/Texture.js',
|
||||||
|
'<%= dirs.src %>/loaders/SpriteSheetLoader.js',
|
||||||
|
'<%= dirs.src %>/loaders/AssetLoader.js'
|
||||||
|
], banner = [
|
||||||
|
'/**',
|
||||||
|
' * @license',
|
||||||
|
' * <%= pkg.name %> - v<%= pkg.version %>',
|
||||||
|
' * Copyright (c) 2012, Mat Groves',
|
||||||
|
' * <%= pkg.homepage %>',
|
||||||
|
' *',
|
||||||
|
' * Compiled: <%= grunt.template.today("yyyy-mm-dd") %>',
|
||||||
|
' *',
|
||||||
|
' * <%= pkg.name %> is licensed under the <%= pkg.license %> License.',
|
||||||
|
' * <%= pkg.licenseUrl %>',
|
||||||
|
' */',
|
||||||
|
''
|
||||||
|
].join('\n');
|
||||||
|
|
||||||
var root = "src/pixi/",
|
grunt.initConfig({
|
||||||
debug = "bin/pixi.dev.js",
|
pkg : grunt.file.readJSON('package.json'),
|
||||||
build = "bin/pixi.js";
|
dirs: {
|
||||||
|
build: 'bin',
|
||||||
grunt.initConfig({
|
docs: 'docs',
|
||||||
pkg : grunt.file.readJSON("package.json"),
|
examples: 'examples',
|
||||||
build : {
|
src: 'src/pixi',
|
||||||
all : {
|
test: 'test'
|
||||||
dest : debug,
|
},
|
||||||
src : [
|
files: {
|
||||||
"Pixi.js",
|
srcBlob: '<%= dirs.src %>/**/*.js',
|
||||||
"Point.js",
|
testBlob: '<%= dirs.test %>/unit/**/*.js',
|
||||||
"Rectangle.js",
|
build: '<%= dirs.build %>/pixi.dev.js',
|
||||||
"DisplayObject.js",
|
buildMin: '<%= dirs.build %>/pixi.js'
|
||||||
"DisplayObjectContainer.js",
|
},
|
||||||
"Sprite.js",
|
concat: {
|
||||||
"MovieClip.js",
|
options: {
|
||||||
"InteractionManager.js",
|
banner: banner
|
||||||
"Stage.js",
|
},
|
||||||
"utils/Utils.js",
|
dist: {
|
||||||
"utils/EventTarget.js",
|
src: srcFiles,
|
||||||
"utils/Matrix.js",
|
dest: '<%= files.build %>'
|
||||||
"utils/Detector.js",
|
}
|
||||||
"renderers/WebGLShaders.js",
|
},
|
||||||
"renderers/WebGLRenderer.js",
|
jshint: {
|
||||||
"renderers/WebGLBatch.js",
|
beforeconcat: srcFiles,
|
||||||
"renderers/CanvasRenderer.js",
|
test: ['<%= files.testBlob %>'],
|
||||||
"extras/Strip.js",
|
options: {
|
||||||
"extras/Rope.js",
|
asi: true,
|
||||||
"textures/BaseTexture.js",
|
smarttabs: true
|
||||||
"textures/Texture.js",
|
}
|
||||||
"loaders/SpriteSheetLoader.js",
|
},
|
||||||
"loaders/AssetLoader.js"
|
uglify: {
|
||||||
]
|
options: {
|
||||||
}
|
banner: banner
|
||||||
},
|
},
|
||||||
jshint : {
|
dist: {
|
||||||
dist : {
|
src: '<%= files.build %>',
|
||||||
src : [debug],
|
dest: '<%= files.buildMin %>'
|
||||||
options : {
|
}
|
||||||
asi : true,
|
},
|
||||||
smarttabs: true
|
distribute: {
|
||||||
}
|
examples: [
|
||||||
}
|
'examples/example 1 - Basics',
|
||||||
},
|
'examples/example 2 - SpriteSheet',
|
||||||
uglify : {
|
'examples/example 3 - MovieClip',
|
||||||
all : {
|
'examples/example 4 - Balls',
|
||||||
files : {
|
'examples/example 5 - Morph',
|
||||||
"bin/pixi.js" : [ debug ]
|
'examples/example 6 - Interactivity',
|
||||||
}
|
]
|
||||||
}
|
},
|
||||||
},
|
|
||||||
distribute : {
|
|
||||||
examples : [
|
|
||||||
"examples/example 1 - Basics",
|
|
||||||
"examples/example 2 - SpriteSheet",
|
|
||||||
"examples/example 3 - MovieClip",
|
|
||||||
"examples/example 4 - Balls",
|
|
||||||
"examples/example 5 - Morph",
|
|
||||||
"examples/example 6 - Interactivity",
|
|
||||||
]
|
|
||||||
},
|
|
||||||
connect: {
|
connect: {
|
||||||
qunit: {
|
qunit: {
|
||||||
options: {
|
options: {
|
||||||
port: grunt.option('port-test') | 9002,
|
port: grunt.option('port-test') || 9002,
|
||||||
base: './'
|
base: './'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
options: {
|
options: {
|
||||||
port: grunt.option('port-test') | 9002,
|
port: grunt.option('port-test') || 9002,
|
||||||
base: './',
|
base: './',
|
||||||
keepalive: true
|
keepalive: true
|
||||||
}
|
}
|
||||||
|
@ -85,56 +119,43 @@ module.exports = function(grunt){
|
||||||
urls: ['http://localhost:' + (grunt.option('port-test') || 9002) + '/test/index.html']
|
urls: ['http://localhost:' + (grunt.option('port-test') || 9002) + '/test/index.html']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
yuidoc: {
|
||||||
|
compile: {
|
||||||
|
name: '<%= pkg.name %>',
|
||||||
|
description: '<%= pkg.description %>',
|
||||||
|
version: '<%= pkg.version %>',
|
||||||
|
url: '<%= pkg.homepage %>',
|
||||||
|
logo: '<%= pkg.logo %>',
|
||||||
|
options: {
|
||||||
|
paths: '<%= dirs.src %>',
|
||||||
|
outdir: '<%= dirs.docs %>'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
grunt.registerMultiTask(
|
||||||
|
'distribute',
|
||||||
|
'Copy built file to examples',
|
||||||
|
function(){
|
||||||
|
var pixi = grunt.file.read( debug );
|
||||||
|
|
||||||
grunt.registerMultiTask(
|
var dests = this.data;
|
||||||
"build",
|
|
||||||
"Contatenate source",
|
|
||||||
function(){
|
|
||||||
var compiled = "",
|
|
||||||
name = this.data.dest,
|
|
||||||
src = this.data.src;
|
|
||||||
|
|
||||||
src.forEach(function(filepath){
|
dests.forEach(function(filepath){
|
||||||
|
|
||||||
compiled += grunt.file.read( root + filepath );
|
grunt.file.write(filepath + '/pixi.js', pixi);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
grunt.file.write(name, compiled);
|
grunt.log.writeln('Pixi copied to examples.');
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
grunt.log.writeln("File '" + name + "' created.");
|
grunt.registerTask('default', ['concat', 'uglify', 'distribute']);
|
||||||
|
grunt.registerTask('build', ['concat', 'uglify', 'distribute']);
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
grunt.registerMultiTask(
|
|
||||||
"distribute",
|
|
||||||
"Copy built file to examples",
|
|
||||||
function(){
|
|
||||||
var pixi = grunt.file.read( debug );
|
|
||||||
|
|
||||||
var dests = this.data;
|
|
||||||
|
|
||||||
dests.forEach(function(filepath){
|
|
||||||
|
|
||||||
grunt.file.write(filepath + "/pixi.js", pixi);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.log.writeln("Pixi copied to examples.");
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
grunt.loadNpmTasks("grunt-contrib-jshint");
|
|
||||||
grunt.loadNpmTasks("grunt-contrib-uglify");
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-qunit');
|
|
||||||
|
|
||||||
//grunt.registerTask("default", ["build:*:*", "jshint", "uglify"]);
|
|
||||||
grunt.registerTask("default", ["build:*:*", "uglify", "distribute:*:*"])
|
|
||||||
grunt.registerTask('test', ['build', 'connect:qunit', 'qunit']);
|
grunt.registerTask('test', ['build', 'connect:qunit', 'qunit']);
|
||||||
|
grunt.registerTask('docs', ['yuidoc']);
|
||||||
|
|
||||||
}
|
}
|
36
package.json
36
package.json
|
@ -1,11 +1,29 @@
|
||||||
{
|
{
|
||||||
"name" : "Pixi.JS",
|
"name": "Pixi.JS",
|
||||||
"version" : "0.0.1",
|
"version": "1.0.0",
|
||||||
"devDependencies" : {
|
"description": "Pixi.js is a fast lightweight 2D library that works across all devices.",
|
||||||
"grunt" : "~0.4.x",
|
|
||||||
"grunt-contrib-jshint" : "~0.1.1",
|
"author": "Mat Groves",
|
||||||
"grunt-contrib-uglify" : "~0.2.0",
|
"logo": "http://www.goodboydigital.com/pixijs/logo_small.png",
|
||||||
"grunt-contrib-connect" : "0.x",
|
|
||||||
"grunt-contrib-qunit" : "0.x"
|
"homepage": "http://goodboydigital.com/",
|
||||||
}
|
"bugs": "https://github.com/GoodBoyDigital/pixi.js/issues",
|
||||||
|
"license": "MIT",
|
||||||
|
"licenseUrl": "http://www.opensource.org/licenses/mit-license.php",
|
||||||
|
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/GoodBoyDigital/pixi.js.git"
|
||||||
|
},
|
||||||
|
|
||||||
|
"dependencies": {},
|
||||||
|
"devDependencies": {
|
||||||
|
"grunt": "~0.4.x",
|
||||||
|
"grunt-contrib-jshint": "0.3.x",
|
||||||
|
"grunt-contrib-uglify": "0.2.x",
|
||||||
|
"grunt-contrib-connect": "0.2.x",
|
||||||
|
"grunt-contrib-qunit": "0.2.x",
|
||||||
|
"grunt-contrib-yuidoc": "0.4.x",
|
||||||
|
"grunt-contrib-concat": "0.1.x"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Pixi.js API",
|
|
||||||
"logo": "http://www.goodboydigital.com/pixijs/logo_small.png",
|
|
||||||
"description": "Pixi.js is a fast lightweight 2D library that works across all devices.",
|
|
||||||
"version": "1.0",
|
|
||||||
"url": "http://goodboydigital.com/",
|
|
||||||
"options": {
|
|
||||||
"outdir": "../docs"
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue