gulp static version
parent
ccc41e1eb3
commit
621e44cb2d
154
gulpfile.js
154
gulpfile.js
|
@ -2,16 +2,11 @@ var gulp = require('gulp');
|
||||||
var concat = require('gulp-concat');
|
var concat = require('gulp-concat');
|
||||||
var sort = require('gulp-sort');
|
var sort = require('gulp-sort');
|
||||||
var minify = require('gulp-minify');
|
var minify = require('gulp-minify');
|
||||||
var plumber = require('gulp-plumber');
|
|
||||||
var istanbul = require('gulp-istanbul');
|
|
||||||
var mocha = require('gulp-mocha');
|
|
||||||
var watch = require('gulp-watch');
|
var watch = require('gulp-watch');
|
||||||
var preprocessor = require('gulp-c-preprocessor');
|
|
||||||
var inject = require('gulp-inject-string');
|
var inject = require('gulp-inject-string');
|
||||||
var replace = require('gulp-string-replace');
|
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
'merge',
|
'build',
|
||||||
function() {
|
function() {
|
||||||
|
|
||||||
var d = new Date();
|
var d = new Date();
|
||||||
|
@ -29,24 +24,6 @@ gulp.task(
|
||||||
"// END COMPILE TIME DEFINITIONS \n \n"
|
"// END COMPILE TIME DEFINITIONS \n \n"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.pipe(
|
|
||||||
replace(new RegExp('R3.D3.Utils.Extend\\(.*?\\);', 'g'), function (replacement) {
|
|
||||||
__EXTENDS__ += replacement + "\n";
|
|
||||||
return "//" + replacement;
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.pipe(
|
|
||||||
inject.append(
|
|
||||||
"\n//EXTENDS\n"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.pipe(
|
|
||||||
replace(
|
|
||||||
"//EXTENDS", function() {
|
|
||||||
return "//EXTENDING INTERFACES (Generated via gulp) \n" + __EXTENDS__ + "//END EXTENDING";
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.pipe(minify({
|
.pipe(minify({
|
||||||
ext:{
|
ext:{
|
||||||
src:'.js',
|
src:'.js',
|
||||||
|
@ -57,136 +34,9 @@ gulp.task(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task('test-prepare', function(){
|
|
||||||
return gulp.src('./build/r3.js')
|
|
||||||
.pipe(plumber())
|
|
||||||
.pipe(istanbul())
|
|
||||||
.pipe(istanbul.hookRequire())
|
|
||||||
.on('end', function(){
|
|
||||||
console.log('prepared the game lib for code coverage');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task(
|
|
||||||
'test',
|
|
||||||
['merge', 'test-prepare'],
|
|
||||||
function() {
|
|
||||||
gulp.src('./test/test.*.js')
|
|
||||||
.pipe(sort())
|
|
||||||
.pipe(plumber())
|
|
||||||
.pipe(mocha({reporter: 'spec'}))
|
|
||||||
.pipe(istanbul.writeReports({
|
|
||||||
dir: './build/coverage'
|
|
||||||
}))
|
|
||||||
.pipe(istanbul.enforceThresholds({thresholds:{global:1}}))
|
|
||||||
.on('error',
|
|
||||||
function(error) {
|
|
||||||
console.log('plugin error occurred' + error);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.on('end',
|
|
||||||
function() {
|
|
||||||
console.log('test task ended')
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
gulp.task('compileRuntime', ['merge'],
|
|
||||||
function() {
|
|
||||||
gulp.src(['./defines/runtime.js', './build/r3.js'])
|
|
||||||
.pipe(concat('r3-runtime.js'))
|
|
||||||
.pipe(preprocessor(
|
|
||||||
{
|
|
||||||
// End of line character
|
|
||||||
endLine: '\n',
|
|
||||||
|
|
||||||
// Escape '//#' & '/*#' comments (see extra/comments)
|
|
||||||
commentEscape: true,
|
|
||||||
|
|
||||||
// Empty lines to add between code and included files
|
|
||||||
includeSpaces: 0,
|
|
||||||
|
|
||||||
// Limit of empty following lines (0 = no limit)
|
|
||||||
emptyLinesLimit: 0,
|
|
||||||
|
|
||||||
// Base path for including files
|
|
||||||
basePath: './',
|
|
||||||
|
|
||||||
// Stop the compiler when an error ocurred ?
|
|
||||||
stopOnError: true,
|
|
||||||
|
|
||||||
// Constants in #enum command must be in hexadecimal ?
|
|
||||||
enumInHex: true
|
|
||||||
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.pipe(minify({
|
|
||||||
ext:{
|
|
||||||
src:'.js',
|
|
||||||
min:'-min.js'
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest('./build/'));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task('compileEditor', ['merge'],
|
|
||||||
function() {
|
|
||||||
gulp.src(['./defines/editor.js', './build/r3.js'])
|
|
||||||
.pipe(concat('r3-editor.js'))
|
|
||||||
.pipe(preprocessor(
|
|
||||||
{
|
|
||||||
// End of line character
|
|
||||||
endLine: '\n',
|
|
||||||
|
|
||||||
// Escape '//#' & '/*#' comments (see extra/comments)
|
|
||||||
commentEscape: true,
|
|
||||||
|
|
||||||
// Empty lines to add between code and included files
|
|
||||||
includeSpaces: 0,
|
|
||||||
|
|
||||||
// Limit of empty following lines (0 = no limit)
|
|
||||||
emptyLinesLimit: 0,
|
|
||||||
|
|
||||||
// Base path for including files
|
|
||||||
basePath: './',
|
|
||||||
|
|
||||||
// Stop the compiler when an error ocurred ?
|
|
||||||
stopOnError: true,
|
|
||||||
|
|
||||||
// Constants in #enum command must be in hexadecimal ?
|
|
||||||
enumInHex: true
|
|
||||||
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.pipe(minify({
|
|
||||||
ext:{
|
|
||||||
src:'.js',
|
|
||||||
min:'-min.js'
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest('./build/'));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task(
|
|
||||||
'build',
|
|
||||||
[
|
|
||||||
'merge'
|
|
||||||
],
|
|
||||||
function() {
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
'default',
|
'default',
|
||||||
[
|
gulp.series('build'),
|
||||||
'merge'
|
|
||||||
],
|
|
||||||
function() {
|
function() {
|
||||||
return watch([
|
return watch([
|
||||||
'src/*.js'
|
'src/*.js'
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
34
package.json
34
package.json
|
@ -1,33 +1,23 @@
|
||||||
{
|
{
|
||||||
"name": "spoon-r3",
|
"name": "r3",
|
||||||
"description": "Flying Spoon Game Library",
|
"description": "R3",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"repository": "https://bitbucket.org/flyingspoon/editor-r3.git",
|
"repository": "https://bitbucket.org/cybafelo/r3-3ditor.git",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cannon": "^0.6.2",
|
"cannon": "^0.6.2",
|
||||||
"gulp": "^3.9.1",
|
|
||||||
"gulp-concat": "^2.6.0",
|
|
||||||
"gulp-inject-string": "^1.1.0",
|
|
||||||
"gulp-minify": "0.0.14",
|
|
||||||
"gulp-sort": "^2.0.0",
|
|
||||||
"gulp-string-replace": "^0.2.0",
|
|
||||||
"gulp-util": "^3.0.7",
|
|
||||||
"i": "^0.3.5",
|
"i": "^0.3.5",
|
||||||
"lodash": "^4.17.2",
|
"npm": "^6.4.1",
|
||||||
"npm": "^4.0.2",
|
|
||||||
"q": "^1.4.1",
|
"q": "^1.4.1",
|
||||||
"three": "*",
|
"three": "*"
|
||||||
"through2": "^2.0.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^3.5.0",
|
"gulp": "git://github.com/gulpjs/gulp.git#6d71a658c61edb3090221579d8f97dbe086ba2ed",
|
||||||
"gulp-istanbul": "^1.1.1",
|
"gulp-concat": "*",
|
||||||
"gulp-mocha": "^3.0.1",
|
"gulp-inject-string": "*",
|
||||||
"gulp-plumber": "^1.1.0",
|
"gulp-minify": "*",
|
||||||
"gulp-watch": "^4.3.10",
|
"gulp-sort": "*",
|
||||||
"sinon": "^1.17.6",
|
"gulp-watch": "^5.0.1",
|
||||||
"sinon-chai": "^2.8.0",
|
"lodash": "^4.17.2"
|
||||||
"gulp-c-preprocessor": "0.0.4"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue