整理した

This commit is contained in:
syuilo 2018-03-29 20:32:18 +09:00
parent 8a279a4656
commit cf33e483f7
552 changed files with 360 additions and 1311 deletions

View file

@ -39,10 +39,9 @@ if (isDebug) {
const constants = require('./src/const.json'); const constants = require('./src/const.json');
require('./src/server/web/docs/gulpfile.ts'); require('./src/client/docs/gulpfile.ts');
gulp.task('build', [ gulp.task('build', [
'build:js',
'build:ts', 'build:ts',
'build:copy', 'build:copy',
'build:client', 'build:client',
@ -51,11 +50,6 @@ gulp.task('build', [
gulp.task('rebuild', ['clean', 'build']); gulp.task('rebuild', ['clean', 'build']);
gulp.task('build:js', () =>
gulp.src(['./src/**/*.js', '!./src/server/web/**/*.js'])
.pipe(gulp.dest('./built/'))
);
gulp.task('build:ts', () => { gulp.task('build:ts', () => {
const tsProject = ts.createProject('./tsconfig.json'); const tsProject = ts.createProject('./tsconfig.json');
@ -71,7 +65,7 @@ gulp.task('build:copy', () =>
gulp.src([ gulp.src([
'./build/Release/crypto_key.node', './build/Release/crypto_key.node',
'./src/**/assets/**/*', './src/**/assets/**/*',
'!./src/server/web/app/**/assets/**/*' '!./src/client/app/**/assets/**/*'
]).pipe(gulp.dest('./built/')) ]).pipe(gulp.dest('./built/'))
); );
@ -114,29 +108,28 @@ gulp.task('default', ['build']);
gulp.task('build:client', [ gulp.task('build:client', [
'build:ts', 'build:ts',
'build:js',
'build:client:script', 'build:client:script',
'build:client:pug', 'build:client:pug',
'copy:client' 'copy:client'
]); ]);
gulp.task('build:client:script', () => gulp.task('build:client:script', () =>
gulp.src(['./src/server/web/app/boot.js', './src/server/web/app/safe.js']) gulp.src(['./src/client/app/boot.js', './src/client/app/safe.js'])
.pipe(replace('VERSION', JSON.stringify(version))) .pipe(replace('VERSION', JSON.stringify(version)))
.pipe(replace('API', JSON.stringify(config.api_url))) .pipe(replace('API', JSON.stringify(config.api_url)))
.pipe(replace('ENV', JSON.stringify(env))) .pipe(replace('ENV', JSON.stringify(env)))
.pipe(isProduction ? uglify({ .pipe(isProduction ? uglify({
toplevel: true toplevel: true
} as any) : gutil.noop()) } as any) : gutil.noop())
.pipe(gulp.dest('./built/server/web/assets/')) as any .pipe(gulp.dest('./built/client/assets/')) as any
); );
gulp.task('build:client:styles', () => gulp.task('build:client:styles', () =>
gulp.src('./src/server/web/app/init.css') gulp.src('./src/client/app/init.css')
.pipe(isProduction .pipe(isProduction
? (cssnano as any)() ? (cssnano as any)()
: gutil.noop()) : gutil.noop())
.pipe(gulp.dest('./built/server/web/assets/')) .pipe(gulp.dest('./built/client/assets/'))
); );
gulp.task('copy:client', [ gulp.task('copy:client', [
@ -144,14 +137,14 @@ gulp.task('copy:client', [
], () => ], () =>
gulp.src([ gulp.src([
'./assets/**/*', './assets/**/*',
'./src/server/web/assets/**/*', './src/client/assets/**/*',
'./src/server/web/app/*/assets/**/*' './src/client/app/*/assets/**/*'
]) ])
.pipe(isProduction ? (imagemin as any)() : gutil.noop()) .pipe(isProduction ? (imagemin as any)() : gutil.noop())
.pipe(rename(path => { .pipe(rename(path => {
path.dirname = path.dirname.replace('assets', '.'); path.dirname = path.dirname.replace('assets', '.');
})) }))
.pipe(gulp.dest('./built/server/web/assets/')) .pipe(gulp.dest('./built/client/assets/'))
); );
gulp.task('build:client:pug', [ gulp.task('build:client:pug', [
@ -159,13 +152,13 @@ gulp.task('build:client:pug', [
'build:client:script', 'build:client:script',
'build:client:styles' 'build:client:styles'
], () => ], () =>
gulp.src('./src/server/web/app/base.pug') gulp.src('./src/client/app/base.pug')
.pipe(pug({ .pipe(pug({
locals: { locals: {
themeColor: constants.themeColor, themeColor: constants.themeColor,
facss: fa.dom.css(), facss: fa.dom.css(),
//hljscss: fs.readFileSync('./node_modules/highlight.js/styles/default.css', 'utf8') //hljscss: fs.readFileSync('./node_modules/highlight.js/styles/default.css', 'utf8')
hljscss: fs.readFileSync('./src/server/web/assets/code-highlight.css', 'utf8') hljscss: fs.readFileSync('./src/client/assets/code-highlight.css', 'utf8')
} }
})) }))
.pipe(htmlmin({ .pipe(htmlmin({
@ -200,5 +193,5 @@ gulp.task('build:client:pug', [
// CSSも圧縮する // CSSも圧縮する
minifyCSS: true minifyCSS: true
})) }))
.pipe(gulp.dest('./built/server/web/app/')) .pipe(gulp.dest('./built/client/app/'))
); );

View file

Before

Width:  |  Height:  |  Size: 646 B

After

Width:  |  Height:  |  Size: 646 B

View file

@ -14,12 +14,12 @@ html
title Misskey title Misskey
style style
include ./../../../../built/server/web/assets/init.css include ./../../../built/client/assets/init.css
script script
include ./../../../../built/server/web/assets/boot.js include ./../../../built/client/assets/boot.js
script script
include ./../../../../built/server/web/assets/safe.js include ./../../../built/client/assets/safe.js
//- FontAwesome style //- FontAwesome style
style #{facss} style #{facss}

Some files were not shown because too many files have changed in this diff Show more