more love
This commit is contained in:
1 parent
9cabb7c2cd
commit
80ddf2b010
10 files changed
+3328
-2394
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
image: "node:4.4.3"
|
image: "node:12.22.1"
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
# install ssh-agent
|
# install ssh-agent
|
||||||
|
|||||||
-20
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "phenix-website",
|
|
||||||
"description": "Main web site of Balle Phénix.",
|
|
||||||
"main": "index.html",
|
|
||||||
"authors": [
|
|
||||||
"didier amyot <didier.amyot@gmail.com>"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"moduleType": [],
|
|
||||||
"homepage": "",
|
|
||||||
"private": true,
|
|
||||||
"ignore": [
|
|
||||||
"**/.*",
|
|
||||||
"node_modules",
|
|
||||||
"bower_components",
|
|
||||||
"lib",
|
|
||||||
"test",
|
|
||||||
"tests"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
+56
-36
@@ -1,8 +1,9 @@
|
|||||||
var gulp = require('gulp');
|
var gulp = require('gulp');
|
||||||
|
const { series } = require('gulp');
|
||||||
var help = require('gulp-task-listing');
|
var help = require('gulp-task-listing');
|
||||||
var clean = require('gulp-clean');
|
var clean = require('gulp-clean');
|
||||||
var toml = require('gulp-toml');
|
var toml = require('gulp-toml');
|
||||||
var sass = require('gulp-sass');
|
var gulpSass = require('gulp-sass');
|
||||||
var rename = require("gulp-rename");
|
var rename = require("gulp-rename");
|
||||||
var yaml = require('gulp-yaml');
|
var yaml = require('gulp-yaml');
|
||||||
var template = require('gulp-template');
|
var template = require('gulp-template');
|
||||||
@@ -14,26 +15,26 @@ var modify = require('gulp-modify');
|
|||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
gulp.task('help', help);
|
exports.help = help;
|
||||||
|
|
||||||
|
|
||||||
gulp.task('sass', [], function(){
|
exports.sass = function sass(){
|
||||||
var extraSassPath = ['./node_modules/'];
|
var extraSassPath = ['./node_modules/'];
|
||||||
return gulp.src('./scss/*.scss')
|
return gulp.src('./scss/*.scss')
|
||||||
.pipe(sass({includePaths: extraSassPath}).on('error', console.log))
|
.pipe(gulpSass({includePaths: extraSassPath}).on('error', gulpSass.logError))
|
||||||
.pipe(gulp.dest('./css'));
|
.pipe(gulp.dest('./css'));
|
||||||
});
|
}
|
||||||
|
|
||||||
gulp.task('clean', function(){
|
exports.clean = function clean(){
|
||||||
return gulp.src(["lib/", "css/"], {read: false})
|
return gulp.src(["lib/", "css/"], {read: false})
|
||||||
.pipe(clean());
|
.pipe(clean());
|
||||||
});
|
}
|
||||||
|
|
||||||
gulp.task('compile-results', function(){
|
exports.compileResults = function compileResults(){
|
||||||
return gulp.src('data/*.yaml')
|
return gulp.src('data/*.yaml')
|
||||||
.pipe(yaml({safe: true}))
|
.pipe(yaml({safe: true}).on('error', console.log))
|
||||||
.pipe(gulp.dest('./api'));
|
.pipe(gulp.dest('./api'));
|
||||||
});
|
};
|
||||||
|
|
||||||
var encryptFile = function(message){
|
var encryptFile = function(message){
|
||||||
var keyLengthInBytes = 128;
|
var keyLengthInBytes = 128;
|
||||||
@@ -49,7 +50,7 @@ var wrapEncryptedData = function(encryptedData){
|
|||||||
return 'window.encryptedPlayerList = ' + encryptedData + ';';
|
return 'window.encryptedPlayerList = ' + encryptedData + ';';
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task('encrypt-results', ['compile-results'], function(){
|
exports.encryptResults = function encryptResults(){
|
||||||
return gulp.src('api/*.clear.json')
|
return gulp.src('api/*.clear.json')
|
||||||
.pipe(modify({
|
.pipe(modify({
|
||||||
fileModifier: function(file, content) {
|
fileModifier: function(file, content) {
|
||||||
@@ -62,7 +63,7 @@ gulp.task('encrypt-results', ['compile-results'], function(){
|
|||||||
return path;
|
return path;
|
||||||
}))
|
}))
|
||||||
.pipe(gulp.dest('./api'));
|
.pipe(gulp.dest('./api'));
|
||||||
});
|
};
|
||||||
|
|
||||||
function getAvailableYears(files) {
|
function getAvailableYears(files) {
|
||||||
var rgx = /^resultats(\d*).yaml/;
|
var rgx = /^resultats(\d*).yaml/;
|
||||||
@@ -74,7 +75,7 @@ function getAvailableYears(files) {
|
|||||||
.sort();
|
.sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task('template-prod', function () {
|
exports.templateProd = function templateProd() {
|
||||||
var dataFiles = fs.readdirSync('./data');
|
var dataFiles = fs.readdirSync('./data');
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
@@ -86,22 +87,23 @@ gulp.task('template-prod', function () {
|
|||||||
.pipe(rename("index.html"))
|
.pipe(rename("index.html"))
|
||||||
.pipe(template(data))
|
.pipe(template(data))
|
||||||
.pipe(gulp.dest('.'));
|
.pipe(gulp.dest('.'));
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task('template-dev', function () {
|
exports.templateDev = function templateDev() {
|
||||||
var dataFiles = fs.readdirSync('./data');
|
var dataFiles = fs.readdirSync('./data');
|
||||||
var data = {
|
var data = {
|
||||||
availableYears: JSON.stringify(getAvailableYears(dataFiles)),
|
availableYears: JSON.stringify(getAvailableYears(dataFiles)),
|
||||||
production: false,
|
production: false,
|
||||||
salt: 'salt',
|
salt: 'salt',
|
||||||
playerListLocation: 'api/players.spritz.js'}
|
playerListLocation: 'api/players.spritz.js'}
|
||||||
|
console.log(data);
|
||||||
return gulp.src('index.tmpl.html')
|
return gulp.src('index.tmpl.html')
|
||||||
.pipe(rename("index.html"))
|
.pipe(rename("index.html"))
|
||||||
.pipe(template(data))
|
.pipe(template(data))
|
||||||
.pipe(gulp.dest('.'));
|
.pipe(gulp.dest('.'));
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task('compile-articles', function(){
|
exports.compileArticles = function compileArticles(){
|
||||||
|
|
||||||
var transformArticle = function(article){
|
var transformArticle = function(article){
|
||||||
var isMarkdownKey = /markdown/i;
|
var isMarkdownKey = /markdown/i;
|
||||||
@@ -115,7 +117,7 @@ gulp.task('compile-articles', function(){
|
|||||||
return JSON.stringify(article, null, 4);
|
return JSON.stringify(article, null, 4);
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.src('data/articles/**/*.toml.md')
|
return gulp.src('data/articles/**/*.toml.md')
|
||||||
.pipe(toml({to: transformArticle}))
|
.pipe(toml({to: transformArticle}))
|
||||||
.pipe(wrapper({
|
.pipe(wrapper({
|
||||||
header: "define(['m', '_'], function (m, _ ) {\nreturn ",
|
header: "define(['m', '_'], function (m, _ ) {\nreturn ",
|
||||||
@@ -127,26 +129,44 @@ gulp.task('compile-articles', function(){
|
|||||||
return path;
|
return path;
|
||||||
}))
|
}))
|
||||||
.pipe(gulp.dest('./script/articles/'));
|
.pipe(gulp.dest('./script/articles/'));
|
||||||
|
};
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('default', ['sass', 'encrypt-results', 'compile-results', 'compile-articles']);
|
exports.base = series(
|
||||||
|
exports.sass,
|
||||||
|
exports.compileResults,
|
||||||
|
exports.compileArticles,
|
||||||
|
exports.encryptResults
|
||||||
|
|
||||||
gulp.task('prod', ['default', 'template-prod']);
|
);
|
||||||
|
|
||||||
gulp.task('webserver', function(){
|
exports.prod = series(
|
||||||
return gulp.src('.')
|
exports.base,
|
||||||
.pipe(webserver({
|
exports.templateProd
|
||||||
host: '0.0.0.0',
|
);
|
||||||
port: 4321,
|
|
||||||
livereload: false,
|
|
||||||
directoryListing: false,
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('dev', ['default', 'webserver', 'template-dev'], function(){
|
exports.dev = series(
|
||||||
gulp.watch('./scss/*.scss', ['sass']);
|
exports.base,
|
||||||
gulp.watch('*.tmpl.html', ['template-dev']);
|
exports.templateDev
|
||||||
gulp.watch('./data/articles/**/*', ['compile-articles']);
|
);
|
||||||
return gulp.watch('./data/*.yaml', ['encrypt-results', 'compile-results']);
|
|
||||||
});
|
// gulp.task('default', ['sass', 'encrypt-results', 'compile-results', 'compile-articles']);
|
||||||
|
|
||||||
|
// gulp.task('prod', ['default', 'template-prod']);
|
||||||
|
|
||||||
|
// gulp.task('webserver', function(){
|
||||||
|
// return gulp.src('.')
|
||||||
|
// .pipe(webserver({
|
||||||
|
// host: '0.0.0.0',
|
||||||
|
// port: 4321,
|
||||||
|
// livereload: false,
|
||||||
|
// directoryListing: false,
|
||||||
|
// }));
|
||||||
|
// });
|
||||||
|
|
||||||
|
// gulp.task('dev', ['default', 'webserver', 'template-dev'], function(){
|
||||||
|
// gulp.watch('./scss/*.scss', ['sass']);
|
||||||
|
// gulp.watch('*.tmpl.html', ['template-dev']);
|
||||||
|
// gulp.watch('./data/articles/**/*', ['compile-articles']);
|
||||||
|
// return gulp.watch('./data/*.yaml', ['encrypt-results', 'compile-results']);
|
||||||
|
// });
|
||||||
Generated
+3222
-2303
File diff suppressed because it is too large.
Load diff
+16
-19
@@ -4,27 +4,24 @@
|
|||||||
"description": "Main web site of Balle Phénix.",
|
"description": "Main web site of Balle Phénix.",
|
||||||
"main": "index.html",
|
"main": "index.html",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"gulp": "^3.9.0",
|
"almond": "^0.3.3",
|
||||||
"gulp-clean": "^0.3.1",
|
"gulp": "^4.0.2",
|
||||||
|
"gulp-clean": "^0.4.0",
|
||||||
"gulp-modify": "^0.1.1",
|
"gulp-modify": "^0.1.1",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^2.0.0",
|
||||||
"gulp-sass": "^2.1.1",
|
"gulp-sass": "^4.1.0",
|
||||||
"gulp-task-listing": "^1.0.1",
|
"gulp-task-listing": "^1.1.0",
|
||||||
"gulp-template": "^3.1.0",
|
"gulp-template": "^5.0.0",
|
||||||
"gulp-toml": "^0.1.1",
|
"gulp-toml": "^0.2.0",
|
||||||
"gulp-wrap": "^0.11.0",
|
|
||||||
"gulp-wrapper": "^1.0.0",
|
|
||||||
"lodash": "^4.6.1",
|
|
||||||
"marked": "^0.3.5",
|
|
||||||
"requirejs": "~2.1.22",
|
|
||||||
"uikit": "2.27.2",
|
|
||||||
"mithril": "~0.2.1",
|
|
||||||
"almond": "~0.3.1",
|
|
||||||
"spritzjs": "https://gitlab.com/didiercrunch/spritzjs.git"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"gulp-webserver": "^0.9.1",
|
"gulp-webserver": "^0.9.1",
|
||||||
"gulp-yaml": "^1.0.1"
|
"gulp-wrapper": "^1.0.0",
|
||||||
|
"gulp-yaml": "^2.0.4",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"marked": "^2.0.7",
|
||||||
|
"mithril": "^0.2.5",
|
||||||
|
"requirejs": "^2.3.6",
|
||||||
|
"spritzjs": "https://gitlab.com/didiercrunch/spritzjs.git",
|
||||||
|
"uikit": "^2.27.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
define(['m', '_'], function (m, _ ) {
|
define(['m', '_'], function (m, _ ) {
|
||||||
return {
|
return {
|
||||||
"title": {
|
"title": {
|
||||||
"innerMarkdown": "<h2 id=\"d-but-saison-2017-retard-e\">Début saison 2017 retardée</h2>\n"
|
"innerMarkdown": "<h2 id=\"début-saison-2017-retardée\">Début saison 2017 retardée</h2>\n"
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"innerMarkdown": "<p>Samedi 23 avril 2017</p>\n"
|
"innerMarkdown": "<p>Samedi 23 avril 2017</p>\n"
|
||||||
|
|||||||
+26
-3
@@ -56,9 +56,32 @@ define(['m'], function(m) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
util.resultatsURL = function(){
|
util.resultatsURL = function(year){
|
||||||
var cacheBuster = 2;
|
var cacheBuster = window.Date.now();
|
||||||
return "api/resultats.json?_=" + cacheBuster;
|
year = !!year ? year: util.getDefaultYear();
|
||||||
|
return "api/resultats" + year + ".json?_=" + cacheBuster;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
util.getAvailableYears = function(){
|
||||||
|
if(window.availableYears){
|
||||||
|
return _.clone(window.availableYears)
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
};
|
||||||
|
|
||||||
|
util.getDefaultYear = function(){
|
||||||
|
return _.max(util.getAvailableYears());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
util.getResults = function(year){
|
||||||
|
var url = util.resultatsURL(year);
|
||||||
|
return m.request({method: "GET", url: url})
|
||||||
|
};
|
||||||
|
|
||||||
|
util.getDefaultResults = function(){
|
||||||
|
return util.getResults(util.getDefaultYear());
|
||||||
};
|
};
|
||||||
|
|
||||||
return util;
|
return util;
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ define(['m', '_', 'util', 'resultParser', 'teams', 'views/topNavBar', 'views/foo
|
|||||||
|
|
||||||
statsView.controller = function(year){
|
statsView.controller = function(year){
|
||||||
var games = m.prop([]);
|
var games = m.prop([]);
|
||||||
var url = "api/resultats" + year + ".json";
|
return util.getResults(year)
|
||||||
return m.request({method: "GET", url: url})
|
|
||||||
.then(games)
|
.then(games)
|
||||||
.then(resultParser.getStats);
|
.then(resultParser.getStats);
|
||||||
};
|
};
|
||||||
@@ -121,8 +120,7 @@ define(['m', '_', 'util', 'resultParser', 'teams', 'views/topNavBar', 'views/foo
|
|||||||
|
|
||||||
schedulView.controller = function(year){
|
schedulView.controller = function(year){
|
||||||
var games = m.prop([]);
|
var games = m.prop([]);
|
||||||
var url = "api/resultats" + year + ".json"
|
return util.getResults(year)
|
||||||
return m.request({method: "GET", url: url})
|
|
||||||
.then(games)
|
.then(games)
|
||||||
.then(resultParser.getNightGames);
|
.then(resultParser.getNightGames);
|
||||||
};
|
};
|
||||||
@@ -179,8 +177,9 @@ define(['m', '_', 'util', 'resultParser', 'teams', 'views/topNavBar', 'views/foo
|
|||||||
|
|
||||||
calendarPage.view = function(vnode){
|
calendarPage.view = function(vnode){
|
||||||
var isPlayoff = window.location.hash.endsWith('playoff');
|
var isPlayoff = window.location.hash.endsWith('playoff');
|
||||||
var year = _.get(m.route.param(), 'year', '');
|
var availableYears = util.getAvailableYears();
|
||||||
var availableYears = window.availableYears || [];
|
var year = _.get(m.route.param(), 'year', util.getDefaultYear());
|
||||||
|
|
||||||
var main = isPlayoff ? m.component(playoffView) : m.component(schedulView, year, availableYears);
|
var main = isPlayoff ? m.component(playoffView) : m.component(schedulView, year, availableYears);
|
||||||
return [m.component(topNavBar),
|
return [m.component(topNavBar),
|
||||||
m('div.uk-grid.uk-margin-top.uk-margin-bottom',
|
m('div.uk-grid.uk-margin-top.uk-margin-bottom',
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ define(['m', '_', 'util', 'resultParser', 'views/topNavBar', 'views/footer', 'ar
|
|||||||
|
|
||||||
nextGameDaySchedule.controller = function(){
|
nextGameDaySchedule.controller = function(){
|
||||||
var games = m.prop([]);
|
var games = m.prop([]);
|
||||||
var toDay = new Date();
|
return util.getDefaultResults()
|
||||||
return m.request({method: "GET", url: util.resultatsURL()})
|
|
||||||
.then(games)
|
.then(games)
|
||||||
.then(resultParser.getNightGames)
|
.then(resultParser.getNightGames)
|
||||||
.then(function(nightGames){
|
.then(function(nightGames){
|
||||||
|
|||||||
Reference in new issue
Block a user