mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-29 13:27:31 -07:00
wip
This commit is contained in:
parent
d5309803be
commit
1254e3108b
3 changed files with 11 additions and 32 deletions
17
gulpfile.ts
17
gulpfile.ts
|
@ -33,15 +33,6 @@ if (isDebug) {
|
|||
console.log(chalk.yellow.bold('!!!注意!!! 開発モードが有効です。(成果物の圧縮などはスキップされます)'));
|
||||
}
|
||||
|
||||
if (!fs.existsSync('./.config/default.yml')) {
|
||||
console.log('npm run configを実行して設定ファイルを作成してください');
|
||||
process.exit();
|
||||
}
|
||||
|
||||
(global as any).MISSKEY_CONFIG_PATH = '.config/default.yml';
|
||||
import { Config } from './src/config';
|
||||
const config = eval(require('typescript').transpile(require('fs').readFileSync('./src/config.ts').toString()))() as Config;
|
||||
|
||||
const tsProject = ts.createProject('tsconfig.json');
|
||||
|
||||
gulp.task('build', [
|
||||
|
@ -102,7 +93,9 @@ gulp.task('build:about:docs', () => {
|
|||
path: page,
|
||||
license: licenseHtml,
|
||||
thirdpartyLicenses: thirdpartyLicensesHtml
|
||||
}, config)
|
||||
}, {
|
||||
themeColor: '#f76d6c'
|
||||
})
|
||||
}))
|
||||
.pipe(gulp.dest('./built/web/about/pages/' + Path.parse(page).dir));
|
||||
});
|
||||
|
@ -154,7 +147,7 @@ gulp.task('build:client:scripts', () => new Promise(async (ok) => {
|
|||
// Get commit info
|
||||
const commit = await prominence(git).getLastCommit();
|
||||
|
||||
let stream = webpack(require('./webpack.config.js')(config, commit, env), require('webpack'));
|
||||
let stream = webpack(require('./webpack.config.js')(commit, env), require('webpack'));
|
||||
|
||||
// TODO: remove this block
|
||||
if (isProduction) {
|
||||
|
@ -220,7 +213,7 @@ gulp.task('build:client:pug', [
|
|||
gulp.src('./src/web/app/*/view.pug')
|
||||
.pipe(pug({
|
||||
locals: {
|
||||
themeColor: config.themeColor
|
||||
themeColor: '#f76d6c'
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('./built/web/app/'))
|
||||
|
|
|
@ -14,11 +14,9 @@ const dir = `${__dirname}/../.config`;
|
|||
/**
|
||||
* Path of configuration file
|
||||
*/
|
||||
export const path = (global as any).MISSKEY_CONFIG_PATH
|
||||
? (global as any).MISSKEY_CONFIG_PATH
|
||||
: process.env.NODE_ENV == 'test'
|
||||
? `${dir}/test.yml`
|
||||
: `${dir}/default.yml`;
|
||||
export const path = process.env.NODE_ENV == 'test'
|
||||
? `${dir}/test.yml`
|
||||
: `${dir}/default.yml`;
|
||||
|
||||
/**
|
||||
* ユーザーが設定する必要のある情報
|
||||
|
@ -71,8 +69,6 @@ interface Source {
|
|||
* Misskeyが自動的に(ユーザーが設定した情報から推論して)設定する情報
|
||||
*/
|
||||
interface Mixin {
|
||||
themeColor: string;
|
||||
themeColorForeground: string;
|
||||
host: string;
|
||||
scheme: string;
|
||||
secondary_host: string;
|
||||
|
@ -98,8 +94,6 @@ export default function load() {
|
|||
config.url = normalizeUrl(config.url);
|
||||
config.secondary_url = normalizeUrl(config.secondary_url);
|
||||
|
||||
mixin.themeColor = '#f76d6c';
|
||||
mixin.themeColorForeground = '#fff';
|
||||
mixin.host = config.url.substr(config.url.indexOf('://') + 3);
|
||||
mixin.scheme = config.url.substr(0, config.url.indexOf('://'));
|
||||
mixin.secondary_host = config.secondary_url.substr(config.secondary_url.indexOf('://') + 3);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as webpack from 'webpack';
|
||||
const StringReplacePlugin = require('string-replace-webpack-plugin');
|
||||
|
||||
module.exports = (config, commit, env) => {
|
||||
module.exports = (commit, env) => {
|
||||
const isProduction = env === 'production';
|
||||
const isDebug = !isProduction;
|
||||
|
||||
|
@ -21,7 +21,7 @@ module.exports = (config, commit, env) => {
|
|||
loader: StringReplacePlugin.replace({
|
||||
replacements: [
|
||||
{ pattern: /\$theme\-color\-foreground/g, replacement: () => '#fff' },
|
||||
{ pattern: /\$theme\-color/g, replacement: () => config.themeColor },
|
||||
{ pattern: /\$theme\-color/g, replacement: () => '#f76d6c' },
|
||||
]
|
||||
})
|
||||
},
|
||||
|
@ -62,15 +62,7 @@ module.exports = (config, commit, env) => {
|
|||
new webpack.DefinePlugin({
|
||||
VERSION: JSON.stringify(commit ? commit.hash : null),
|
||||
CONFIG: {
|
||||
themeColor: JSON.stringify(config.themeColor),
|
||||
apiUrl: JSON.stringify(config.api_url),
|
||||
aboutUrl: JSON.stringify(config.about_url),
|
||||
devUrl: JSON.stringify(config.dev_url),
|
||||
host: JSON.stringify(config.host),
|
||||
url: JSON.stringify(config.url),
|
||||
recaptcha: {
|
||||
siteKey: JSON.stringify(config.recaptcha.siteKey),
|
||||
}
|
||||
themeColor: JSON.stringify('#f76d6c')
|
||||
}
|
||||
}),
|
||||
new StringReplacePlugin(),
|
||||
|
|
Loading…
Reference in a new issue