-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d188c11
commit 06a4b75
Showing
275 changed files
with
41,121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
//var gulp = require('gulp'); | ||
//var browserify = require('browserify'); | ||
//var source = require('vinyl-source-stream'); | ||
// | ||
|
||
|
||
//var gulp = require('gulp'); | ||
//var glob = require('glob'); | ||
//var browserify = require('browserify'); | ||
//var source = require('vinyl-source-stream'); | ||
// | ||
//gulp.task('browserify', function(){ | ||
// var testFiles = glob.sync('./build/away/**/*.js'); | ||
// return browserify({ | ||
// debug: true, | ||
// entries: testFiles, | ||
// paths: ['./build/away'] | ||
// }) | ||
// .bundle() | ||
// .pipe(source('away.js')) | ||
// .pipe(gulp.dest('./build')); | ||
//}); | ||
// | ||
//gulp.task('default', ['browserify']); | ||
|
||
var concat = require('gulp-concat'); | ||
var gulp = require('gulp'); | ||
var changed = require('gulp-changed'); | ||
var glob = require('glob'); | ||
var path = require('path'); | ||
var browserify = require('browserify'); | ||
var source = require('vinyl-source-stream'); | ||
var map = require('vinyl-map'); | ||
var exorcist = require('exorcist'); | ||
var sourcemaps = require('gulp-sourcemaps'); | ||
|
||
var typescript = require('gulp-typescript'); | ||
|
||
//var project = { | ||
// declaration: true, | ||
// sourcemap: true, | ||
// noResolve: false, | ||
// target: 'ES5', | ||
// module: 'commonjs' | ||
//}; | ||
// | ||
//gulp.task('compile', function() { | ||
// return gulp.src(['./lib/**/*.ts']) | ||
// //.pipe(changed('./out/', {extension:'.js', hasChanged: changed.compareLastModifiedTime})) | ||
// .pipe(tsc(project)) | ||
// .pipe(gulp.dest('out/')); | ||
//}); | ||
// | ||
//gulp.task('watch', ['scripts'], function() { | ||
// gulp.watch('lib/**/*.ts', ['scripts']); | ||
//}); | ||
|
||
gulp.task('compile', function() { | ||
var tsProject = typescript.createProject({ | ||
declarationFiles: true, | ||
noExternalResolve: true, | ||
target: 'ES5', | ||
module: 'commonjs' | ||
}); | ||
|
||
var ambientWrap = map(function(code, filename) { | ||
code = code.toString(); | ||
code = 'declare module "' + path.relative('../', filename.slice(0,-5)) + '" {\n\t' | ||
+ code.split('declare ').join('').split('\n').join('\n\t') + "\n" | ||
+ '}'; | ||
return code; | ||
}); | ||
|
||
var tsResult = gulp.src(['./lib/**/*.ts', './node_modules/awayjs-**/build/*.d.ts']) | ||
.pipe(sourcemaps.init()) | ||
.pipe(typescript(tsProject)); | ||
|
||
tsResult.dts | ||
.pipe(ambientWrap) | ||
.pipe(concat('awayjs-renderergl.d.ts')) | ||
.pipe(gulp.dest('./build')); | ||
|
||
return tsResult.js | ||
.pipe(sourcemaps.write()) | ||
.pipe(gulp.dest('./lib')); | ||
}); | ||
|
||
gulp.task('watch', ['package'], function() { | ||
gulp.watch('./lib/**/*.ts', ['package']); | ||
}); | ||
|
||
gulp.task('package', ['compile'], function(callback){ | ||
var b = browserify({ | ||
debug: true, | ||
paths: ['../'] | ||
}); | ||
|
||
glob('./node_modules/awayjs-**/lib/**/*.js', {}, function (error, files) { | ||
files.forEach(function (file) { | ||
b.external(file); | ||
}); | ||
}); | ||
|
||
glob('./lib/**/*.js', {}, function (error, files) { | ||
|
||
files.forEach(function (file) { | ||
b.require(file, {expose:path.relative('../', file.slice(0,-3))}); | ||
}); | ||
|
||
b.bundle() | ||
.pipe(exorcist('./build/awayjs-renderergl.js.map')) | ||
.pipe(source('awayjs-renderergl.js')) | ||
.pipe(gulp.dest('./build')) | ||
.on('end', callback); | ||
}); | ||
}); | ||
|
||
|
||
gulp.task('tests', function () { | ||
|
||
var tsProject = typescript.createProject({ | ||
declarationFiles: true, | ||
noExternalResolve: true, | ||
target: 'ES5', | ||
module: 'commonjs' | ||
}); | ||
|
||
var tsResult = gulp.src(['./tests/**/*.ts', './node_modules/awayjs-**/build/*.d.ts', './build/awayjs-renderergl.d.ts']) | ||
//.pipe(changed('./tests', {extension:'.js', hasChanged: changed.compareLastModifiedTime})) | ||
.pipe(sourcemaps.init()) | ||
.pipe(typescript(tsProject)); | ||
|
||
return tsResult.js | ||
.pipe(sourcemaps.write()) | ||
.pipe(gulp.dest('./tests')); | ||
}); |
Oops, something went wrong.