🔨
This commit is contained in:
parent
cafb59c4a0
commit
b87e6e8044
10
gulpfile.ts
10
gulpfile.ts
@ -24,6 +24,7 @@ const transformify = require('syuilo-transformify');
|
|||||||
const pug = require('gulp-pug');
|
const pug = require('gulp-pug');
|
||||||
const git = require('git-last-commit');
|
const git = require('git-last-commit');
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
|
import * as escapeHtml from 'escape-html';
|
||||||
|
|
||||||
const env = process.env.NODE_ENV;
|
const env = process.env.NODE_ENV;
|
||||||
const isProduction = env === 'production';
|
const isProduction = env === 'production';
|
||||||
@ -63,11 +64,16 @@ gulp.task('build:ts', () =>
|
|||||||
.pipe(gulp.dest('./built/'))
|
.pipe(gulp.dest('./built/'))
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task('build:about:docs', () => {
|
function getLicenseHtml(path: string): string {
|
||||||
const licenseHtml = fs.readFileSync('./LICENSE', 'utf-8')
|
return escapeHtml(fs.readFileSync(path, 'utf-8'))
|
||||||
.replace(/\r\n/g, '\n')
|
.replace(/\r\n/g, '\n')
|
||||||
.replace(/(.)\n(.)/g, '$1 $2')
|
.replace(/(.)\n(.)/g, '$1 $2')
|
||||||
.replace(/(^|\n)(.*?)($|\n)/g, '<p>$2</p>');
|
.replace(/(^|\n)(.*?)($|\n)/g, '<p>$2</p>');
|
||||||
|
}
|
||||||
|
|
||||||
|
gulp.task('build:about:docs', () => {
|
||||||
|
const licenses = glob.sync('./node_modules/**/LICENSE*');
|
||||||
|
const licenseHtml = [getLicenseHtml('./LICENSE')].concat(licenses.map(license => getLicenseHtml(license))).join('<hr>');
|
||||||
const pugs = glob.sync('./src/web/about/pages/**/*.pug');
|
const pugs = glob.sync('./src/web/about/pages/**/*.pug');
|
||||||
const streams = pugs.map(file => {
|
const streams = pugs.map(file => {
|
||||||
const page = file.replace('./src/web/about/pages/', '').replace('.pug', '');
|
const page = file.replace('./src/web/about/pages/', '').replace('.pug', '');
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
"@types/compression": "0.0.33",
|
"@types/compression": "0.0.33",
|
||||||
"@types/cors": "0.0.33",
|
"@types/cors": "0.0.33",
|
||||||
"@types/elasticsearch": "5.0.9",
|
"@types/elasticsearch": "5.0.9",
|
||||||
|
"@types/escape-html": "0.0.19",
|
||||||
"@types/event-stream": "3.3.30",
|
"@types/event-stream": "3.3.30",
|
||||||
"@types/express": "4.0.34",
|
"@types/express": "4.0.34",
|
||||||
"@types/glob": "5.0.30",
|
"@types/glob": "5.0.30",
|
||||||
@ -70,6 +71,7 @@
|
|||||||
"deepcopy": "0.6.3",
|
"deepcopy": "0.6.3",
|
||||||
"del": "2.2.2",
|
"del": "2.2.2",
|
||||||
"elasticsearch": "12.1.3",
|
"elasticsearch": "12.1.3",
|
||||||
|
"escape-html": "1.0.3",
|
||||||
"escape-regexp": "0.0.1",
|
"escape-regexp": "0.0.1",
|
||||||
"event-stream": "3.3.4",
|
"event-stream": "3.3.4",
|
||||||
"express": "4.14.0",
|
"express": "4.14.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user