瀏覽代碼

new js based build system; ejs templates; json config; gulp scss build

Andi Dittrich 7 年之前
父節點
當前提交
3bf12ef421

+ 3 - 0
.eslintrc

@@ -0,0 +1,3 @@
+{
+    "extends": ["eslint:recommended", "aenondynamics"]
+}

+ 15 - 6
CHANGES.md

@@ -1,24 +1,33 @@
-## 0.5.2 ##
+Preliminary
+------------------------------------------------------
+
+### 0.6.0 ###
+* New Generator/Build System: [EJS](https://github.com/mde/ejs) (templates), [SCSS](http://sass-lang.com/) (styles) and [GULP](https://gulpjs.com/) (build) are used as a replacement of the historical php/bash/ant/less setup.
+* JSON based page definitions including **i18n** support
+* Option to use custom styles
+* Option to use custom template
+
+### 0.5.2 ###
 * Bugfix: package.json contains invalid main/app entry file
 
-## 0.5.1 ##
+### 0.5.1 ###
 * Bugfix: `lib/` directory was not included in the npm package
 
-## 0.5.0 ##
+### 0.5.0 ###
 * Added: expressjs support with native npm package/error handler
 
-## 0.4.1 ##
+### 0.4.1 ###
 * Bugfix: Restored NGINX Configuration from 0331dac487caa0b3ddb5897b5d35afc2c01dfbd5
 * Added: Semantic Versioning
 
-## 0.4 ##
+### 0.4 ###
 * Added: **ANT** based build file
 * Added: Configuration file `config.ini`
 * Added: Prebuild Packages (includes all generated html file)
 * Changed the directory structure
 * Demo Pages are hosted via GitHub Pages (located within the `docs/` dir)
 
-## 0.3 ##
+### 0.3 ###
 * Replaced Bootstrap by small inline styles
 * Added optional footer contact address
 * PHP template (`template.phtml`) is used instead of simple text based template

文件差異過大導致無法顯示
+ 0 - 0
assets/Layout.css


+ 8 - 7
assets/Layout.less → assets/layout.scss

@@ -1,4 +1,4 @@
-@import (inline) "normalize-5.0.0.css";
+@import "normalize-5.0.0.css";
 
 /*! Simple HttpErrorPages | MIT X11 License | https://github.com/AndiDittrich/HttpErrorPages */
 html,body {
@@ -25,14 +25,15 @@ h1{
     line-height: 1.1;
     color: inherit;
     font-size: 36px;
-}
 
-h1 small{
-    font-size: 68%;
-    font-weight: 400;
-    line-height: 1;
-    color: #777777;
+    small{
+        font-size: 68%;
+        font-weight: 400;
+        line-height: 1;
+        color: #777777;
+    }
 }
+
 a{
     text-decoration: none;
     color: #ffffff;

+ 13 - 0
assets/template.ejs

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <!-- Simple HttpErrorPages | MIT License | https://github.com/AndiDittrich/HttpErrorPages -->
+    <meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1" />
+    <title>We've got some trouble | <%= code %> - <%= title %></title>
+    <style type="text/css"><%- inlinecss %></style>
+</head>
+<body>
+    <div class="cover"><h1><%= title %> <small>Error <%= code %></small></h1><p class="lead"><%= message %></p></div>
+    <% if (footer){ %><footer><p><%- footer %></p></footer><% } %>
+</body>
+</html>

+ 151 - 0
bin/generator.js

@@ -0,0 +1,151 @@
+#!/usr/bin/env node
+
+const _fs = require('fs-magic');
+const _ejs = require('ejs');
+const _path = require('path');
+const _assetsPath = _path.join(__dirname, '../assets');
+const _langPath = _path.join(__dirname, '../i18n');
+const _cli = require('commander');
+const _pkg = require('../package.json');
+
+// global paths
+let templatePath = null;
+let cssPath = null;
+
+// render template using given data
+async function renderTemplate(data={}){
+    // fetch css
+    data.inlinecss = await _fs.readFile(cssPath, 'utf8');
+
+    // fetch template
+    const tpl = await _fs.readFile(templatePath, 'utf8');
+   
+    // render template - use custom escape function to handle linebreaks!
+    return _ejs.render(tpl, data, {
+        escape: function(text){
+            // apply generic escape function
+            text = _ejs.escapeXML(text);
+
+            // linebreaks
+            text = text.replace(/\n/g, '<br />');
+
+            return text;
+        }
+    });
+}
+
+// parse json file and allow single line comments
+async function readJSONFile(filename){
+    // load file
+    let raw = await _fs.readFile(filename, 'utf8');
+
+    // strip single line js comments
+    raw = raw.replace(/^\s*\/\/.*$/gm, '');
+
+    // parse text
+    return JSON.parse(raw);
+}
+
+async function generator(configFilename, pageDefinitionFile, distPath){
+    // load config
+    const config = await readJSONFile(configFilename);
+
+    // load page definitions
+    const pages = await readJSONFile(pageDefinitionFile);
+
+    console.log('Generating static pages');
+
+    // for each errorcode generate custom page
+    await Promise.all(Object.keys(pages).map(async function(p){
+        // page config
+        const pconf = pages[p];
+
+        // inject errorcode
+        pconf.code = p;
+
+        // inject foote
+        pconf.footer = pconf.footer || config.footer;
+
+        // render page
+        const content = await renderTemplate(pconf);
+
+        // generate filename
+        const filename = 'HTTP' + p + '.html';
+
+        // write content to file
+        await _fs.writeFile(_path.join(distPath, filename), content, 'utf8');
+
+        console.log(' |- Page <' + filename + '>');
+    }));
+}
+
+// CLI setup
+_cli
+// read file version package.json
+.version(_pkg.version)
+
+// static error page generator
+.command('static [config]')
+    .description('run http-error-pages generator')
+    .option('-t, --template <path>', 'path to your custom EJS template file', null)
+    .option('-s, --styles <path>', 'path to your custom stylesheet', null)
+    .option('-p, --pages <path>', 'path to your custom page definition', null)
+    .option('-l, --lang <lang>', 'the language of the default page definition', null)
+    .option('-o, --out <path>', 'output directory', null)
+    .action(function(configFilename, options){
+        // config set ?
+        const configPath = configFilename || _path.join(__dirname, '../config.json');
+
+        // template path set ?
+        templatePath = options.template || _path.join(_assetsPath, 'template.ejs');
+
+        // style path set ?
+        cssPath = options.styles || _path.join(_assetsPath, 'layout.css');
+
+        // output path set ?
+        const distPath = options.out || _path.join(__dirname, '../dist');
+
+        // language set ? use en_US as default
+        const lang = options.lang || 'en_US';
+
+        // custom page definition available ?
+        let pageDefinitionFile = options.pages || null;
+
+        // page definition not set ? use lang
+        if (pageDefinitionFile === null){
+            pageDefinitionFile = _path.join(_langPath, 'pages-'+ lang + '.json') 
+        }
+
+        // show paths
+        console.log('');
+        console.log('Paths');
+        console.log(' |- Config:', configPath);
+        console.log(' |- Template:', templatePath);
+        console.log(' |- Styles:', cssPath);
+        console.log(' |- Pages:', pageDefinitionFile);
+        console.log('');
+
+        // run async generator
+        generator(configPath, pageDefinitionFile, distPath)
+            .then(function(){
+                console.log('Static files generated\n');
+            })
+            .catch(function(e){
+                console.error(e);
+            });
+    });
+
+_cli
+    .command('*')
+    .action(function(c){
+        console.error('Unknown command "' + c + '"');
+        _cli.outputHelp();
+    });
+
+// run the commander dispatcher
+_cli.parse(process.argv);
+
+// default action (no command provided)
+if (!process.argv.slice(2).length) {
+_cli.outputHelp();
+}

+ 0 - 43
build.xml

@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="HttpErrorPages" default="pages" basedir=".">
-    <!-- AN-contrib !-->
-    <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
-
-    <target name="css">
-        <!-- Less CSS build (WEB CSS) !-->
-        <echo message="Building LESS Files.." />
-        <exec executable="lessc">
-            <arg line="assets/Layout.less" />
-            <arg line="assets/Layout.css" />
-            <arg line="--clean-css" />
-        </exec>
-    </target>
-
-    <!-- Generate Pages using default config !-->
-    <target name="pages" depends="css">
-        <!-- Generate Pages !-->
-        <exec executable="php">
-            <arg value="generator.php" />
-        </exec>
-
-        <!-- create package !-->
-        <zip destfile="dist/pages.zip" basedir="dist" includes="*.html" />
-        <tar destfile="dist/pages.tar" basedir="dist" includes="*.html" />
-    </target>
-
-    <!-- Generate Docs Pages !-->
-    <target name="docs" depends="css">
-        <!-- Generate Pages !-->
-        <exec executable="php">
-            <arg value="generator.php" />
-            <arg value="docs/config.ini" />
-        </exec>
-    </target>
-
-    <!-- Full Rebuild !-->
-    <target name="full" depends="css,docs,pages">
-    </target>
-
-</project>
-

+ 0 - 10
config.ini

@@ -1,10 +0,0 @@
-[global]
-
-; Output Filename Scheme - eg. HTTP500.html
-scheme='HTTP%d.html'
-
-; Output dir path
-output_dir="dist/"
-
-; Footer content (HTML Allowed)
-footer=""

+ 7 - 0
config.json

@@ -0,0 +1,7 @@
+{
+    //  Output Filename Scheme - eg. HTTP500.html
+    "scheme": "HTTP%d.html",
+
+    // Footer content (HTML Allowed)
+    "footer": "Tech Contact <a href=\"mailto:info@example.org\">info@example.org</a>"
+}

文件差異過大導致無法顯示
+ 0 - 11
dist/HTTP0.html


文件差異過大導致無法顯示
+ 2 - 7
dist/HTTP400.html


文件差異過大導致無法顯示
+ 2 - 7
dist/HTTP401.html


文件差異過大導致無法顯示
+ 2 - 7
dist/HTTP403.html


文件差異過大導致無法顯示
+ 2 - 7
dist/HTTP404.html


文件差異過大導致無法顯示
+ 2 - 7
dist/HTTP500.html


文件差異過大導致無法顯示
+ 2 - 7
dist/HTTP501.html


文件差異過大導致無法顯示
+ 2 - 7
dist/HTTP502.html


文件差異過大導致無法顯示
+ 2 - 7
dist/HTTP503.html


文件差異過大導致無法顯示
+ 2 - 7
dist/HTTP520.html


文件差異過大導致無法顯示
+ 2 - 7
dist/HTTP521.html


文件差異過大導致無法顯示
+ 2 - 7
dist/HTTP533.html


+ 0 - 1
dist/pages.json

@@ -1 +0,0 @@
-{"400":{"title":"Bad Request","message":"The server cannot process the request due to something that is perceived to be a client error."},"401":{"title":"Unauthorized","message":"The requested resource requires an authentication."},"403":{"title":"Access Denied","message":"The requested resource requires an authentication."},"404":{"title":"Resource not found","message":"The requested resource could not be found but may be available again in the future."},"500":{"title":"Webservice currently unavailable","message":"An unexpected condition was encountered.\nOur service team has been dispatched to bring it back online."},"501":{"title":"Not Implemented","message":"The Webserver cannot recognize the request method."},"502":{"title":"Webservice currently unavailable","message":"We've got some trouble with our backend upstream cluster.\nOur service team has been dispatched to bring it back online."},"503":{"title":"Webservice currently unavailable","message":"We've got some trouble with our backend upstream cluster.\nOur service team has been dispatched to bring it back online."},"520":{"title":"Origin Error - Unknown Host","message":"The requested hostname is not routed. Use only hostnames to access resources."},"521":{"title":"Webservice currently unavailable","message":"We've got some trouble with our backend upstream cluster.\nOur service team has been dispatched to bring it back online."},"533":{"title":"Scheduled Maintenance","message":"This site is currently down for maintenance.\nOur service team is working hard to bring it back online soon."}}

二進制
dist/pages.tar


二進制
dist/pages.zip


文件差異過大導致無法顯示
+ 2 - 7
docs/HTTP400.html


文件差異過大導致無法顯示
+ 2 - 7
docs/HTTP401.html


文件差異過大導致無法顯示
+ 2 - 7
docs/HTTP403.html


文件差異過大導致無法顯示
+ 2 - 7
docs/HTTP404.html


文件差異過大導致無法顯示
+ 2 - 7
docs/HTTP500.html


文件差異過大導致無法顯示
+ 2 - 7
docs/HTTP501.html


文件差異過大導致無法顯示
+ 2 - 7
docs/HTTP502.html


文件差異過大導致無法顯示
+ 2 - 7
docs/HTTP503.html


文件差異過大導致無法顯示
+ 2 - 7
docs/HTTP520.html


文件差異過大導致無法顯示
+ 2 - 7
docs/HTTP521.html


文件差異過大導致無法顯示
+ 2 - 7
docs/HTTP533.html


+ 0 - 10
docs/config.ini

@@ -1,10 +0,0 @@
-[global]
-
-; Output Filename Scheme - eg. HTTP500.html
-scheme='HTTP%d.html'
-
-; Output dir path
-output_dir="docs/"
-
-; Footer content (HTML Allowed)
-footer = "Technical Contact: <a href="mailto:x@example.com">x@example.com</a>"

+ 4 - 0
docs/config.json

@@ -0,0 +1,4 @@
+{
+    "scheme": "HTTP%d.html",
+    "footer": "Technical Contact: <a href=\"mailto:x@example.com\">x@example.com</a>"
+}

+ 0 - 81
generator.php

@@ -1,81 +0,0 @@
-<?php
-/**
- * HttpErrorPages HTML Generator
- */
-
-// default config file
-$configFilename = 'config.ini';
-
-// config file specified ?
-if (isset($argv[1])){
-    if (is_file($argv[1])){
-        echo 'Using Config File "', $argv[1], '"', PHP_EOL;
-        $configFilename = $argv[1];
-    }else{
-        echo 'Error: Config File "', $argv[1], '" not found - Using default one', PHP_EOL;
-    }
-}else{
-    echo 'Using Default Config File "', $configFilename, '"', PHP_EOL;
-}
-
-// load config
-$config = parse_ini_file($configFilename, false);
-
-//default language
-$language = 'en_US'; 
-
-if (isset($argv[2])) {
-    $language = $argv[2];
-}
-
-//Internationalization
-switch($language) {
-    case 'pt_BR':
-        $pages = require('pages-pt_BR.php');
-        break;
-    case 'en_US':
-        $pages = require('pages-en_US.php');
-        break;
-    default:
-        $pages = require('pages-en_US.php');
-        break;      
-}
-
-// store pages as json data
-file_put_contents('dist/pages.json', json_encode($pages));
-
-// load inline css
-$css = trim(file_get_contents('assets/Layout.css'));
-
-// js template page
-$pages['{{code}}'] = array(
-    'title' => '{{title}}',
-    'message' => '{{message}}',
-    'footer' => '{{footer}}'
-);
-
-// generate each error page
-foreach ($pages as $code => $page){
-    echo 'Generating Page ', $page['title'], ' (', $code, ')..', PHP_EOL;
-
-    // assign variables
-    $v_code = $code;
-    $v_title = nl2br(htmlspecialchars($page['title']));
-    $v_message = nl2br(htmlspecialchars($page['message']));
-    $v_footer = (isset($config['footer']) ? $config['footer'] : '');
-
-    // render template
-    ob_start();
-    require('template.phtml');
-    $errorpage = ob_get_clean();
-
-    // generate output filename
-    $filename = sprintf($config['scheme'], $v_code);
-
-    // store template
-    if (is_dir($config['output_dir'])){
-        file_put_contents($config['output_dir'] . $filename, $errorpage);
-    }else{
-        echo 'Error: Output dir "', $config['output_dir'], '" not found', PHP_EOL;
-    }
-}

+ 19 - 0
gulpfile.js

@@ -0,0 +1,19 @@
+const _gulp = require('gulp');
+const _sass = require('gulp-sass');
+const _prettyError = require('gulp-prettyerror');
+const _cleanCSS = require('gulp-clean-css');
+const _concat = require('gulp-concat-util');
+
+_gulp.task('default', ['sass']);
+ 
+_gulp.task('sass', function (){
+    return _gulp.src('./assets/layout.scss')
+        .pipe(_prettyError())
+        .pipe(_sass())
+
+        .pipe(_cleanCSS({compatibility: 'ie10'}))
+        .pipe(_concat('layout.css'))
+
+        .pipe(_gulp.dest('./assets'));
+});
+ 

+ 3 - 0
http-error-pages

@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+node bin/generator.js $@

+ 69 - 0
i18n/pages-en_US.json

@@ -0,0 +1,69 @@
+{        
+    // STANDARD ERROR CODES
+    // =======================================================
+
+    "400": {
+        "title": "Bad Request",
+        "message": "The server cannot process the request due to something that is perceived to be a client error." 
+    },
+    "401": {
+        "title": "Unauthorized",
+        "message": "The requested resource requires an authentication."
+    },
+
+    "403": {
+        "title": "Access Denied",
+        "message": "The requested resource requires an authentication." 
+    },
+    
+    // http 404 not found
+    "404": {
+        "title": "Resource not found",
+        "message": "The requested resource could not be found but may be available again in the future." 
+    },
+    
+    // internal server error
+    "500": {
+        "title": "Webservice currently unavailable",
+        "message": "An unexpected condition was encountered.\nOur service team has been dispatched to bring it back online." 
+    },
+    
+    // unknown http method
+    "501": {
+        "title": "Not Implemented",
+        "message": "The Webserver cannot recognize the request method."
+    },
+    
+    // http proxy forward error
+    "502": {
+        "title": "Webservice currently unavailable",
+        "message": "We've got some trouble with our backend upstream cluster.\nOur service team has been dispatched to bring it back online."
+    },
+    
+    // webserver service error
+    "503": {
+        "title": "Webservice currently unavailable",
+        "message": "We've got some trouble with our backend upstream cluster.\nOur service team has been dispatched to bring it back online."
+    },
+    
+    // CUSTOM ERROR CODES
+    // =======================================================
+
+    // webserver origin error
+    "520": {
+        "title": "Origin Error - Unknown Host",
+        "message": "The requested hostname is not routed. Use only hostnames to access resources."
+    },
+    
+    // webserver down error
+    "521": {
+        "title": "Webservice currently unavailable",
+        "message": "We've got some trouble with our backend upstream cluster.\nOur service team has been dispatched to bring it back online."
+    },
+    
+    // maintenance
+    "533": {
+        "title": "Scheduled Maintenance",
+        "message": "This site is currently down for maintenance.\nOur service team is working hard to bring it back online soon."                
+    }
+}

+ 66 - 0
i18n/pages-pt_BR.json

@@ -0,0 +1,66 @@
+{        
+    // STANDARD ERROR CODES
+    // =======================================================
+    "400": {
+        "title": "Requisição inválida",
+        "message": "Oops! Não conseguimos processar a requisição."	
+    },
+    "401": {
+        "title": "Não Autorizado",
+        "message": "Oops! O recurso requer uma autenticação."
+    },
+    "403": {
+        "title": "Acesso Negado",
+        "message": "Oops! O recurso requer uma autenticação." 
+    },
+
+    // http 404 not found
+    "404": {
+        "title": "Página Não Encontrada",
+        "message": "Oops! Não conseguimos encontrar a página que você estava procurando."	
+    },
+
+    // internal server error
+    "500": {
+        "title": "Webservice Atualmente Não Disponível",
+        "message": "Uma condição inesperada foi encontrada.\nNosso time de serviços está trabalhando para deixar isso online novamente." 
+    },
+
+    // unknown http method
+    "501": {
+        "title": "Não implementado",
+        "message": "Oops! O Webserver não conseguiu reconhecer o método solicitado"
+    },
+
+    // http proxy forward error
+    "502": {
+        "title": "Webservice atualmente indisponível",
+        "message": "Nós tivemos alguns problema com o nosso backend. Nosso time de serviços está trabalhando para deixar isso online novamente."
+    },
+
+    // webserver service error
+    "503": {
+        "title": "Webservice atualmente indisponível",
+        "message": "Nós tivemos alguns problema com o nosso backend. Nosso time de serviços está trabalhando para deixar isso online novamente."
+    },
+
+    // CUSTOM ERROR CODES
+    // =======================================================
+    // webserver origin error
+    "520": {
+        "title": "Origin Error - Host Desconhecido",
+        "message": "O hostname requisitado não é roteado. Use apenas hostnames para acessar recursos."
+    },
+
+    // webserver down error
+    "521": {
+        "title": "Webservice atualmente indisponível",
+        "message": "Nós tivemos alguns problema com o nosso backend. Nosso time de serviços está trabalhando para deixar isso online novamente."
+    },
+
+    // maintenance
+    "533": {
+        "title": "Estamos em manutenção",
+        "message": "O site está offline para manutenção.\nNosso time está trabalhando para reestabelecer o serviço em breve."
+    }
+}

+ 4 - 0
lib/README.md

@@ -0,0 +1,4 @@
+Express.js Error Pages
+============================
+
+The following files are used as error handler for express.js

+ 3 - 3
lib/dispatcher.js

@@ -1,5 +1,5 @@
-var _pages = require('../dist/pages.json');
-var _renderer = require('./page-renderer');
+const _pages = require('../dist/pages.json');
+const _renderer = require('./page-renderer');
 
 // multi-type support
 // @see https://github.com/expressjs/express/blob/master/examples/error-pages/index.js
@@ -15,7 +15,7 @@ function dispatchRequest(page, httpStatusCode, req, res){
     res.status(httpStatusCode || 500);
 
     // extract page date
-    var pageData = _pages[page];
+    const pageData = _pages[page];
 
     // multiple response formats
     res.format({

+ 1 - 1
lib/error-handler.js

@@ -1,4 +1,4 @@
-var _dispatcher = require('./dispatcher');
+const _dispatcher = require('./dispatcher');
 
 // http404 handler
 function notfoundHandler(req, res){

+ 6 - 7
lib/page-renderer.js

@@ -1,16 +1,15 @@
-var _path = require('path');
-var _fs = require('fs');
-var _basedir = _path.dirname(__dirname);
+const _path = require('path');
+const _fs = require('fs');
+const _basedir = _path.dirname(__dirname);
 
 // load template file (1 time)
-var _template = _fs.readFileSync(_path.join(_basedir, 'dist/HTTP0.html'), 'utf8');
+const _template = _fs.readFileSync(_path.join(_basedir, 'dist/HTTP0.html'), 'utf8');
 
 // simple template renderer
 function renderPage(vars){
-    var tpl = _template;
-
+    
     // add vars
-    tpl = tpl.replace(/{{([a-z]+)}}/gm, function(match, name){
+    const tpl = _template.replace(/{{([a-z]+)}}/gm, function(match, name){
 
         // var available ?
         if (vars[name]){

+ 55 - 39
package.json

@@ -1,41 +1,57 @@
 {
-  "name": "http-error-pages",
-  "version": "0.5.2",
-  "description": "Simple HTTP Error Pages for expressjs",
-  "scripts":{
-    "generate-css":"lessc assets/Layout.less assets/Layout.css",
-    "generate-html":"php generator.php",
-    "generate": "npm run generate-css && npm run generate-html"
-  },
-  "keywords": [
-    "http",
-    "https",
-    "error",
-    "errorpage",
-    "express",
-    "expressjs",
-    "router",
-    "handler"
-  ],
-  "files": [
-    "lib",
-    "dist",
-    "express-demo.js",
-    "CHANGED.md",
-    "LICENSE.md",
-    "README.md"
-  ],
-  "bin": {},
-  "main": "./lib/error-handler.js",
-  "author": "Andi Dittrich (https://andidittrich.de)",
-  "homepage": "https://github.com/AndiDittrich/HttpErrorPages",
-  "bugs": "https://github.com/AndiDittrich/HttpErrorPages/issues",
-  "repository": "AndiDittrich/HttpErrorPages",
-  "license": "MIT",
-  "devDependencies": {
-    "express": "^4.15.2"
-  },
-  "dependencies": {
-    "less": "^2.7.3"
-  }
+    "name": "http-error-pages",
+    "version": "0.6.0",
+    "description": "Simple HTTP Error Pages for expressjs",
+    "engines": {
+        "node": ">=7.6"
+    },
+    "scripts": {
+        "docs": "node bin/generator.js static docs/config.json --out=docs",
+        "generate": "node bin/generator.js static",
+        "gulp": "gulp"
+    },
+    "keywords": [
+        "http",
+        "https",
+        "error",
+        "errorpage",
+        "express",
+        "expressjs",
+        "router",
+        "handler"
+    ],
+    "files": [
+        "lib",
+        "dist",
+        "i18n",
+        "express-demo.js",
+        "CHANGES.md",
+        "LICENSE.md",
+        "README.md"
+    ],
+    "bin": {
+        "http-error-pages": "./bin/generator.js"
+    },
+    "main": "./lib/error-handler.js",
+    "author": "Andi Dittrich (https://andidittrich.de)",
+    "homepage": "https://github.com/AndiDittrich/HttpErrorPages",
+    "bugs": "https://github.com/AndiDittrich/HttpErrorPages/issues",
+    "repository": "AndiDittrich/HttpErrorPages",
+    "license": "MIT",
+    "devDependencies": {
+        "commander": "^2.11.0",
+        "eslint": "^4.11.0",
+        "eslint-config-aenondynamics": "^0.2.0",
+        "express": "^4.15.2",
+        "fs-magic": "^2.1.1",
+        "gulp": "^3.9.1",
+        "gulp-clean-css": "^3.9.0",
+        "gulp-concat-util": "^0.5.5",
+        "gulp-prettyerror": "^1.2.1",
+        "gulp-sass": "^3.1.0",
+        "less": "^2.7.3"
+    },
+    "dependencies": {
+        "ejs": "^2.5.7"
+    }
 }

+ 0 - 71
pages-en_US.php

@@ -1,71 +0,0 @@
-<?php
-return array (
-        
-        // STANDARD ERROR CODES
-        // =======================================================
-
-        '400' => array (
-                'title' => 'Bad Request',
-                'message' => 'The server cannot process the request due to something that is perceived to be a client error.' 
-        ),
-        '401' => array (
-                'title' => 'Unauthorized',
-                'message' => 'The requested resource requires an authentication.'
-        ),
-
-        '403' => array (
-                'title' => 'Access Denied',
-                'message' => 'The requested resource requires an authentication.' 
-        ),
-        
-        // http 404 not found
-        '404' => array (
-                'title' => 'Resource not found',
-                'message' => 'The requested resource could not be found but may be available again in the future.' 
-        ),
-        
-        // internal server error
-        '500' => array (
-                'title' => 'Webservice currently unavailable',
-                'message' => "An unexpected condition was encountered.\nOur service team has been dispatched to bring it back online." 
-        ),
-        
-        // unknown http method
-        '501' => array (
-                'title' => 'Not Implemented',
-                'message' => 'The Webserver cannot recognize the request method.'
-        ),
-        
-        // http proxy forward error
-        '502' => array (
-                'title' => 'Webservice currently unavailable',
-                'message' => "We've got some trouble with our backend upstream cluster.\nOur service team has been dispatched to bring it back online."
-        ),
-        
-        // webserver service error
-        '503' => array (
-                'title' => 'Webservice currently unavailable',
-                'message' => "We've got some trouble with our backend upstream cluster.\nOur service team has been dispatched to bring it back online."
-        ),
-        
-        // CUSTOM ERROR CODES
-        // =======================================================
-
-        // webserver origin error
-        '520' => array(
-            'title' => 'Origin Error - Unknown Host',
-            'message' => 'The requested hostname is not routed. Use only hostnames to access resources.'
-        ),
-        
-        // webserver down error
-        '521' => array (
-                'title' => 'Webservice currently unavailable',
-                'message' => "We've got some trouble with our backend upstream cluster.\nOur service team has been dispatched to bring it back online."
-        ),
-        
-        // maintenance
-        '533' => array(
-                'title' => 'Scheduled Maintenance',
-                'message' => "This site is currently down for maintenance.\nOur service team is working hard to bring it back online soon."                
-        )
-);

+ 0 - 68
pages-pt_BR.php

@@ -1,68 +0,0 @@
-<?php
-return array (
-        
-        // STANDARD ERROR CODES
-        // =======================================================
-        '400' => array (
-                'title' => 'Requisição inválida',
-	        'message' => 'Oops! Não conseguimos processar a requisição.'	
-        ),
-        '401' => array (
-                'title' => 'Não Autorizado',
-                'message' => 'Oops! O recurso requer uma autenticação.'
-        ),
-        '403' => array (
-                'title' => 'Acesso Negado',
-                'message' => 'Oops! O recurso requer uma autenticação.' 
-        ),
-        
-        // http 404 not found
-        '404' => array (
-                'title' => 'Página Não Encontrada',
-	        'message'=>'Oops! Não conseguimos encontrar a página que você estava procurando.'	
-        ),
-        
-        // internal server error
-        '500' => array (
-                'title' => 'Webservice Atualmente Não Disponível',
-                'message' => "Uma condição inesperada foi encontrada.\nNosso time de serviços está trabalhando para deixar isso online novamente." 
-        ),
-        
-        // unknown http method
-        '501' => array (
-                'title' => 'Não implementado',
-		'message' => 'Oops! O Webserver não conseguiu reconhecer o método solicitado'
-        ),
-        
-        // http proxy forward error
-        '502' => array (
-		'title' => 'Webservice atualmente indisponível',
-		'message' => "Nós tivemos alguns problema com o nosso backend. Nosso time de serviços está trabalhando para deixar isso online novamente."
-        ),
-        
-        // webserver service error
-        '503' => array (
-                'title' => 'Webservice atualmente indisponível',
-                'message' => "Nós tivemos alguns problema com o nosso backend. Nosso time de serviços está trabalhando para deixar isso online novamente."
-        ),
-        
-        // CUSTOM ERROR CODES
-        // =======================================================
-        // webserver origin error
-        '520' => array(
-            'title' => 'Origin Error - Host Desconhecido',
-            'message' => 'O hostname requisitado não é roteado. Use apenas hostnames para acessar recursos.'
-        ),
-        
-        // webserver down error
-        '521' => array (
-                'title' => 'Webservice atualmente indisponível',
-                'message' => "Nós tivemos alguns problema com o nosso backend. Nosso time de serviços está trabalhando para deixar isso online novamente."
-        ),
-        
-        // maintenance
-        '533' => array(
-                'title' => 'Estamos em manutenção',
-                'message' => "O site está offline para manutenção.\nNosso time está trabalhando para reestabelecer o serviço em breve."                
-        )
-);

+ 0 - 27
template.phtml

@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <!-- Simple HttpErrorPages | MIT X11 License | https://github.com/AndiDittrich/HttpErrorPages -->
-
-    <meta charset="utf-8" />
-    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-    <meta name="viewport" content="width=device-width, initial-scale=1" />
-    
-    <title>We've got some trouble | <?php echo $v_code; ?> - <?php echo $v_title; ?></title>
-
-    <style type="text/css"><?php echo $css; ?></style>
-</head>
-
-<body>
-    <div class="cover">
-        <h1><?php echo $v_title; ?> <small>Error <?php echo $v_code; ?></small></h1>
-        <p class="lead"><?php echo $v_message; ?></p>
-    </div>
-    
-    <?php if (!empty($v_footer)){ ?>
-    <footer>
-        <p><?php echo $v_footer; ?></p>
-    </footer>
-    <?php } ?>
-</body>
-</html>

文件差異過大導致無法顯示
+ 1791 - 22
yarn.lock


部分文件因文件數量過多而無法顯示