mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 20:44:53 -04:00
Updates build process.
This commit is contained in:
parent
6d188f1271
commit
07fcb40aab
8 changed files with 134 additions and 136 deletions
228
makefile.js
228
makefile.js
|
@ -2,10 +2,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
var path = require('path');
|
var path = require('path'),
|
||||||
|
|
||||||
|
pkg = require('./package.json'),
|
||||||
var version = '0.22-dev',
|
|
||||||
|
|
||||||
root = path.resolve(__dirname),
|
root = path.resolve(__dirname),
|
||||||
src = path.join(root, 'src'),
|
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$/, '');
|
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,
|
var Event = make.Event,
|
||||||
$ = make.fQuery,
|
$ = make.fQuery,
|
||||||
moment = make.moment,
|
moment = make.moment;
|
||||||
stamp, replacements;
|
|
||||||
|
|
||||||
|
|
||||||
|
make.version('>=0.8');
|
||||||
make.defaults('build');
|
make.defaults('build');
|
||||||
|
|
||||||
|
|
||||||
make.before(function () {
|
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({
|
make.target('check-version', [], 'add git info to dev builds').async(function (done, fail) {
|
||||||
method: 'before',
|
|
||||||
message: version + ' ' + replacements.stamp
|
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')
|
make.target('clean', [], 'delete build folder').sync(function () {
|
||||||
.async(function (done, fail) {
|
|
||||||
|
|
||||||
if (!/-dev$/.test(version)) {
|
$.rmfr($.I_AM_SURE, build);
|
||||||
done();
|
});
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.githash(root, function (err, hash) {
|
|
||||||
|
|
||||||
version += '-' + hash;
|
make.target('lint', [], 'lint all JavaScript files with JSHint').sync(function () {
|
||||||
replacements.version = version;
|
|
||||||
Event.info({
|
$(path.join(src, '_h5ai', 'js') + ': **/*.js, ! lib/**')
|
||||||
method: 'check-version',
|
.jshint(jshint);
|
||||||
message: 'version set to ' + version
|
});
|
||||||
});
|
|
||||||
done();
|
|
||||||
});
|
make.target('build', ['check-version'], 'build all updated files').sync(function () {
|
||||||
});
|
|
||||||
|
$(src + ': _h5ai/js/*.js')
|
||||||
|
.modified(mapSrc, $(src + ': _h5ai/js/**'))
|
||||||
make.target('clean', [], 'delete build folder')
|
.includify()
|
||||||
.sync(function () {
|
.uglifyjs()
|
||||||
|
.write($.OVERWRITE, mapSrc);
|
||||||
$.rmfr($.I_AM_SURE, build);
|
|
||||||
});
|
$(src + ': _h5ai/css/*.less')
|
||||||
|
.modified(mapSrc, $(src + ': _h5ai/css/**'))
|
||||||
|
.less()
|
||||||
make.target('lint', [], 'lint all JavaScript files with JSHint')
|
.cssmin()
|
||||||
.sync(function () {
|
.write($.OVERWRITE, mapSrc);
|
||||||
|
|
||||||
$(src + '/_h5ai/js: **/*.js, ! lib/**')
|
$(src + ': **/*.jade')
|
||||||
.jshint(jshint);
|
.modified(mapSrc)
|
||||||
});
|
.handlebars(handlebarsEnv)
|
||||||
|
.jade()
|
||||||
|
.write($.OVERWRITE, mapSrc);
|
||||||
make.target('build', ['check-version'], 'build all updated files')
|
|
||||||
.sync(function () {
|
$(src + ': **, ! _h5ai/js/**, ! _h5ai/css/**, ! **/*.jade')
|
||||||
|
.modified(mapSrc)
|
||||||
$(src + ': _h5ai/js/*.js')
|
.handlebars(handlebarsEnv)
|
||||||
.modified(mapper, $(src + ': _h5ai/js/**'))
|
.write($.OVERWRITE, mapSrc);
|
||||||
.includify()
|
|
||||||
.uglifyjs()
|
$(root + ': README*, LICENSE*')
|
||||||
.write($.OVERWRITE, mapper);
|
.modified(mapRoot)
|
||||||
|
.write($.OVERWRITE, mapRoot);
|
||||||
$(src + ': _h5ai/css/*.less')
|
});
|
||||||
.modified(mapper, $(src + ': _h5ai/css/**'))
|
|
||||||
.less()
|
|
||||||
.cssmin()
|
make.target('build-uncompressed', ['check-version'], 'build all updated files without compression').sync(function () {
|
||||||
.write($.OVERWRITE, mapper);
|
|
||||||
|
$(src + ': _h5ai/js/*.js')
|
||||||
$(src + ': **/*.jade')
|
.modified(mapSrc, $(src + ': _h5ai/js/**'))
|
||||||
.modified(mapper)
|
.includify()
|
||||||
.handlebars(replacements)
|
// .uglifyjs()
|
||||||
.jade()
|
.write($.OVERWRITE, mapSrc);
|
||||||
.write($.OVERWRITE, mapper);
|
|
||||||
|
$(src + ': _h5ai/css/*.less')
|
||||||
$(src + ': **, ! _h5ai/js/**, ! _h5ai/css/**, ! **/*.jade')
|
.modified(mapSrc, $(src + ': _h5ai/css/**'))
|
||||||
.modified(mapper)
|
.less()
|
||||||
.handlebars(replacements)
|
// .cssmin()
|
||||||
.write($.OVERWRITE, mapper);
|
.write($.OVERWRITE, mapSrc);
|
||||||
|
|
||||||
$(root + ': README*, LICENSE*')
|
$(src + ': **/*.jade')
|
||||||
.modified(mapperRoot)
|
.modified(mapSrc)
|
||||||
.write($.OVERWRITE, mapperRoot);
|
.handlebars(handlebarsEnv)
|
||||||
});
|
.jade()
|
||||||
|
.write($.OVERWRITE, mapSrc);
|
||||||
|
|
||||||
make.target('build-uncompressed', ['check-version'], 'build all updated files without compression')
|
$(src + ': **, ! _h5ai/js/**, ! _h5ai/css/**, ! **/*.jade')
|
||||||
.sync(function () {
|
.modified(mapSrc)
|
||||||
|
.handlebars(handlebarsEnv)
|
||||||
$(src + ': _h5ai/js/*.js')
|
.write($.OVERWRITE, mapSrc);
|
||||||
.modified(mapper, $(src + ': _h5ai/js/**'))
|
|
||||||
.includify()
|
$(root + ': README*, LICENSE*')
|
||||||
// .uglifyjs()
|
.modified(mapRoot)
|
||||||
.write($.OVERWRITE, mapper);
|
.write($.OVERWRITE, mapRoot);
|
||||||
|
});
|
||||||
$(src + ': _h5ai/css/*.less')
|
|
||||||
.modified(mapper, $(src + ': _h5ai/css/**'))
|
|
||||||
.less()
|
make.target('release', ['clean', 'build'], 'create a zipball').async(function (done, fail) {
|
||||||
// .cssmin()
|
|
||||||
.write($.OVERWRITE, mapper);
|
$(build + ': _h5ai/**').shzip({
|
||||||
|
target: path.join(build, 'h5ai-' + pkg.version + '.zip'),
|
||||||
$(src + ': **/*.jade')
|
dir: build,
|
||||||
.modified(mapper)
|
callback: done
|
||||||
.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
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
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
|
# customized .htaccess
|
||||||
################################
|
################################
|
||||||
|
|
||||||
|
@ -19,5 +19,5 @@ IndexOptions NameWidth=*
|
||||||
IndexOptions SuppressDescription
|
IndexOptions SuppressDescription
|
||||||
IndexOptions SuppressHTMLPreamble
|
IndexOptions SuppressHTMLPreamble
|
||||||
IndexOptions SuppressRules
|
IndexOptions SuppressRules
|
||||||
IndexOptions Type=text/html;h5ai={{version}}
|
IndexOptions Type=text/html;h5ai={{pkg.version}}
|
||||||
IndexOptions XHTML
|
IndexOptions XHTML
|
||||||
|
|
|
@ -11,8 +11,8 @@ doctype 5
|
||||||
head
|
head
|
||||||
meta( charset="utf-8" )
|
meta( charset="utf-8" )
|
||||||
meta( http-equiv="X-UA-Compatible", content="IE=edge,chrome=1" )
|
meta( http-equiv="X-UA-Compatible", content="IE=edge,chrome=1" )
|
||||||
title Directory index · styled with h5ai {{version}}
|
title Directory index · styled with {{pkg.name}} {{pkg.version}}
|
||||||
meta( name="description", content="Directory index styled with h5ai {{version}} (http://larsjung.de/h5ai)" )
|
meta( name="description", content="Directory index styled with h5ai {{pkg.version}} (http://larsjung.de/h5ai)" )
|
||||||
meta( name="viewport", content="width=device-width" )
|
meta( name="viewport", content="width=device-width" )
|
||||||
link( rel="shortcut icon", type="image/png", href!="#{h5ai}images/h5ai-16x16.png" )
|
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" )
|
link( rel="apple-touch-icon", type="image/png", href!="#{h5ai}images/h5ai-48x48.png" )
|
||||||
|
@ -30,7 +30,7 @@ div#content
|
||||||
|
|
||||||
div#bottombar.clearfix
|
div#bottombar.clearfix
|
||||||
span.left
|
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.hideOnJs.noJsMsg ⚡ JavaScript is disabled! ⚡
|
||||||
span.oldBrowser
|
span.oldBrowser
|
||||||
| ⚡ Some features disabled! Works best in
|
| ⚡ Some features disabled! Works best in
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
h5ai {{version}}
|
{{pkg.name}} {{pkg.version}}
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
options, types and localization
|
options, types and localization
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* h5ai {{version}}
|
* {{pkg.name}} {{pkg.version}}
|
||||||
*
|
*
|
||||||
* PHP Configuration
|
* PHP Configuration
|
||||||
* filesystem paths and file ignore rules
|
* filesystem paths and file ignore rules
|
||||||
|
|
|
@ -8,7 +8,7 @@ html.no-js( lang="en" )
|
||||||
head
|
head
|
||||||
meta( charset="utf-8" )
|
meta( charset="utf-8" )
|
||||||
meta( http-equiv="X-UA-Compatible", content="IE=edge,chrome=1" )
|
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="description", content="h5ai server details" )
|
||||||
meta( name="viewport", content="width=device-width" )
|
meta( name="viewport", content="width=device-width" )
|
||||||
link( rel="shortcut icon", type="image/png", href="images/h5ai-16x16.png" )
|
link( rel="shortcut icon", type="image/png", href="images/h5ai-16x16.png" )
|
||||||
|
@ -19,8 +19,8 @@ html.no-js( lang="en" )
|
||||||
|
|
||||||
body#h5ai-info
|
body#h5ai-info
|
||||||
|
|
||||||
h1 h5ai
|
h1 {{pkg.name}}
|
||||||
span.build-version version {{version}}
|
span.build-version version {{pkg.version}}
|
||||||
span.build-stamp {{stamp}}
|
span.build-stamp {{stamp}}
|
||||||
|
|
||||||
h2 server supports
|
h2 server supports
|
||||||
|
@ -68,7 +68,7 @@ html.no-js( lang="en" )
|
||||||
|
|
||||||
div#bottombar.clearfix
|
div#bottombar.clearfix
|
||||||
span.left
|
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.hideOnJs.noJsMsg ⚡ JavaScript is disabled! ⚡
|
||||||
span.oldBrowser
|
span.oldBrowser
|
||||||
| ⚡ Some features disabled! Works best in
|
| ⚡ Some features disabled! Works best in
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|<?php
|
|<?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";
|
| $h5ai_php = str_replace("\\", "/", dirname(__FILE__)) . "/inc/H5ai.php";
|
||||||
| if (!file_exists($h5ai_php)) {
|
| if (!file_exists($h5ai_php)) {
|
||||||
| function find_h5ai($path, $h5ai) {
|
| function find_h5ai($path, $h5ai) {
|
||||||
|
@ -34,8 +34,8 @@ html.no-js( lang="en" )
|
||||||
head
|
head
|
||||||
meta( charset="utf-8" )
|
meta( charset="utf-8" )
|
||||||
meta( http-equiv="X-UA-Compatible", content="IE=edge,chrome=1" )
|
meta( http-equiv="X-UA-Compatible", content="IE=edge,chrome=1" )
|
||||||
title Directory index · styled with h5ai {{version}}
|
title Directory index · styled with {{pkg.name}} {{pkg.version}}
|
||||||
meta( name="description", content="Directory index styled with h5ai {{version}} (http://larsjung.de/h5ai)" )
|
meta( name="description", content="Directory index styled with h5ai {{pkg.version}} (http://larsjung.de/h5ai)" )
|
||||||
meta( name="viewport", content="width=device-width" )
|
meta( name="viewport", content="width=device-width" )
|
||||||
link( rel="shortcut icon", type="image/png", href!="#{h5ai}images/h5ai-16x16.png" )
|
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" )
|
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
|
div#bottombar.clearfix
|
||||||
span.left
|
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.hideOnJs.noJsMsg ⚡ JavaScript is disabled! ⚡
|
||||||
span.oldBrowser
|
span.oldBrowser
|
||||||
| ⚡ Some features disabled! Works best in
|
| ⚡ Some features disabled! Works best in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue