mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-03-21 03:30:42 +00:00
enhance(backend): pugをやめ、JSXベースのテンプレートに変更 (#16908)
* enhance(backend): pugをやめ、JSXベースのテンプレートに変更 (to misskey-dev dev branch) (#16889)
* wip
* wip
* wip
* wip
* fix lint
* attempt to fix test
* fix
* fix
* fix: oauthページの描画がおかしい問題を修正
* typo [ci skip]
* fix
* fix
* fix
* fix
* fix
* refactor
* fix
* fix
* fix broken lockfile
* fix: expose supported languages as global variable
* remove i18n package from root as it is no longer required [ci skip]
* fix
* fix: add i18n package.json to Docker target-builder stage for federation tests (#16909)
* Initial plan
* fix: add i18n package.json to Docker target-builder stage for federation tests
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
* fix: followup-test-federation for enh-remove-pug (#16910)
* fix: followup-test-federation for enh-remove-pug
* Revert "fix: add i18n package.json to Docker target-builder stage for federation tests (#16909)"
This reverts commit 14313468d3.
* fix: CSSが読み込まれない場合がある問題を修正
* fix [ci skip]
* fix: propsのデフォルト値をnull合体演算子から論理和演算子に変更(空文字に対処するため)
* remove @types/pug
* enhance: bootloaderを埋め込むように
* fix possible race condition
* remove esbuild
---------
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Co-authored-by: おさむのひと <46447427+samunohito@users.noreply.github.com>
This commit is contained in:
@@ -6,12 +6,7 @@
|
||||
import * as fs from 'node:fs/promises';
|
||||
import * as path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import cssnano from 'cssnano';
|
||||
import * as yaml from 'js-yaml';
|
||||
import postcss from 'postcss';
|
||||
import * as terser from 'terser';
|
||||
|
||||
import { locales } from 'i18n';
|
||||
import buildTarball from './tarball.mjs';
|
||||
|
||||
const configDir = fileURLToPath(new URL('../.config', import.meta.url));
|
||||
@@ -29,49 +24,9 @@ async function copyFrontendFonts() {
|
||||
await fs.cp('./packages/frontend/node_modules/three/examples/fonts', './built/_frontend_dist_/fonts', { dereference: true, recursive: true });
|
||||
}
|
||||
|
||||
async function copyBackendViews() {
|
||||
await fs.cp('./packages/backend/src/server/web/views', './packages/backend/built/server/web/views', { recursive: true });
|
||||
}
|
||||
|
||||
async function buildBackendScript() {
|
||||
await fs.mkdir('./packages/backend/built/server/web', { recursive: true });
|
||||
|
||||
for (const file of [
|
||||
'./packages/backend/src/server/web/boot.js',
|
||||
'./packages/backend/src/server/web/boot.embed.js',
|
||||
'./packages/backend/src/server/web/bios.js',
|
||||
'./packages/backend/src/server/web/cli.js',
|
||||
'./packages/backend/src/server/web/error.js',
|
||||
]) {
|
||||
let source = await fs.readFile(file, { encoding: 'utf-8' });
|
||||
source = source.replaceAll('LANGS', JSON.stringify(Object.keys(locales)));
|
||||
const { code } = await terser.minify(source, { toplevel: true });
|
||||
await fs.writeFile(`./packages/backend/built/server/web/${path.basename(file)}`, code);
|
||||
}
|
||||
}
|
||||
|
||||
async function buildBackendStyle() {
|
||||
await fs.mkdir('./packages/backend/built/server/web', { recursive: true });
|
||||
|
||||
for (const file of [
|
||||
'./packages/backend/src/server/web/style.css',
|
||||
'./packages/backend/src/server/web/style.embed.css',
|
||||
'./packages/backend/src/server/web/bios.css',
|
||||
'./packages/backend/src/server/web/cli.css',
|
||||
'./packages/backend/src/server/web/error.css'
|
||||
]) {
|
||||
const source = await fs.readFile(file, { encoding: 'utf-8' });
|
||||
const { css } = await postcss([cssnano({ zindex: false })]).process(source, { from: undefined });
|
||||
await fs.writeFile(`./packages/backend/built/server/web/${path.basename(file)}`, css);
|
||||
}
|
||||
}
|
||||
|
||||
async function build() {
|
||||
await Promise.all([
|
||||
copyFrontendFonts(),
|
||||
copyBackendViews(),
|
||||
buildBackendScript(),
|
||||
buildBackendStyle(),
|
||||
loadConfig().then(config => config?.publishTarballInsteadOfProvideRepositoryUrl && buildTarball()),
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user