forked from FoundKeyGang/FoundKey
Clean up ✨
This commit is contained in:
parent
10bb5fe0ea
commit
ce216d218b
5 changed files with 17 additions and 39 deletions
|
@ -5,11 +5,4 @@ block title
|
||||||
|
|
||||||
block content
|
block content
|
||||||
h1 ライセンス
|
h1 ライセンス
|
||||||
|
|
||||||
div!= license
|
div!= license
|
||||||
|
|
||||||
hr
|
|
||||||
|
|
||||||
details
|
|
||||||
summary サードパーティ
|
|
||||||
div!= thirdpartyLicenses
|
|
||||||
|
|
32
gulpfile.ts
32
gulpfile.ts
|
@ -14,16 +14,13 @@ import * as es from 'event-stream';
|
||||||
import * as webpack from 'webpack-stream';
|
import * as webpack from 'webpack-stream';
|
||||||
import cssnano = require('gulp-cssnano');
|
import cssnano = require('gulp-cssnano');
|
||||||
import * as uglify from 'gulp-uglify';
|
import * as uglify from 'gulp-uglify';
|
||||||
import riotify = require('riotify');
|
|
||||||
import pug = require('gulp-pug');
|
import pug = require('gulp-pug');
|
||||||
import git = require('git-last-commit');
|
import git = require('git-last-commit');
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
import * as escapeHtml from 'escape-html';
|
|
||||||
import prominence = require('prominence');
|
import prominence = require('prominence');
|
||||||
import * as chalk from 'chalk';
|
import * as chalk from 'chalk';
|
||||||
import imagemin = require('gulp-imagemin');
|
import imagemin = require('gulp-imagemin');
|
||||||
import * as rename from 'gulp-rename';
|
import * as rename from 'gulp-rename';
|
||||||
import named = require('vinyl-named');
|
|
||||||
|
|
||||||
const env = process.env.NODE_ENV;
|
const env = process.env.NODE_ENV;
|
||||||
const isProduction = env === 'production';
|
const isProduction = env === 'production';
|
||||||
|
@ -33,6 +30,8 @@ if (isDebug) {
|
||||||
console.log(chalk.yellow.bold('!!!注意!!! 開発モードが有効です。(成果物の圧縮などはスキップされます)'));
|
console.log(chalk.yellow.bold('!!!注意!!! 開発モードが有効です。(成果物の圧縮などはスキップされます)'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const constants = require('./src/const.json');
|
||||||
|
|
||||||
const tsProject = ts.createProject('tsconfig.json');
|
const tsProject = ts.createProject('tsconfig.json');
|
||||||
|
|
||||||
gulp.task('build', [
|
gulp.task('build', [
|
||||||
|
@ -65,37 +64,22 @@ gulp.task('build:ts', () =>
|
||||||
|
|
||||||
gulp.task('build:about:docs', () => {
|
gulp.task('build:about:docs', () => {
|
||||||
function getLicenseHtml(path: string) {
|
function getLicenseHtml(path: string) {
|
||||||
return escapeHtml(fs.readFileSync(path, 'utf-8'))
|
return 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>');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLicenseSectionHtml(path: string) {
|
|
||||||
try {
|
|
||||||
const pkg = JSON.parse(fs.readFileSync(Path.parse(path).dir + '/package.json', 'utf-8'));
|
|
||||||
const licenseHtml = getLicenseHtml(path);
|
|
||||||
return `<details><summary>${pkg.name} <small>v${pkg.version}</small></summary>${licenseHtml}</details>`;
|
|
||||||
} catch (e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const licenses = glob.sync('./node_modules/**/LICENSE*');
|
|
||||||
const licenseHtml = getLicenseHtml('./LICENSE');
|
const licenseHtml = getLicenseHtml('./LICENSE');
|
||||||
const thirdpartyLicensesHtml = licenses.map(license => getLicenseSectionHtml(license)).join('');
|
const streams = glob.sync('./docs/**/*.pug').map(file => {
|
||||||
const pugs = glob.sync('./docs/**/*.pug');
|
|
||||||
const streams = pugs.map(file => {
|
|
||||||
const page = file.replace('./docs/', '').replace('.pug', '');
|
const page = file.replace('./docs/', '').replace('.pug', '');
|
||||||
return gulp.src(file)
|
return gulp.src(file)
|
||||||
.pipe(pug({
|
.pipe(pug({
|
||||||
locals: Object.assign({
|
locals: {
|
||||||
path: page,
|
path: page,
|
||||||
license: licenseHtml,
|
license: licenseHtml,
|
||||||
thirdpartyLicenses: thirdpartyLicensesHtml
|
themeColor: constants.themeColor
|
||||||
}, {
|
}
|
||||||
themeColor: '#f76d6c'
|
|
||||||
})
|
|
||||||
}))
|
}))
|
||||||
.pipe(gulp.dest('./built/web/about/pages/' + Path.parse(page).dir));
|
.pipe(gulp.dest('./built/web/about/pages/' + Path.parse(page).dir));
|
||||||
});
|
});
|
||||||
|
@ -209,7 +193,7 @@ gulp.task('build:client:pug', [
|
||||||
gulp.src('./src/web/app/*/view.pug')
|
gulp.src('./src/web/app/*/view.pug')
|
||||||
.pipe(pug({
|
.pipe(pug({
|
||||||
locals: {
|
locals: {
|
||||||
themeColor: '#f76d6c'
|
themeColor: constants.themeColor
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
.pipe(gulp.dest('./built/web/app/'))
|
.pipe(gulp.dest('./built/web/app/'))
|
||||||
|
|
|
@ -59,7 +59,6 @@
|
||||||
"@types/rimraf": "0.0.28",
|
"@types/rimraf": "0.0.28",
|
||||||
"@types/riot": "2.6.1",
|
"@types/riot": "2.6.1",
|
||||||
"@types/serve-favicon": "2.2.28",
|
"@types/serve-favicon": "2.2.28",
|
||||||
"@types/twitter": "0.0.28",
|
|
||||||
"@types/uuid": "2.0.29",
|
"@types/uuid": "2.0.29",
|
||||||
"@types/webpack": "2.2.6",
|
"@types/webpack": "2.2.6",
|
||||||
"@types/webpack-stream": "3.2.6",
|
"@types/webpack-stream": "3.2.6",
|
||||||
|
@ -98,7 +97,6 @@
|
||||||
"gulp-imagemin": "3.1.1",
|
"gulp-imagemin": "3.1.1",
|
||||||
"gulp-pug": "3.2.0",
|
"gulp-pug": "3.2.0",
|
||||||
"gulp-rename": "1.2.2",
|
"gulp-rename": "1.2.2",
|
||||||
"gulp-replace": "0.5.4",
|
|
||||||
"gulp-tslint": "7.1.0",
|
"gulp-tslint": "7.1.0",
|
||||||
"gulp-typescript": "3.1.5",
|
"gulp-typescript": "3.1.5",
|
||||||
"gulp-uglify": "2.0.1",
|
"gulp-uglify": "2.0.1",
|
||||||
|
@ -126,14 +124,13 @@
|
||||||
"request": "2.79.0",
|
"request": "2.79.0",
|
||||||
"rimraf": "2.6.0",
|
"rimraf": "2.6.0",
|
||||||
"riot": "3.3.1",
|
"riot": "3.3.1",
|
||||||
"riot-compiler": "3.2.1",
|
|
||||||
"riot-tag-loader": "1.0.0",
|
"riot-tag-loader": "1.0.0",
|
||||||
"riotify": "2.0.0",
|
|
||||||
"rndstr": "1.0.0",
|
"rndstr": "1.0.0",
|
||||||
"s-age": "1.1.0",
|
"s-age": "1.1.0",
|
||||||
"serve-favicon": "2.4.0",
|
"serve-favicon": "2.4.0",
|
||||||
"string-replace-webpack-plugin": "0.0.5",
|
"string-replace-webpack-plugin": "0.0.5",
|
||||||
"stylus-loader": "^2.5.0",
|
"stylus": "0.54.5",
|
||||||
|
"stylus-loader": "2.5.0",
|
||||||
"subdomain": "1.2.0",
|
"subdomain": "1.2.0",
|
||||||
"summaly": "2.0.0",
|
"summaly": "2.0.0",
|
||||||
"swagger-jsdoc": "1.9.1",
|
"swagger-jsdoc": "1.9.1",
|
||||||
|
@ -145,7 +142,6 @@
|
||||||
"uuid": "3.0.1",
|
"uuid": "3.0.1",
|
||||||
"velocity-animate": "1.4.3",
|
"velocity-animate": "1.4.3",
|
||||||
"vhost": "3.0.2",
|
"vhost": "3.0.2",
|
||||||
"vinyl-named": "1.1.0",
|
|
||||||
"webpack": "2.2.1",
|
"webpack": "2.2.1",
|
||||||
"webpack-stream": "3.2.0",
|
"webpack-stream": "3.2.0",
|
||||||
"websocket": "1.0.24",
|
"websocket": "1.0.24",
|
||||||
|
|
3
src/const.json
Normal file
3
src/const.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"themeColor": "#f76d6c"
|
||||||
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
import * as webpack from 'webpack';
|
import * as webpack from 'webpack';
|
||||||
const StringReplacePlugin = require('string-replace-webpack-plugin');
|
const StringReplacePlugin = require('string-replace-webpack-plugin');
|
||||||
|
|
||||||
|
const constants = require('./src/const.json');
|
||||||
|
|
||||||
module.exports = (commit, env) => {
|
module.exports = (commit, env) => {
|
||||||
const isProduction = env === 'production';
|
const isProduction = env === 'production';
|
||||||
const isDebug = !isProduction;
|
const isDebug = !isProduction;
|
||||||
|
@ -21,7 +23,7 @@ module.exports = (commit, env) => {
|
||||||
loader: StringReplacePlugin.replace({
|
loader: StringReplacePlugin.replace({
|
||||||
replacements: [
|
replacements: [
|
||||||
{ pattern: /\$theme\-color\-foreground/g, replacement: () => '#fff' },
|
{ pattern: /\$theme\-color\-foreground/g, replacement: () => '#fff' },
|
||||||
{ pattern: /\$theme\-color/g, replacement: () => '#f76d6c' },
|
{ pattern: /\$theme\-color/g, replacement: () => constants.themeColor },
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -62,7 +64,7 @@ module.exports = (commit, env) => {
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
VERSION: JSON.stringify(commit ? commit.hash : null),
|
VERSION: JSON.stringify(commit ? commit.hash : null),
|
||||||
CONFIG: {
|
CONFIG: {
|
||||||
themeColor: JSON.stringify('#f76d6c')
|
themeColor: JSON.stringify(constants.themeColor)
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
new StringReplacePlugin(),
|
new StringReplacePlugin(),
|
||||||
|
|
Loading…
Reference in a new issue