Merge branch 'gulp4'
* gulp4: refactor all UI gulpfiles rewrite ui/site build refactor gulp project definitions upgrade typescript ui/chat gulp 4 ui/analyse gulp upgrade refactor ui/simul gulpfile improve ui/simul build gulp 4: ui/simul gulp 4 migration WIPpull/4693/head
commit
260a98b84d
|
@ -1,53 +1,3 @@
|
|||
const gulp = require('gulp');
|
||||
const gutil = require('gulp-util');
|
||||
const watchify = require('watchify');
|
||||
const browserify = require('browserify');
|
||||
const uglify = require('gulp-uglify');
|
||||
const source = require('vinyl-source-stream');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const tsify = require('tsify');
|
||||
const lilaGulp = require('../gulp/tsProject.js');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
|
||||
function onError(error) {
|
||||
gutil.log(gutil.colors.red(error.message));
|
||||
}
|
||||
|
||||
function build() {
|
||||
return browserify('src/main.ts', {
|
||||
standalone: 'LichessAnalyse',
|
||||
debug: true
|
||||
})
|
||||
.plugin(tsify);
|
||||
}
|
||||
|
||||
const watchedBrowserify = watchify(build());
|
||||
|
||||
function bundle() {
|
||||
return watchedBrowserify
|
||||
.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.analyse.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
gulp.task('default', bundle);
|
||||
watchedBrowserify.on('update', bundle);
|
||||
watchedBrowserify.on('log', gutil.log);
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return build()
|
||||
.bundle()
|
||||
.pipe(source('lichess.analyse.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('prod', function() {
|
||||
return build()
|
||||
.bundle()
|
||||
.pipe(source('lichess.analyse.min.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
lilaGulp('LichessAnalyse', 'lichess.analyse', __dirname);
|
||||
|
|
|
@ -24,14 +24,16 @@
|
|||
"devDependencies": {
|
||||
"@types/jquery": "^2.0",
|
||||
"@types/lichess": "1.0.0",
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"browserify": "^16",
|
||||
"fancy-log": "^1",
|
||||
"gulp": "^4",
|
||||
"gulp-size": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"tsify": "^3",
|
||||
"typescript": "^2",
|
||||
"tsify": "^4",
|
||||
"typescript": "^3",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"vinyl-source-stream": "^1",
|
||||
"watchify": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -41,7 +43,7 @@
|
|||
"chessground": "^7.3",
|
||||
"common": "1.0.0",
|
||||
"game": "1.0.0",
|
||||
"snabbdom": "ornicar/snabbdom#lichess",
|
||||
"snabbdom": "ornicar/snabbdom#0.7.1-lichess",
|
||||
"tree": "1.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,9 +81,8 @@ function stateOff(ctrl: RelayCtrl) {
|
|||
let cachedDateFormatter: (date: Date) => string;
|
||||
|
||||
function getDateFormatter(): (date: Date) => string {
|
||||
if (!cachedDateFormatter)
|
||||
cachedDateFormatter = (window.Intl && Intl.DateTimeFormat) ?
|
||||
new Intl.DateTimeFormat(document.documentElement.lang, {
|
||||
if (!cachedDateFormatter) cachedDateFormatter = (window.Intl && Intl.DateTimeFormat) ?
|
||||
new Intl.DateTimeFormat(document.documentElement!.lang, {
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
hour: 'numeric',
|
||||
|
|
|
@ -23,8 +23,8 @@ function getPosition(e: MouseEvent): Coords {
|
|||
posx = e.pageX;
|
||||
posy = e.pageY;
|
||||
} else if (e.clientX || e.clientY) {
|
||||
posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
|
||||
posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
|
||||
posx = e.clientX + document.body.scrollLeft + document.documentElement!.scrollLeft;
|
||||
posy = e.clientY + document.body.scrollTop + document.documentElement!.scrollTop;
|
||||
}
|
||||
return {
|
||||
x: posx,
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
"@types/lichess": "1.0.0",
|
||||
"@types/defer-promise": "1.0.0",
|
||||
"nodeunit": "^0.11.0",
|
||||
"typescript": "^2"
|
||||
"typescript": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
"chess": "1.0.0",
|
||||
|
|
|
@ -1,53 +1,3 @@
|
|||
const gulp = require("gulp");
|
||||
const browserify = require("browserify");
|
||||
const source = require('vinyl-source-stream');
|
||||
const tsify = require("tsify");
|
||||
const watchify = require("watchify");
|
||||
const gutil = require("gulp-util");
|
||||
const uglify = require('gulp-uglify');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const lilaGulp = require('../gulp/tsProject.js');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
|
||||
function onError(error) {
|
||||
return gutil.log(gutil.colors.red(error.message));
|
||||
}
|
||||
|
||||
function build(debug) {
|
||||
return browserify('src/main.ts', {
|
||||
standalone: 'LichessChallenge',
|
||||
debug: debug
|
||||
})
|
||||
.plugin(tsify);
|
||||
}
|
||||
|
||||
const watchedBrowserify = watchify(build(true));
|
||||
|
||||
function bundle() {
|
||||
return watchedBrowserify
|
||||
.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.challenge.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
gulp.task("default", [], bundle);
|
||||
watchedBrowserify.on("update", bundle);
|
||||
watchedBrowserify.on("log", gutil.log);
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return build(true)
|
||||
.bundle()
|
||||
.pipe(source('lichess.challenge.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task("prod", [], function() {
|
||||
return build(false)
|
||||
.bundle()
|
||||
.pipe(source('lichess.challenge.min.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
lilaGulp('LichessChallenge', 'lichess.challenge', __dirname);
|
||||
|
|
|
@ -9,18 +9,17 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/jquery": "^2.0",
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-sourcemaps": "^2",
|
||||
"gulp-typescript": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"tsify": "^3",
|
||||
"@types/lichess": "1.0.0",
|
||||
"typescript": "^2",
|
||||
"browserify": "^16",
|
||||
"fancy-log": "^1",
|
||||
"gulp": "^4",
|
||||
"gulp-size": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"tsify": "^4",
|
||||
"typescript": "^3",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"vinyl-source-stream": "^1",
|
||||
"watchify": "^3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,53 +1,3 @@
|
|||
const gulp = require("gulp");
|
||||
const browserify = require("browserify");
|
||||
const source = require('vinyl-source-stream');
|
||||
const tsify = require("tsify");
|
||||
const watchify = require("watchify");
|
||||
const gutil = require("gulp-util");
|
||||
const uglify = require('gulp-uglify');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const lilaGulp = require('../gulp/tsProject.js');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
|
||||
function onError(error) {
|
||||
return gutil.log(gutil.colors.red(error.message));
|
||||
}
|
||||
|
||||
function build(debug) {
|
||||
return browserify('src/main.ts', {
|
||||
standalone: 'LichessChat',
|
||||
debug: debug
|
||||
})
|
||||
.plugin(tsify);
|
||||
}
|
||||
|
||||
const watchedBrowserify = watchify(build(true));
|
||||
|
||||
function bundle() {
|
||||
return watchedBrowserify
|
||||
.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.chat.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
gulp.task("default", [], bundle);
|
||||
watchedBrowserify.on("update", bundle);
|
||||
watchedBrowserify.on("log", gutil.log);
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return build(true)
|
||||
.bundle()
|
||||
.pipe(source('lichess.chat.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task("prod", [], function() {
|
||||
return build(false)
|
||||
.bundle()
|
||||
.pipe(source('lichess.chat.min.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
lilaGulp('LichessChat', 'lichess.chat', __dirname);
|
||||
|
|
|
@ -14,18 +14,17 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/jquery": "^2.0",
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-sourcemaps": "^2",
|
||||
"gulp-typescript": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"tsify": "^3",
|
||||
"@types/lichess": "1.0.0",
|
||||
"typescript": "^2",
|
||||
"browserify": "^16",
|
||||
"fancy-log": "^1",
|
||||
"gulp": "^4",
|
||||
"gulp-size": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"tsify": "^4",
|
||||
"typescript": "^3",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"vinyl-source-stream": "^1",
|
||||
"watchify": "^3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ export default function(ctrl: Ctrl): Array<VNode | undefined> {
|
|||
const autoScroll = (el.scrollTop === 0 || (el.scrollTop > (el.scrollHeight - el.clientHeight - 100)));
|
||||
if (autoScroll) {
|
||||
el.scrollTop = 999999;
|
||||
setTimeout(_ => el.scrollTop = 999999, 300)
|
||||
setTimeout((_: any) => el.scrollTop = 999999, 300)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"homepage": "https://github.com/ornicar/lila",
|
||||
"devDependencies": {
|
||||
"@types/lichess": "1.0.0",
|
||||
"typescript": "^2.2.2"
|
||||
"typescript": "^3"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
|
|
@ -1,53 +1,3 @@
|
|||
const gulp = require("gulp");
|
||||
const browserify = require("browserify");
|
||||
const source = require('vinyl-source-stream');
|
||||
const tsify = require("tsify");
|
||||
const watchify = require("watchify");
|
||||
const gutil = require("gulp-util");
|
||||
const uglify = require('gulp-uglify');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const lilaGulp = require('../gulp/tsProject.js');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
|
||||
function onError(error) {
|
||||
return gutil.log(gutil.colors.red(error.message));
|
||||
}
|
||||
|
||||
function build(debug) {
|
||||
return browserify('src/main.ts', {
|
||||
standalone: 'LichessCli',
|
||||
debug: debug
|
||||
})
|
||||
.plugin(tsify);
|
||||
}
|
||||
|
||||
const watchedBrowserify = watchify(build(true));
|
||||
|
||||
function bundle() {
|
||||
return watchedBrowserify
|
||||
.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.cli.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
gulp.task("default", [], bundle);
|
||||
watchedBrowserify.on("update", bundle);
|
||||
watchedBrowserify.on("log", gutil.log);
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return build(true)
|
||||
.bundle()
|
||||
.pipe(source('lichess.cli.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task("prod", [], function() {
|
||||
return build(false)
|
||||
.bundle()
|
||||
.pipe(source('lichess.cli.min.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
lilaGulp('LichessCli', 'lichess.cli', __dirname);
|
||||
|
|
|
@ -7,15 +7,17 @@
|
|||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/jquery": "^2.0",
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"tsify": "^3",
|
||||
"@types/lichess": "1.0.0",
|
||||
"typescript": "^2",
|
||||
"browserify": "^16",
|
||||
"fancy-log": "^1",
|
||||
"gulp": "^4",
|
||||
"gulp-size": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"tsify": "^4",
|
||||
"typescript": "^3",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"vinyl-source-stream": "^1",
|
||||
"watchify": "^3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/lichess": "1.0.0",
|
||||
"typescript": "^2"
|
||||
"typescript": "^3"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
|
|
@ -1,53 +1,3 @@
|
|||
const gulp = require("gulp");
|
||||
const browserify = require("browserify");
|
||||
const source = require('vinyl-source-stream');
|
||||
const tsify = require("tsify");
|
||||
const watchify = require("watchify");
|
||||
const gutil = require("gulp-util");
|
||||
const uglify = require('gulp-uglify');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const lilaGulp = require('../gulp/tsProject.js');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
|
||||
function onError(error) {
|
||||
return gutil.log(gutil.colors.red(error.message));
|
||||
}
|
||||
|
||||
function build(debug) {
|
||||
return browserify('src/main.ts', {
|
||||
standalone: 'LichessDasher',
|
||||
debug: debug
|
||||
})
|
||||
.plugin(tsify);
|
||||
}
|
||||
|
||||
const watchedBrowserify = watchify(build(true));
|
||||
|
||||
function bundle() {
|
||||
return watchedBrowserify
|
||||
.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.dasher.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
gulp.task("default", [], bundle);
|
||||
watchedBrowserify.on("update", bundle);
|
||||
watchedBrowserify.on("log", gutil.log);
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return build(true)
|
||||
.bundle()
|
||||
.pipe(source('lichess.dasher.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task("prod", [], function() {
|
||||
return build(false)
|
||||
.bundle()
|
||||
.pipe(source('lichess.dasher.min.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
lilaGulp('LichessDasher', 'lichess.dasher', __dirname);
|
||||
|
|
|
@ -10,15 +10,17 @@
|
|||
"devDependencies": {
|
||||
"@types/jquery": "^2.0",
|
||||
"@types/jqueryui": "^1.11",
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"tsify": "^3",
|
||||
"@types/lichess": "1.0.0",
|
||||
"typescript": "^2",
|
||||
"browserify": "^16",
|
||||
"fancy-log": "^1",
|
||||
"gulp": "^4",
|
||||
"gulp-size": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"tsify": "^4",
|
||||
"typescript": "^3",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"vinyl-source-stream": "^1",
|
||||
"watchify": "^3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,52 +1,3 @@
|
|||
var source = require('vinyl-source-stream');
|
||||
var gulp = require('gulp');
|
||||
var gutil = require('gulp-util');
|
||||
var watchify = require('watchify');
|
||||
var browserify = require('browserify');
|
||||
var uglify = require('gulp-uglify');
|
||||
var streamify = require('gulp-streamify');
|
||||
const lilaGulp = require('../gulp/jsProject.js');
|
||||
|
||||
var sources = ['./src/main.js'];
|
||||
var destination = '../../public/compiled/';
|
||||
var onError = function(error) {
|
||||
gutil.log(gutil.colors.red(error.message));
|
||||
};
|
||||
var standalone = 'LichessEditor';
|
||||
|
||||
gulp.task('prod', function() {
|
||||
return browserify('./src/main.js', {
|
||||
standalone: standalone
|
||||
}).bundle()
|
||||
.pipe(source('lichess.editor.min.js'))
|
||||
.pipe(streamify(uglify()))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return browserify('./src/main.js', {
|
||||
standalone: standalone
|
||||
}).bundle()
|
||||
.pipe(source('lichess.editor.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('watch', function() {
|
||||
var opts = watchify.args;
|
||||
opts.debug = true;
|
||||
opts.standalone = standalone;
|
||||
|
||||
var bundleStream = watchify(browserify(sources, opts))
|
||||
.on('update', rebundle)
|
||||
.on('log', gutil.log);
|
||||
|
||||
function rebundle() {
|
||||
return bundleStream.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.editor.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
return rebundle();
|
||||
});
|
||||
|
||||
gulp.task('default', ['watch']);
|
||||
lilaGulp('LichessEditor', 'lichess.editor', __dirname);
|
||||
|
|
|
@ -20,13 +20,14 @@
|
|||
},
|
||||
"homepage": "https://github.com/ornicar/lila",
|
||||
"devDependencies": {
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-streamify": "^1",
|
||||
"browserify": "^16",
|
||||
"gulp": "^4",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"gulp-size": "^3",
|
||||
"fancy-log": "^1",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^1",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"watchify": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/lichess": "1.0.0",
|
||||
"typescript": "^2"
|
||||
"typescript": "^3"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
const gulp = require('gulp');
|
||||
const source = require('vinyl-source-stream');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const colors = require('ansi-colors');
|
||||
const logger = require('fancy-log');
|
||||
const watchify = require('watchify');
|
||||
const browserify = require('browserify');
|
||||
const uglify = require('gulp-uglify');
|
||||
const size = require('gulp-size');
|
||||
|
||||
module.exports = (standalone, fileBaseName, dir) => {
|
||||
|
||||
const browserifyOpts = (debug) => ({
|
||||
entries: [`${dir}/src/main.js`],
|
||||
standalone: standalone,
|
||||
debug: debug
|
||||
});
|
||||
const destination = () => gulp.dest(`../../public/compiled/`);
|
||||
|
||||
const prod = () => browserify(browserifyOpts(false))
|
||||
.bundle()
|
||||
.pipe(source(`${fileBaseName}.min.js`))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(size())
|
||||
.pipe(destination());
|
||||
|
||||
const dev = () => browserify(browserifyOpts(true))
|
||||
.bundle()
|
||||
.pipe(source(`${fileBaseName}.js`))
|
||||
.pipe(destination());
|
||||
|
||||
const watch = () => {
|
||||
|
||||
const bundle = () => bundler
|
||||
.bundle()
|
||||
.on('error', error => logger.error(colors.red(error.message)))
|
||||
.pipe(source(`${fileBaseName}.js`))
|
||||
.pipe(destination());
|
||||
|
||||
const bundler = watchify(
|
||||
browserify(Object.assign({}, watchify.args, browserifyOpts(true)))
|
||||
).on('update', bundle).on('log', logger.info);
|
||||
|
||||
return bundle();
|
||||
};
|
||||
|
||||
gulp.task('prod', prod);
|
||||
gulp.task('dev', dev);
|
||||
gulp.task('default', watch);
|
||||
};
|
|
@ -0,0 +1,55 @@
|
|||
const gulp = require('gulp');
|
||||
const source = require('vinyl-source-stream');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const colors = require('ansi-colors');
|
||||
const logger = require('fancy-log');
|
||||
const watchify = require('watchify');
|
||||
const browserify = require('browserify');
|
||||
const uglify = require('gulp-uglify');
|
||||
const size = require('gulp-size');
|
||||
const tsify = require('tsify');
|
||||
|
||||
module.exports = (standalone, fileBaseName, dir) => {
|
||||
|
||||
const browserifyOpts = (debug) => ({
|
||||
entries: [`${dir}/src/main.ts`],
|
||||
standalone: standalone,
|
||||
debug: debug
|
||||
});
|
||||
const destination = () => gulp.dest(`../../public/compiled/`);
|
||||
|
||||
const prod = () => browserify(browserifyOpts(false))
|
||||
.plugin(tsify)
|
||||
.bundle()
|
||||
.pipe(source(`${fileBaseName}.min.js`))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(size())
|
||||
.pipe(destination());
|
||||
|
||||
const dev = () => browserify(browserifyOpts(true))
|
||||
.plugin(tsify)
|
||||
.bundle()
|
||||
.pipe(source(`${fileBaseName}.js`))
|
||||
.pipe(destination());
|
||||
|
||||
const watch = () => {
|
||||
|
||||
const bundle = () => bundler
|
||||
.plugin(tsify)
|
||||
.bundle()
|
||||
.on('error', error => logger.error(colors.red(error.message)))
|
||||
.pipe(source(`${fileBaseName}.js`))
|
||||
.pipe(destination());
|
||||
|
||||
const bundler = watchify(
|
||||
browserify(Object.assign({}, watchify.args, browserifyOpts(true)))
|
||||
).on('update', bundle).on('log', logger.info);
|
||||
|
||||
return bundle();
|
||||
};
|
||||
|
||||
gulp.task('prod', prod);
|
||||
gulp.task('dev', dev);
|
||||
gulp.task('default', watch);
|
||||
};
|
|
@ -1,52 +1,3 @@
|
|||
var source = require('vinyl-source-stream');
|
||||
var gulp = require('gulp');
|
||||
var gutil = require('gulp-util');
|
||||
var watchify = require('watchify');
|
||||
var browserify = require('browserify');
|
||||
var uglify = require('gulp-uglify');
|
||||
var streamify = require('gulp-streamify');
|
||||
const lilaGulp = require('../gulp/jsProject.js');
|
||||
|
||||
var sources = ['./src/main.js'];
|
||||
var destination = '../../public/compiled/';
|
||||
var onError = function(error) {
|
||||
gutil.log(gutil.colors.red(error.message));
|
||||
};
|
||||
var standalone = 'LichessInsight';
|
||||
|
||||
gulp.task('prod', function() {
|
||||
return browserify('./src/main.js', {
|
||||
standalone: standalone
|
||||
}).bundle()
|
||||
.pipe(source('lichess.insight.min.js'))
|
||||
.pipe(streamify(uglify()))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return browserify('./src/main.js', {
|
||||
standalone: standalone
|
||||
}).bundle()
|
||||
.pipe(source('lichess.insight.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('watch', function() {
|
||||
var opts = watchify.args;
|
||||
opts.debug = true;
|
||||
opts.standalone = standalone;
|
||||
|
||||
var bundleStream = watchify(browserify(sources, opts))
|
||||
.on('update', rebundle)
|
||||
.on('log', gutil.log);
|
||||
|
||||
function rebundle() {
|
||||
return bundleStream.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.insight.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
return rebundle();
|
||||
});
|
||||
|
||||
gulp.task('default', ['watch']);
|
||||
lilaGulp('LichessInsight', 'lichess.insight', __dirname);
|
||||
|
|
|
@ -20,13 +20,14 @@
|
|||
},
|
||||
"homepage": "https://github.com/ornicar/lila",
|
||||
"devDependencies": {
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-streamify": "^1",
|
||||
"browserify": "^16",
|
||||
"gulp": "^4",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"gulp-size": "^3",
|
||||
"fancy-log": "^1",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^1",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"watchify": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,52 +1,3 @@
|
|||
var source = require('vinyl-source-stream');
|
||||
var gulp = require('gulp');
|
||||
var gutil = require('gulp-util');
|
||||
var watchify = require('watchify');
|
||||
var browserify = require('browserify');
|
||||
var uglify = require('gulp-uglify');
|
||||
var streamify = require('gulp-streamify');
|
||||
const lilaGulp = require('../gulp/jsProject.js');
|
||||
|
||||
var sources = ['./src/main.js'];
|
||||
var destination = '../../public/compiled/';
|
||||
var onError = function(error) {
|
||||
gutil.log(gutil.colors.red(error.message));
|
||||
};
|
||||
var standalone = 'LichessLearn';
|
||||
|
||||
gulp.task('prod', function() {
|
||||
return browserify('./src/main.js', {
|
||||
standalone: standalone
|
||||
}).bundle()
|
||||
.pipe(source('lichess.learn.min.js'))
|
||||
.pipe(streamify(uglify()))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return browserify('./src/main.js', {
|
||||
standalone: standalone
|
||||
}).bundle()
|
||||
.pipe(source('lichess.learn.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('watch', function() {
|
||||
var opts = watchify.args;
|
||||
opts.debug = true;
|
||||
opts.standalone = standalone;
|
||||
|
||||
var bundleStream = watchify(browserify(sources, opts))
|
||||
.on('update', rebundle)
|
||||
.on('log', gutil.log);
|
||||
|
||||
function rebundle() {
|
||||
return bundleStream.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.learn.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
return rebundle();
|
||||
});
|
||||
|
||||
gulp.task('default', ['watch']);
|
||||
lilaGulp('LichessLearn', 'lichess.learn', __dirname);
|
||||
|
|
|
@ -19,13 +19,14 @@
|
|||
},
|
||||
"homepage": "https://github.com/ornicar/lila",
|
||||
"devDependencies": {
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-streamify": "^1",
|
||||
"browserify": "^16",
|
||||
"gulp": "^4",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"gulp-size": "^3",
|
||||
"fancy-log": "^1",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^1",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"watchify": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,54 +1,3 @@
|
|||
const gulp = require('gulp');
|
||||
const gutil = require('gulp-util');
|
||||
const watchify = require('watchify');
|
||||
const browserify = require('browserify');
|
||||
const uglify = require('gulp-uglify');
|
||||
const source = require('vinyl-source-stream');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const tsify = require('tsify');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
|
||||
function onError(error) {
|
||||
gutil.log(gutil.colors.red(error.message));
|
||||
}
|
||||
|
||||
function build() {
|
||||
return browserify('src/main.ts', {
|
||||
standalone: 'LichessLobby',
|
||||
debug: true
|
||||
})
|
||||
.plugin(tsify);
|
||||
}
|
||||
|
||||
const watchedBrowserify = watchify(build());
|
||||
|
||||
function bundle() {
|
||||
return watchedBrowserify
|
||||
.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.lobby.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
gulp.task('default', bundle);
|
||||
watchedBrowserify.on('update', bundle);
|
||||
watchedBrowserify.on('log', gutil.log);
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return build()
|
||||
.bundle()
|
||||
.pipe(source('lichess.lobby.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('prod', function() {
|
||||
return build()
|
||||
.bundle()
|
||||
.pipe(source('lichess.lobby.min.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
const lilaGulp = require('../gulp/tsProject.js');
|
||||
|
||||
lilaGulp('LichessLobby', 'lichess.lobby', __dirname);
|
||||
|
|
|
@ -22,14 +22,16 @@
|
|||
"devDependencies": {
|
||||
"@types/jquery": "^2.0",
|
||||
"@types/lichess": "1.0.0",
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"browserify": "^16",
|
||||
"fancy-log": "^1",
|
||||
"gulp": "^4",
|
||||
"gulp-size": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"tsify": "^3",
|
||||
"typescript": "^2",
|
||||
"tsify": "^4",
|
||||
"typescript": "^3",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"vinyl-source-stream": "^1",
|
||||
"watchify": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,53 +1,3 @@
|
|||
const gulp = require("gulp");
|
||||
const browserify = require("browserify");
|
||||
const source = require('vinyl-source-stream');
|
||||
const tsify = require("tsify");
|
||||
const watchify = require("watchify");
|
||||
const gutil = require("gulp-util");
|
||||
const uglify = require('gulp-uglify');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const lilaGulp = require('../gulp/tsProject.js');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
|
||||
function onError(error) {
|
||||
return gutil.log(gutil.colors.red(error.message));
|
||||
}
|
||||
|
||||
function build(debug) {
|
||||
return browserify('src/main.ts', {
|
||||
standalone: 'LichessNotify',
|
||||
debug: debug
|
||||
})
|
||||
.plugin(tsify);
|
||||
}
|
||||
|
||||
const watchedBrowserify = watchify(build(true));
|
||||
|
||||
function bundle() {
|
||||
return watchedBrowserify
|
||||
.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.notify.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
gulp.task("default", [], bundle);
|
||||
watchedBrowserify.on("update", bundle);
|
||||
watchedBrowserify.on("log", gutil.log);
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return build(true)
|
||||
.bundle()
|
||||
.pipe(source('lichess.notify.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task("prod", [], function() {
|
||||
return build(false)
|
||||
.bundle()
|
||||
.pipe(source('lichess.notify.min.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
lilaGulp('LichessNotify', 'lichess.notify', __dirname);
|
||||
|
|
|
@ -9,18 +9,17 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/jquery": "^2.0",
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-sourcemaps": "^2",
|
||||
"gulp-typescript": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"tsify": "^3",
|
||||
"@types/lichess": "1.0.0",
|
||||
"typescript": "^2",
|
||||
"browserify": "^16",
|
||||
"fancy-log": "^1",
|
||||
"gulp": "^4",
|
||||
"gulp-size": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"tsify": "^4",
|
||||
"typescript": "^3",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"vinyl-source-stream": "^1",
|
||||
"watchify": "^3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,52 +1,3 @@
|
|||
var source = require('vinyl-source-stream');
|
||||
var gulp = require('gulp');
|
||||
var gutil = require('gulp-util');
|
||||
var watchify = require('watchify');
|
||||
var browserify = require('browserify');
|
||||
var uglify = require('gulp-uglify');
|
||||
var streamify = require('gulp-streamify');
|
||||
const lilaGulp = require('../gulp/jsProject.js');
|
||||
|
||||
var sources = ['./src/main.js'];
|
||||
var destination = '../../public/compiled/';
|
||||
var onError = function(error) {
|
||||
gutil.log(gutil.colors.red(error.message));
|
||||
};
|
||||
var standalone = 'LichessPerfStat';
|
||||
|
||||
gulp.task('prod', function() {
|
||||
return browserify('./src/main.js', {
|
||||
standalone: standalone
|
||||
}).bundle()
|
||||
.pipe(source('lichess.perfStat.min.js'))
|
||||
.pipe(streamify(uglify()))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return browserify('./src/main.js', {
|
||||
standalone: standalone
|
||||
}).bundle()
|
||||
.pipe(source('lichess.perfStat.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('watch', function() {
|
||||
var opts = watchify.args;
|
||||
opts.debug = true;
|
||||
opts.standalone = standalone;
|
||||
|
||||
var bundleStream = watchify(browserify(sources, opts))
|
||||
.on('update', rebundle)
|
||||
.on('log', gutil.log);
|
||||
|
||||
function rebundle() {
|
||||
return bundleStream.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.perfStat.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
return rebundle();
|
||||
});
|
||||
|
||||
gulp.task('default', ['watch']);
|
||||
lilaGulp('LichessPerfStat', 'lichess.perfStat', __dirname);
|
||||
|
|
|
@ -20,13 +20,14 @@
|
|||
},
|
||||
"homepage": "https://github.com/ornicar/lila",
|
||||
"devDependencies": {
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-streamify": "^1",
|
||||
"browserify": "^16",
|
||||
"gulp": "^4",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"gulp-size": "^3",
|
||||
"fancy-log": "^1",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^1",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"watchify": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,53 +1,3 @@
|
|||
const gulp = require('gulp');
|
||||
const gutil = require('gulp-util');
|
||||
const watchify = require('watchify');
|
||||
const browserify = require('browserify');
|
||||
const uglify = require('gulp-uglify');
|
||||
const source = require('vinyl-source-stream');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const tsify = require('tsify');
|
||||
const lilaGulp = require('../gulp/tsProject.js');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
|
||||
function onError(error) {
|
||||
gutil.log(gutil.colors.red(error.message));
|
||||
}
|
||||
|
||||
function build() {
|
||||
return browserify('src/main.ts', {
|
||||
standalone: 'LichessPuzzle',
|
||||
debug: true
|
||||
})
|
||||
.plugin(tsify);
|
||||
}
|
||||
|
||||
const watchedBrowserify = watchify(build());
|
||||
|
||||
function bundle() {
|
||||
return watchedBrowserify
|
||||
.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.puzzle.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
gulp.task('default', bundle);
|
||||
watchedBrowserify.on('update', bundle);
|
||||
watchedBrowserify.on('log', gutil.log);
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return build()
|
||||
.bundle()
|
||||
.pipe(source('lichess.puzzle.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('prod', function() {
|
||||
return build()
|
||||
.bundle()
|
||||
.pipe(source('lichess.puzzle.min.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
lilaGulp('LichessPuzzle', 'lichess.puzzle', __dirname);
|
||||
|
|
|
@ -21,15 +21,17 @@
|
|||
"homepage": "https://github.com/ornicar/lila",
|
||||
"devDependencies": {
|
||||
"@types/jquery": "^2.0",
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"tsify": "^3",
|
||||
"@types/lichess": "1.0.0",
|
||||
"typescript": "^2",
|
||||
"browserify": "^16",
|
||||
"fancy-log": "^1",
|
||||
"gulp": "^4",
|
||||
"gulp-size": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"tsify": "^4",
|
||||
"typescript": "^3",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"vinyl-source-stream": "^1",
|
||||
"watchify": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,57 +1,3 @@
|
|||
const gulp = require('gulp');
|
||||
const gutil = require('gulp-util');
|
||||
const watchify = require('watchify');
|
||||
const browserify = require('browserify');
|
||||
const uglify = require('gulp-uglify');
|
||||
const source = require('vinyl-source-stream');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const tsify = require('tsify');
|
||||
const lilaGulp = require('../gulp/tsProject.js');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
|
||||
function onError(error) {
|
||||
gutil.log(gutil.colors.red(error.message));
|
||||
}
|
||||
|
||||
function build(debug) {
|
||||
return browserify('src/main.ts', {
|
||||
standalone: 'LichessRound',
|
||||
debug: debug
|
||||
})
|
||||
.plugin(tsify);
|
||||
}
|
||||
|
||||
const watchedBrowserify = watchify(build(true, false));
|
||||
|
||||
function bundle() {
|
||||
return watchedBrowserify
|
||||
.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.round.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
watchedBrowserify.on('update', bundle);
|
||||
watchedBrowserify.on('log', gutil.log);
|
||||
|
||||
function dev() {
|
||||
return () => build(true)
|
||||
.bundle()
|
||||
.pipe(source('lichess.round.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
};
|
||||
gulp.task('dev', dev(false));
|
||||
|
||||
function prod() {
|
||||
return () => build(false)
|
||||
.bundle()
|
||||
.pipe(source('lichess.round.min.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
gulp.task('prod', prod(false));
|
||||
|
||||
gulp.task('default', bundle);
|
||||
lilaGulp('LichessRound', 'lichess.round', __dirname);
|
||||
|
|
|
@ -20,16 +20,17 @@
|
|||
},
|
||||
"homepage": "https://github.com/ornicar/lila",
|
||||
"devDependencies": {
|
||||
"@types/jquery": "^2.0",
|
||||
"@types/lichess": "1.0.0",
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"browserify": "^16",
|
||||
"fancy-log": "^1",
|
||||
"gulp": "^4",
|
||||
"gulp-size": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"tsify": "^3",
|
||||
"typescript": "^2",
|
||||
"tsify": "^4",
|
||||
"typescript": "^3",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"vinyl-source-stream": "^1",
|
||||
"watchify": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,52 +1,3 @@
|
|||
var source = require('vinyl-source-stream');
|
||||
var gulp = require('gulp');
|
||||
var gutil = require('gulp-util');
|
||||
var watchify = require('watchify');
|
||||
var browserify = require('browserify');
|
||||
var uglify = require('gulp-uglify');
|
||||
var streamify = require('gulp-streamify');
|
||||
const lilaGulp = require('../gulp/jsProject.js');
|
||||
|
||||
var sources = ['./src/main.js'];
|
||||
var destination = '../../public/compiled/';
|
||||
var onError = function(error) {
|
||||
gutil.log(gutil.colors.red(error.message));
|
||||
};
|
||||
var standalone = 'LichessSimul';
|
||||
|
||||
gulp.task('prod', function() {
|
||||
return browserify('./src/main.js', {
|
||||
standalone: standalone
|
||||
}).bundle()
|
||||
.pipe(source('lichess.simul.min.js'))
|
||||
.pipe(streamify(uglify()))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return browserify('./src/main.js', {
|
||||
standalone: standalone
|
||||
}).bundle()
|
||||
.pipe(source('lichess.simul.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('watch', function() {
|
||||
var opts = watchify.args;
|
||||
opts.debug = true;
|
||||
opts.standalone = standalone;
|
||||
|
||||
var bundleStream = watchify(browserify(sources, opts))
|
||||
.on('update', rebundle)
|
||||
.on('log', gutil.log);
|
||||
|
||||
function rebundle() {
|
||||
return bundleStream.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.simul.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
return rebundle();
|
||||
});
|
||||
|
||||
gulp.task('default', ['watch']);
|
||||
lilaGulp('LichessSimul', 'lichess.simul', __dirname);
|
||||
|
|
|
@ -19,13 +19,14 @@
|
|||
},
|
||||
"homepage": "https://github.com/ornicar/lila",
|
||||
"devDependencies": {
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-streamify": "^1",
|
||||
"browserify": "^16",
|
||||
"gulp": "^4",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"gulp-size": "^3",
|
||||
"fancy-log": "^1",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^1",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"watchify": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,91 +1,85 @@
|
|||
const source = require('vinyl-source-stream');
|
||||
const gulp = require('gulp');
|
||||
const gutil = require('gulp-util');
|
||||
const source = require('vinyl-source-stream');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const colors = require('ansi-colors');
|
||||
const logger = require('fancy-log');
|
||||
const watchify = require('watchify');
|
||||
const browserify = require('browserify');
|
||||
const tsify = require('tsify');
|
||||
const uglify = require('gulp-uglify');
|
||||
const streamify = require('gulp-streamify');
|
||||
const size = require('gulp-size');
|
||||
const tsify = require('tsify');
|
||||
const concat = require('gulp-concat');
|
||||
const exec = require('child_process').exec;
|
||||
const fs = require('fs');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
const standalone = 'Lichess';
|
||||
const browserifyOpts = (entries, debug) => ({
|
||||
entries: entries,
|
||||
standalone: 'Lichess',
|
||||
debug: debug
|
||||
});
|
||||
const destination = () => gulp.dest('../../public/compiled/');
|
||||
const fileBaseName = 'lichess.site';
|
||||
|
||||
const abFile = process.env.LILA_AB_FILE;
|
||||
|
||||
gulp.task('jquery-fill', function() {
|
||||
return gulp.src('src/jquery.fill.js')
|
||||
.pipe(streamify(uglify()))
|
||||
const jqueryFill = () => gulp.src('src/jquery.fill.js')
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('./dist'));
|
||||
|
||||
const ab = () => {
|
||||
if (abFile) return gulp.src(abFile)
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('./dist'));
|
||||
});
|
||||
else {
|
||||
logger.info(colors.yellow('Building without AB file'));
|
||||
return gulp.src('.');
|
||||
}
|
||||
};
|
||||
|
||||
gulp.task('ab', function() {
|
||||
if (abFile) {
|
||||
return gulp.src(abFile)
|
||||
.pipe(streamify(uglify()))
|
||||
.pipe(gulp.dest('./dist'));
|
||||
} else {
|
||||
gutil.log(gutil.colors.yellow('Building without AB file'));
|
||||
return gulp.src('.').pipe(gutil.noop());
|
||||
}
|
||||
});
|
||||
|
||||
gulp.task('stockfish.pexe', function() {
|
||||
gulp.src([
|
||||
const stockfishPexe = () => gulp.src([
|
||||
require.resolve('stockfish.pexe/stockfish.nmf'),
|
||||
require.resolve('stockfish.pexe/stockfish.pexe'),
|
||||
require.resolve('stockfish.pexe/stockfish.bc')
|
||||
]).pipe(gulp.dest('../../public/vendor/stockfish.pexe'));
|
||||
});
|
||||
|
||||
gulp.task('stockfish.js', function(cb) {
|
||||
gulp.src([
|
||||
const stockfishJs = () => gulp.src([
|
||||
require.resolve('stockfish.js/stockfish.wasm.js'),
|
||||
require.resolve('stockfish.js/stockfish.wasm'),
|
||||
require.resolve('stockfish.js/stockfish.js')
|
||||
]).pipe(gulp.dest('../../public/vendor/stockfish.js'));
|
||||
});
|
||||
|
||||
gulp.task('stockfish.wasm', function() {
|
||||
gulp.src([
|
||||
const stockfishWasm = () => gulp.src([
|
||||
require.resolve('stockfish.wasm/stockfish.js'),
|
||||
require.resolve('stockfish.wasm/stockfish.js.mem'),
|
||||
require.resolve('stockfish.wasm/stockfish.wasm'),
|
||||
require.resolve('stockfish.wasm/pthread-main.js')
|
||||
]).pipe(gulp.dest('../../public/vendor/stockfish.wasm/'));
|
||||
});
|
||||
|
||||
gulp.task('stockfish-mv.wasm', function() {
|
||||
gulp.src([
|
||||
const stockfishMvWasm = () => gulp.src([
|
||||
require.resolve('stockfish-mv.wasm/stockfish.js'),
|
||||
require.resolve('stockfish-mv.wasm/stockfish.js.mem'),
|
||||
require.resolve('stockfish-mv.wasm/stockfish.wasm'),
|
||||
require.resolve('stockfish-mv.wasm/pthread-main.js')
|
||||
]).pipe(gulp.dest('../../public/vendor/stockfish-mv.wasm/'));
|
||||
});
|
||||
|
||||
gulp.task('prod-source', function() {
|
||||
return browserify('src/index.ts', {
|
||||
standalone: standalone
|
||||
}).plugin(tsify)
|
||||
.bundle()
|
||||
.pipe(source('lichess.site.source.min.js'))
|
||||
.pipe(streamify(uglify()))
|
||||
.pipe(gulp.dest('./dist'));
|
||||
});
|
||||
const prodSource = () => browserify(browserifyOpts('src/index.ts', false))
|
||||
.plugin(tsify)
|
||||
.bundle()
|
||||
.pipe(source(`${fileBaseName}.source.min.js`))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('./dist'));
|
||||
|
||||
gulp.task('dev-source', function() {
|
||||
return browserify('src/index.ts', {
|
||||
standalone: standalone
|
||||
}).plugin(tsify)
|
||||
.bundle()
|
||||
.pipe(source('lichess.site.source.js'))
|
||||
.pipe(gulp.dest('./dist'));
|
||||
});
|
||||
const devSource = () => browserify(browserifyOpts('src/index.ts', true))
|
||||
.plugin(tsify)
|
||||
.bundle()
|
||||
.pipe(source(`${fileBaseName}.source.js`))
|
||||
.pipe(gulp.dest('./dist'));
|
||||
|
||||
function makeBundle(filename) {
|
||||
return function() {
|
||||
return function bundleItAll() {
|
||||
return gulp.src([
|
||||
'../../public/javascripts/vendor/jquery.min.js',
|
||||
'./dist/jquery.fill.js',
|
||||
|
@ -98,54 +92,45 @@ function makeBundle(filename) {
|
|||
'./dist/consolemsg.js'
|
||||
])
|
||||
.pipe(concat(filename.replace('source.', '')))
|
||||
.pipe(gulp.dest(destination));
|
||||
.pipe(destination());
|
||||
};
|
||||
}
|
||||
|
||||
gulp.task('git-sha', function(cb) {
|
||||
exec("git rev-parse -q --short HEAD", function (err, stdout) {
|
||||
if (err) throw err;
|
||||
if (!fs.existsSync('./dist')) fs.mkdirSync('./dist');
|
||||
var date = new Date().toISOString().split('.')[0];
|
||||
fs.writeFileSync('./dist/consolemsg.js',
|
||||
'console.info("Lichess is open source! https://github.com/ornicar/lila");' +
|
||||
`lichess.info = "Assets built ${date} from sha ${stdout.trim()}";`);
|
||||
cb();
|
||||
});
|
||||
const gitSha = (cb) => exec("git rev-parse -q --short HEAD", function (err, stdout) {
|
||||
if (err) throw err;
|
||||
if (!fs.existsSync('./dist')) fs.mkdirSync('./dist');
|
||||
var date = new Date().toISOString().split('.')[0];
|
||||
fs.writeFileSync('./dist/consolemsg.js',
|
||||
'console.info("Lichess is open source! https://github.com/ornicar/lila");' +
|
||||
`lichess.info = "Assets built ${date} from sha ${stdout.trim()}";`);
|
||||
cb();
|
||||
});
|
||||
|
||||
gulp.task('standalones', function() {
|
||||
return gulp.src([
|
||||
'src/standalones/util.js',
|
||||
'src/standalones/trans.js',
|
||||
'src/standalones/tv.js',
|
||||
'src/standalones/puzzle.js',
|
||||
'src/standalones/user.js',
|
||||
'src/standalones/coordinate.js'
|
||||
])
|
||||
.pipe(streamify(uglify()))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
const standaloneFiles = [
|
||||
'src/standalones/util.js',
|
||||
'src/standalones/trans.js',
|
||||
'src/standalones/tv.js',
|
||||
'src/standalones/puzzle.js',
|
||||
'src/standalones/user.js',
|
||||
'src/standalones/coordinate.js'
|
||||
];
|
||||
|
||||
gulp.task('user-mod', function() {
|
||||
return browserify([
|
||||
'./src/user-mod.js'
|
||||
], {
|
||||
standalone: standalone
|
||||
}).bundle()
|
||||
.pipe(source('user-mod.js'))
|
||||
.pipe(streamify(uglify()))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
const standalones = () => gulp.src(standaloneFiles)
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(destination());
|
||||
|
||||
const tasks = ['git-sha', 'jquery-fill', 'ab', 'standalones', 'user-mod', 'stockfish.wasm', 'stockfish-mv.wasm', 'stockfish.pexe', 'stockfish.js'];
|
||||
const userMod = () => browserify(browserifyOpts('./src/user-mod.js', false))
|
||||
.bundle()
|
||||
.pipe(source('user-mod.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(destination());
|
||||
|
||||
gulp.task('dev', tasks.concat(['dev-source']), makeBundle('lichess.site.source.js'));
|
||||
gulp.task('prod', tasks.concat(['prod-source']), makeBundle('lichess.site.source.min.js'));
|
||||
const tasks = [gitSha, jqueryFill, ab, standalones, userMod, stockfishWasm, stockfishMvWasm, stockfishPexe, stockfishJs];
|
||||
|
||||
gulp.task('watch', ['git-sha', 'jquery-fill', 'ab', 'standalones', 'user-mod', 'dev-source'],
|
||||
makeBundle('lichess.site.source.js'));
|
||||
const dev = gulp.series(tasks.concat([devSource, makeBundle(`${fileBaseName}.source.js`)]));
|
||||
|
||||
gulp.task('default', ['watch'], function() {
|
||||
return gulp.watch('src/*.js', ['watch']);
|
||||
});
|
||||
gulp.task('prod', gulp.series(tasks.concat([prodSource, makeBundle(`${fileBaseName}.source.min.js`)])));
|
||||
gulp.task('dev', dev);
|
||||
gulp.task('default', gulp.series(dev, () => gulp.watch('src/*.js', dev)));
|
||||
|
|
|
@ -9,15 +9,19 @@
|
|||
"author": "Thibault Duplessis",
|
||||
"license": "AGPL-3.0",
|
||||
"devDependencies": {
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-concat": "^2.6",
|
||||
"gulp-streamify": "^1",
|
||||
"browserify": "^16",
|
||||
"gulp": "^4",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"gulp-size": "^3",
|
||||
"gulp-concat": "^2.6",
|
||||
"fancy-log": "^1",
|
||||
"tsify": "^4.0.0",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^1"
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"watchify": "^3",
|
||||
"request": "^2",
|
||||
"gulp-download-stream": "^0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"stockfish-mv.wasm": "^0.2.0",
|
||||
|
@ -25,5 +29,5 @@
|
|||
"stockfish.pexe": "^9.0.0",
|
||||
"stockfish.wasm": "^0.2.0",
|
||||
"tablesort": "^5.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,54 +1,3 @@
|
|||
const gulp = require('gulp');
|
||||
const gutil = require('gulp-util');
|
||||
const watchify = require('watchify');
|
||||
const browserify = require('browserify');
|
||||
const uglify = require('gulp-uglify');
|
||||
const source = require('vinyl-source-stream');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const tsify = require('tsify');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
|
||||
function onError(error) {
|
||||
gutil.log(gutil.colors.red(error.message));
|
||||
}
|
||||
|
||||
function build() {
|
||||
return browserify('src/main.ts', {
|
||||
standalone: 'LichessTournament',
|
||||
debug: true
|
||||
})
|
||||
.plugin(tsify);
|
||||
}
|
||||
|
||||
const watchedBrowserify = watchify(build());
|
||||
|
||||
function bundle() {
|
||||
return watchedBrowserify
|
||||
.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.tournament.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
gulp.task('default', bundle);
|
||||
watchedBrowserify.on('update', bundle);
|
||||
watchedBrowserify.on('log', gutil.log);
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return build()
|
||||
.bundle()
|
||||
.pipe(source('lichess.tournament.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('prod', function() {
|
||||
return build()
|
||||
.bundle()
|
||||
.pipe(source('lichess.tournament.min.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
const lilaGulp = require('../gulp/tsProject.js');
|
||||
|
||||
lilaGulp('LichessTournament', 'lichess.tournament', __dirname);
|
||||
|
|
|
@ -21,14 +21,16 @@
|
|||
"devDependencies": {
|
||||
"@types/jquery": "^2.0",
|
||||
"@types/lichess": "1.0.0",
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"browserify": "^16",
|
||||
"fancy-log": "^1",
|
||||
"gulp": "^4",
|
||||
"gulp-size": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"tsify": "^3",
|
||||
"typescript": "^2",
|
||||
"tsify": "^4",
|
||||
"typescript": "^3",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"vinyl-source-stream": "^1",
|
||||
"watchify": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,53 +1,3 @@
|
|||
const gulp = require('gulp');
|
||||
const gutil = require('gulp-util');
|
||||
const watchify = require('watchify');
|
||||
const browserify = require('browserify');
|
||||
const uglify = require('gulp-uglify');
|
||||
const source = require('vinyl-source-stream');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const tsify = require('tsify');
|
||||
const lilaGulp = require('../gulp/tsProject.js');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
|
||||
function onError(error) {
|
||||
gutil.log(gutil.colors.red(error.message));
|
||||
}
|
||||
|
||||
function build() {
|
||||
return browserify('src/main.ts', {
|
||||
standalone: 'LichessTournamentCalendar',
|
||||
debug: true
|
||||
})
|
||||
.plugin(tsify);
|
||||
}
|
||||
|
||||
const watchedBrowserify = watchify(build());
|
||||
|
||||
function bundle() {
|
||||
return watchedBrowserify
|
||||
.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.tournament-calendar.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
gulp.task('default', bundle);
|
||||
watchedBrowserify.on('update', bundle);
|
||||
watchedBrowserify.on('log', gutil.log);
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return build()
|
||||
.bundle()
|
||||
.pipe(source('lichess.tournament-calendar.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('prod', function() {
|
||||
return build()
|
||||
.bundle()
|
||||
.pipe(source('lichess.tournament-calendar.min.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
lilaGulp('LichessTournamentCalendar', 'lichess.tournament-calendar', __dirname);
|
||||
|
|
|
@ -21,15 +21,17 @@
|
|||
"homepage": "https://github.com/ornicar/lila",
|
||||
"devDependencies": {
|
||||
"@types/jquery": "^2.0",
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"tsify": "^3",
|
||||
"@types/lichess": "1.0.0",
|
||||
"typescript": "^2",
|
||||
"browserify": "^16",
|
||||
"fancy-log": "^1",
|
||||
"gulp": "^4",
|
||||
"gulp-size": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"tsify": "^4",
|
||||
"typescript": "^3",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"vinyl-source-stream": "^1",
|
||||
"watchify": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,53 +1,3 @@
|
|||
const gulp = require('gulp');
|
||||
const gutil = require('gulp-util');
|
||||
const watchify = require('watchify');
|
||||
const browserify = require('browserify');
|
||||
const uglify = require('gulp-uglify');
|
||||
const source = require('vinyl-source-stream');
|
||||
const buffer = require('vinyl-buffer');
|
||||
const tsify = require('tsify');
|
||||
const lilaGulp = require('../gulp/tsProject.js');
|
||||
|
||||
const destination = '../../public/compiled/';
|
||||
|
||||
function onError(error) {
|
||||
gutil.log(gutil.colors.red(error.message));
|
||||
}
|
||||
|
||||
function build() {
|
||||
return browserify('src/main.ts', {
|
||||
standalone: 'LichessTournamentSchedule',
|
||||
debug: true
|
||||
})
|
||||
.plugin(tsify);
|
||||
}
|
||||
|
||||
const watchedBrowserify = watchify(build());
|
||||
|
||||
function bundle() {
|
||||
return watchedBrowserify
|
||||
.bundle()
|
||||
.on('error', onError)
|
||||
.pipe(source('lichess.tournament-schedule.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(gulp.dest(destination));
|
||||
}
|
||||
|
||||
gulp.task('default', bundle);
|
||||
watchedBrowserify.on('update', bundle);
|
||||
watchedBrowserify.on('log', gutil.log);
|
||||
|
||||
gulp.task('dev', function() {
|
||||
return build()
|
||||
.bundle()
|
||||
.pipe(source('lichess.tournament-schedule.js'))
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
|
||||
gulp.task('prod', function() {
|
||||
return build()
|
||||
.bundle()
|
||||
.pipe(source('lichess.tournament-schedule.min.js'))
|
||||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destination));
|
||||
});
|
||||
lilaGulp('LichessTournamentSchedule', 'lichess.tournament-schedule', __dirname);
|
||||
|
|
|
@ -22,14 +22,16 @@
|
|||
"devDependencies": {
|
||||
"@types/jquery": "^2.0",
|
||||
"@types/lichess": "1.0.0",
|
||||
"browserify": "^14",
|
||||
"gulp": "^3",
|
||||
"browserify": "^16",
|
||||
"fancy-log": "^1",
|
||||
"gulp": "^4",
|
||||
"gulp-size": "^3",
|
||||
"gulp-uglify": "^3",
|
||||
"gulp-util": "^3",
|
||||
"tsify": "^3",
|
||||
"typescript": "^2",
|
||||
"tsify": "^4",
|
||||
"typescript": "^3",
|
||||
"uglify-js": "^3",
|
||||
"vinyl-source-stream": "^2",
|
||||
"vinyl-buffer": "^1",
|
||||
"vinyl-source-stream": "^1",
|
||||
"watchify": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/lichess": "1.0.0",
|
||||
"typescript": "^2"
|
||||
"typescript": "^3"
|
||||
},
|
||||
"dependencies": {
|
||||
"common": "1.0.0"
|
||||
|
|
Loading…
Reference in New Issue