mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
Refactoring
This commit is contained in:
parent
a234a06206
commit
4feb8abc59
24
gulpfile.ts
24
gulpfile.ts
@ -20,7 +20,7 @@ import imagemin = require('gulp-imagemin');
|
||||
import * as rename from 'gulp-rename';
|
||||
import * as mocha from 'gulp-mocha';
|
||||
import * as replace from 'gulp-replace';
|
||||
import getVersion from './src/version';
|
||||
import version from './src/version';
|
||||
|
||||
const env = process.env.NODE_ENV;
|
||||
const isProduction = env === 'production';
|
||||
@ -129,21 +129,16 @@ gulp.task('build:client', [
|
||||
'copy:client'
|
||||
]);
|
||||
|
||||
gulp.task('build:client:scripts', done => {
|
||||
getVersion.then(version => {
|
||||
require('./webpack.config').then(webpackOptions => {
|
||||
gulp.task('build:client:scripts', () =>
|
||||
es.merge(
|
||||
webpack(webpackOptions, require('webpack'))
|
||||
webpack(require('./webpack.config'), require('webpack'))
|
||||
.pipe(gulp.dest('./built/web/assets/')) as any,
|
||||
gulp.src('./src/web/app/client/script.js')
|
||||
.pipe(replace('VERSION', JSON.stringify(version)))
|
||||
//.pipe(isProduction ? uglify() : gutil.noop())
|
||||
.pipe(gulp.dest('./built/web/assets/client/')) as any
|
||||
);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task('build:client:styles', () =>
|
||||
gulp.src('./src/web/app/init.css')
|
||||
@ -172,8 +167,7 @@ gulp.task('build:client:pug', [
|
||||
'copy:client',
|
||||
'build:client:scripts',
|
||||
'build:client:styles'
|
||||
], done => {
|
||||
getVersion.then(version => {
|
||||
], () =>
|
||||
gulp.src('./src/web/app/*/view.pug')
|
||||
.pipe(pug({
|
||||
locals: {
|
||||
@ -181,7 +175,5 @@ gulp.task('build:client:pug', [
|
||||
themeColor: constants.themeColor
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('./built/web/app/'));
|
||||
done();
|
||||
});
|
||||
});
|
||||
.pipe(gulp.dest('./built/web/app/'))
|
||||
);
|
||||
|
@ -1,9 +1,7 @@
|
||||
const getVersion = new Promise<string>(async resolve => {
|
||||
const ぱっけーじ = require('../package.json');
|
||||
/**
|
||||
* Version
|
||||
*/
|
||||
|
||||
const version = ぱっけーじ.version;
|
||||
const meta = require('../package.json');
|
||||
|
||||
resolve(version);
|
||||
});
|
||||
|
||||
export default getVersion;
|
||||
export default meta.version as string;
|
||||
|
@ -4,16 +4,13 @@
|
||||
|
||||
import * as webpack from 'webpack';
|
||||
const StringReplacePlugin = require('string-replace-webpack-plugin');
|
||||
import getVersion from './src/version';
|
||||
import version from './src/version';
|
||||
const constants = require('./src/const.json');
|
||||
|
||||
const env = process.env.NODE_ENV;
|
||||
const isProduction = env === 'production';
|
||||
|
||||
module.exports = new Promise(async resolve => {
|
||||
const version = await getVersion.then();
|
||||
|
||||
const pack: webpack.Configuration = {
|
||||
const pack: webpack.Configuration = {
|
||||
entry: {
|
||||
'desktop': './src/web/app/desktop/script.js',
|
||||
'mobile': './src/web/app/mobile/script.js',
|
||||
@ -70,11 +67,10 @@ module.exports = new Promise(async resolve => {
|
||||
output: {
|
||||
filename: `[name]/script.${version}.js`
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
if (isProduction) {
|
||||
if (isProduction) {
|
||||
//pack.plugins.push(new webpack.optimize.UglifyJsPlugin());
|
||||
}
|
||||
}
|
||||
|
||||
resolve(pack);
|
||||
});
|
||||
module.exports = pack;
|
||||
|
Loading…
Reference in New Issue
Block a user