mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-01-17 13:18:19 +01:00
Updates build process.
This commit is contained in:
parent
6d188f1271
commit
07fcb40aab
228
makefile.js
228
makefile.js
@ -2,10 +2,9 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
var path = require('path');
|
||||
var path = require('path'),
|
||||
|
||||
|
||||
var version = '0.22-dev',
|
||||
pkg = require('./package.json'),
|
||||
|
||||
root = path.resolve(__dirname),
|
||||
src = path.join(root, 'src'),
|
||||
@ -33,14 +32,18 @@ var version = '0.22-dev',
|
||||
]
|
||||
},
|
||||
|
||||
mapper = function (blob) {
|
||||
handlebarsEnv = {
|
||||
pkg: pkg
|
||||
},
|
||||
|
||||
mapSrc = function (blob) {
|
||||
|
||||
return blob.source.replace(src, build).replace(/\.less$/, '.css').replace(/\.jade$/, '');
|
||||
},
|
||||
|
||||
mapperRoot = function (blob) {
|
||||
mapRoot = function (blob) {
|
||||
|
||||
return blob.source.replace(root, build + '/_h5ai');
|
||||
return blob.source.replace(root, path.join(build, '_h5ai'));
|
||||
};
|
||||
|
||||
|
||||
@ -48,136 +51,119 @@ module.exports = function (make) {
|
||||
|
||||
var Event = make.Event,
|
||||
$ = make.fQuery,
|
||||
moment = make.moment,
|
||||
stamp, replacements;
|
||||
moment = make.moment;
|
||||
|
||||
|
||||
make.version('>=0.8');
|
||||
make.defaults('build');
|
||||
|
||||
|
||||
make.before(function () {
|
||||
|
||||
stamp = moment();
|
||||
handlebarsEnv.stamp = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
});
|
||||
|
||||
replacements = {
|
||||
version: version,
|
||||
stamp: stamp.format('YYYY-MM-DD HH:mm:ss')
|
||||
};
|
||||
|
||||
Event.info({
|
||||
method: 'before',
|
||||
message: version + ' ' + replacements.stamp
|
||||
make.target('check-version', [], 'add git info to dev builds').async(function (done, fail) {
|
||||
|
||||
if (!/-dev$/.test(pkg.version)) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
$.git(root, function (err, result) {
|
||||
|
||||
pkg.version += '-' + result.revListMasterHead.length + '-' + result.revParseHead.slice(0, 7);
|
||||
Event.info({
|
||||
method: 'check-version',
|
||||
message: 'version set to ' + pkg.version
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
make.target('check-version', [], 'add git hash tag for dev builds')
|
||||
.async(function (done, fail) {
|
||||
make.target('clean', [], 'delete build folder').sync(function () {
|
||||
|
||||
if (!/-dev$/.test(version)) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
$.rmfr($.I_AM_SURE, build);
|
||||
});
|
||||
|
||||
$.githash(root, function (err, hash) {
|
||||
|
||||
version += '-' + hash;
|
||||
replacements.version = version;
|
||||
Event.info({
|
||||
method: 'check-version',
|
||||
message: 'version set to ' + version
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
make.target('clean', [], 'delete build folder')
|
||||
.sync(function () {
|
||||
|
||||
$.rmfr($.I_AM_SURE, build);
|
||||
});
|
||||
|
||||
|
||||
make.target('lint', [], 'lint all JavaScript files with JSHint')
|
||||
.sync(function () {
|
||||
|
||||
$(src + '/_h5ai/js: **/*.js, ! lib/**')
|
||||
.jshint(jshint);
|
||||
});
|
||||
|
||||
|
||||
make.target('build', ['check-version'], 'build all updated files')
|
||||
.sync(function () {
|
||||
|
||||
$(src + ': _h5ai/js/*.js')
|
||||
.modified(mapper, $(src + ': _h5ai/js/**'))
|
||||
.includify()
|
||||
.uglifyjs()
|
||||
.write($.OVERWRITE, mapper);
|
||||
|
||||
$(src + ': _h5ai/css/*.less')
|
||||
.modified(mapper, $(src + ': _h5ai/css/**'))
|
||||
.less()
|
||||
.cssmin()
|
||||
.write($.OVERWRITE, mapper);
|
||||
|
||||
$(src + ': **/*.jade')
|
||||
.modified(mapper)
|
||||
.handlebars(replacements)
|
||||
.jade()
|
||||
.write($.OVERWRITE, mapper);
|
||||
|
||||
$(src + ': **, ! _h5ai/js/**, ! _h5ai/css/**, ! **/*.jade')
|
||||
.modified(mapper)
|
||||
.handlebars(replacements)
|
||||
.write($.OVERWRITE, mapper);
|
||||
|
||||
$(root + ': README*, LICENSE*')
|
||||
.modified(mapperRoot)
|
||||
.write($.OVERWRITE, mapperRoot);
|
||||
});
|
||||
|
||||
|
||||
make.target('build-uncompressed', ['check-version'], 'build all updated files without compression')
|
||||
.sync(function () {
|
||||
|
||||
$(src + ': _h5ai/js/*.js')
|
||||
.modified(mapper, $(src + ': _h5ai/js/**'))
|
||||
.includify()
|
||||
// .uglifyjs()
|
||||
.write($.OVERWRITE, mapper);
|
||||
|
||||
$(src + ': _h5ai/css/*.less')
|
||||
.modified(mapper, $(src + ': _h5ai/css/**'))
|
||||
.less()
|
||||
// .cssmin()
|
||||
.write($.OVERWRITE, mapper);
|
||||
|
||||
$(src + ': **/*.jade')
|
||||
.modified(mapper)
|
||||
.handlebars(replacements)
|
||||
.jade()
|
||||
.write($.OVERWRITE, mapper);
|
||||
|
||||
$(src + ': **, ! _h5ai/js/**, ! _h5ai/css/**, ! **/*.jade')
|
||||
.modified(mapper)
|
||||
.handlebars(replacements)
|
||||
.write($.OVERWRITE, mapper);
|
||||
|
||||
$(root + ': README*, LICENSE*')
|
||||
.modified(mapperRoot)
|
||||
.write($.OVERWRITE, mapperRoot);
|
||||
});
|
||||
|
||||
|
||||
make.target('release', ['clean', 'build'], 'create a zipball')
|
||||
.async(function (done, fail) {
|
||||
|
||||
$(build + ': _h5ai/**').shzip({
|
||||
target: path.join(build, 'h5ai-' + version + '.zip'),
|
||||
dir: build,
|
||||
callback: done
|
||||
});
|
||||
make.target('lint', [], 'lint all JavaScript files with JSHint').sync(function () {
|
||||
|
||||
$(path.join(src, '_h5ai', 'js') + ': **/*.js, ! lib/**')
|
||||
.jshint(jshint);
|
||||
});
|
||||
|
||||
|
||||
make.target('build', ['check-version'], 'build all updated files').sync(function () {
|
||||
|
||||
$(src + ': _h5ai/js/*.js')
|
||||
.modified(mapSrc, $(src + ': _h5ai/js/**'))
|
||||
.includify()
|
||||
.uglifyjs()
|
||||
.write($.OVERWRITE, mapSrc);
|
||||
|
||||
$(src + ': _h5ai/css/*.less')
|
||||
.modified(mapSrc, $(src + ': _h5ai/css/**'))
|
||||
.less()
|
||||
.cssmin()
|
||||
.write($.OVERWRITE, mapSrc);
|
||||
|
||||
$(src + ': **/*.jade')
|
||||
.modified(mapSrc)
|
||||
.handlebars(handlebarsEnv)
|
||||
.jade()
|
||||
.write($.OVERWRITE, mapSrc);
|
||||
|
||||
$(src + ': **, ! _h5ai/js/**, ! _h5ai/css/**, ! **/*.jade')
|
||||
.modified(mapSrc)
|
||||
.handlebars(handlebarsEnv)
|
||||
.write($.OVERWRITE, mapSrc);
|
||||
|
||||
$(root + ': README*, LICENSE*')
|
||||
.modified(mapRoot)
|
||||
.write($.OVERWRITE, mapRoot);
|
||||
});
|
||||
|
||||
|
||||
make.target('build-uncompressed', ['check-version'], 'build all updated files without compression').sync(function () {
|
||||
|
||||
$(src + ': _h5ai/js/*.js')
|
||||
.modified(mapSrc, $(src + ': _h5ai/js/**'))
|
||||
.includify()
|
||||
// .uglifyjs()
|
||||
.write($.OVERWRITE, mapSrc);
|
||||
|
||||
$(src + ': _h5ai/css/*.less')
|
||||
.modified(mapSrc, $(src + ': _h5ai/css/**'))
|
||||
.less()
|
||||
// .cssmin()
|
||||
.write($.OVERWRITE, mapSrc);
|
||||
|
||||
$(src + ': **/*.jade')
|
||||
.modified(mapSrc)
|
||||
.handlebars(handlebarsEnv)
|
||||
.jade()
|
||||
.write($.OVERWRITE, mapSrc);
|
||||
|
||||
$(src + ': **, ! _h5ai/js/**, ! _h5ai/css/**, ! **/*.jade')
|
||||
.modified(mapSrc)
|
||||
.handlebars(handlebarsEnv)
|
||||
.write($.OVERWRITE, mapSrc);
|
||||
|
||||
$(root + ': README*, LICENSE*')
|
||||
.modified(mapRoot)
|
||||
.write($.OVERWRITE, mapRoot);
|
||||
});
|
||||
|
||||
|
||||
make.target('release', ['clean', 'build'], 'create a zipball').async(function (done, fail) {
|
||||
|
||||
$(build + ': _h5ai/**').shzip({
|
||||
target: path.join(build, 'h5ai-' + pkg.version + '.zip'),
|
||||
dir: build,
|
||||
callback: done
|
||||
});
|
||||
});
|
||||
};
|
||||
|
12
package.json
Normal file
12
package.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "h5ai",
|
||||
"version": "0.22-dev",
|
||||
"description": "a modern HTTP web server index",
|
||||
"url": "http://larsjung.de/h5ai/",
|
||||
"author": "Lars Jung <lrsjng@gmail.com>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/lrsjng/h5ai.git"
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
################################
|
||||
# h5ai {{version}}
|
||||
# {{pkg.name}} {{pkg.version}}
|
||||
# customized .htaccess
|
||||
################################
|
||||
|
||||
@ -19,5 +19,5 @@ IndexOptions NameWidth=*
|
||||
IndexOptions SuppressDescription
|
||||
IndexOptions SuppressHTMLPreamble
|
||||
IndexOptions SuppressRules
|
||||
IndexOptions Type=text/html;h5ai={{version}}
|
||||
IndexOptions Type=text/html;h5ai={{pkg.version}}
|
||||
IndexOptions XHTML
|
||||
|
@ -11,8 +11,8 @@ doctype 5
|
||||
head
|
||||
meta( charset="utf-8" )
|
||||
meta( http-equiv="X-UA-Compatible", content="IE=edge,chrome=1" )
|
||||
title Directory index · styled with h5ai {{version}}
|
||||
meta( name="description", content="Directory index styled with h5ai {{version}} (http://larsjung.de/h5ai)" )
|
||||
title Directory index · styled with {{pkg.name}} {{pkg.version}}
|
||||
meta( name="description", content="Directory index styled with h5ai {{pkg.version}} (http://larsjung.de/h5ai)" )
|
||||
meta( name="viewport", content="width=device-width" )
|
||||
link( rel="shortcut icon", type="image/png", href!="#{h5ai}images/h5ai-16x16.png" )
|
||||
link( rel="apple-touch-icon", type="image/png", href!="#{h5ai}images/h5ai-48x48.png" )
|
||||
@ -30,7 +30,7 @@ div#content
|
||||
|
||||
div#bottombar.clearfix
|
||||
span.left
|
||||
a#h5ai-reference( href="http://larsjung.de/h5ai", title="h5ai project page" ) h5ai {{version}}
|
||||
a#h5ai-reference( href="http://larsjung.de/h5ai", title="h5ai project page" ) {{pkg.name}} {{pkg.version}}
|
||||
span.hideOnJs.noJsMsg ⚡ JavaScript is disabled! ⚡
|
||||
span.oldBrowser
|
||||
| ⚡ Some features disabled! Works best in
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
h5ai {{version}}
|
||||
{{pkg.name}} {{pkg.version}}
|
||||
|
||||
Configuration
|
||||
options, types and localization
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* h5ai {{version}}
|
||||
* {{pkg.name}} {{pkg.version}}
|
||||
*
|
||||
* PHP Configuration
|
||||
* filesystem paths and file ignore rules
|
||||
|
@ -8,7 +8,7 @@ html.no-js( lang="en" )
|
||||
head
|
||||
meta( charset="utf-8" )
|
||||
meta( http-equiv="X-UA-Compatible", content="IE=edge,chrome=1" )
|
||||
title h5ai {{version}} server details
|
||||
title {{pkg.name}} {{pkg.version}} server details
|
||||
meta( name="description", content="h5ai server details" )
|
||||
meta( name="viewport", content="width=device-width" )
|
||||
link( rel="shortcut icon", type="image/png", href="images/h5ai-16x16.png" )
|
||||
@ -19,8 +19,8 @@ html.no-js( lang="en" )
|
||||
|
||||
body#h5ai-info
|
||||
|
||||
h1 h5ai
|
||||
span.build-version version {{version}}
|
||||
h1 {{pkg.name}}
|
||||
span.build-version version {{pkg.version}}
|
||||
span.build-stamp {{stamp}}
|
||||
|
||||
h2 server supports
|
||||
@ -68,7 +68,7 @@ html.no-js( lang="en" )
|
||||
|
||||
div#bottombar.clearfix
|
||||
span.left
|
||||
a#h5ai-reference( href="http://larsjung.de/h5ai", title="h5ai project page" ) h5ai {{version}}
|
||||
a#h5ai-reference( href="http://larsjung.de/h5ai", title="h5ai project page" ) {{pkg.name}} {{pkg.version}}
|
||||
span.hideOnJs.noJsMsg ⚡ JavaScript is disabled! ⚡
|
||||
span.oldBrowser
|
||||
| ⚡ Some features disabled! Works best in
|
||||
|
@ -1,5 +1,5 @@
|
||||
|<?php
|
||||
| header("Content-type: text/html;h5ai={{version}}");
|
||||
| header("Content-type: text/html;h5ai={{pkg.version}}");
|
||||
| $h5ai_php = str_replace("\\", "/", dirname(__FILE__)) . "/inc/H5ai.php";
|
||||
| if (!file_exists($h5ai_php)) {
|
||||
| function find_h5ai($path, $h5ai) {
|
||||
@ -34,8 +34,8 @@ html.no-js( lang="en" )
|
||||
head
|
||||
meta( charset="utf-8" )
|
||||
meta( http-equiv="X-UA-Compatible", content="IE=edge,chrome=1" )
|
||||
title Directory index · styled with h5ai {{version}}
|
||||
meta( name="description", content="Directory index styled with h5ai {{version}} (http://larsjung.de/h5ai)" )
|
||||
title Directory index · styled with {{pkg.name}} {{pkg.version}}
|
||||
meta( name="description", content="Directory index styled with h5ai {{pkg.version}} (http://larsjung.de/h5ai)" )
|
||||
meta( name="viewport", content="width=device-width" )
|
||||
link( rel="shortcut icon", type="image/png", href!="#{h5ai}images/h5ai-16x16.png" )
|
||||
link( rel="apple-touch-icon", type="image/png", href!="#{h5ai}images/h5ai-48x48.png" )
|
||||
@ -53,7 +53,7 @@ html.no-js( lang="en" )
|
||||
|
||||
div#bottombar.clearfix
|
||||
span.left
|
||||
a#h5ai-reference( href="http://larsjung.de/h5ai", title="h5ai project page" ) h5ai {{version}}
|
||||
a#h5ai-reference( href="http://larsjung.de/h5ai", title="h5ai project page" ) {{pkg.name}} {{pkg.version}}
|
||||
span.hideOnJs.noJsMsg ⚡ JavaScript is disabled! ⚡
|
||||
span.oldBrowser
|
||||
| ⚡ Some features disabled! Works best in
|
||||
|
Loading…
x
Reference in New Issue
Block a user