mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-06 02:26:04 +02:00
* deps: Update vite to v8 * fix * migrate some plugins to rolldown-based * fix broken lockfile * wip * update rolldown * override rolldown version * perf * spdx * fix * update vite to 8.0.1 * chore: rewrite rollup-plugin-unwind-css-module-class-name with MagicString * format * swap type definitions * replace using MagicString * provided magicString * fix code style * fix * fix * fix * fix * fix --------- Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> * fix: lint fixes * swap sass with sass-embedded * fix lint * fix: インライン化されたVue SFC出力に対してCSS Module定義削除が効かないのを修正 * fix * fix: バックエンドのCSS読み込みの方法が悪いのを修正 * fix: 使用されないpreloadを削除 * fix lint [ci skip] * Apply suggestion from @syuilo * Add comment in pnpm-workspace.yaml [ci skip] * update vite/rolldown * remove magic-string --------- Co-authored-by: cm-ayf <cm.ayf2734@gmail.com> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import * as fs from 'fs/promises';
|
|
import url from 'node:url';
|
|
import path from 'node:path';
|
|
import { execa } from 'execa';
|
|
import locales from 'i18n';
|
|
import { LocaleInliner } from '../frontend-builder/locale-inliner.js';
|
|
import { createLogger } from '../frontend-builder/logger';
|
|
|
|
// requires node 21 or later
|
|
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
const outputDir = __dirname + '/../../built/_frontend_embed_vite_';
|
|
|
|
/**
|
|
* @return {Promise<void>}
|
|
*/
|
|
async function viteBuild() {
|
|
await execa('vite', ['build'], {
|
|
cwd: __dirname,
|
|
stdout: process.stdout,
|
|
stderr: process.stderr,
|
|
});
|
|
}
|
|
|
|
|
|
async function buildAllLocale() {
|
|
const logger = createLogger()
|
|
const inliner = await LocaleInliner.create({
|
|
outputDir,
|
|
logger,
|
|
scriptsDir: 'scripts',
|
|
i18nFile: 'src/i18n.ts',
|
|
})
|
|
|
|
await inliner.loadFiles();
|
|
|
|
inliner.collectsModifications();
|
|
|
|
await inliner.saveAllLocales(locales);
|
|
|
|
if (logger.errorCount > 0) {
|
|
throw new Error(`Build failed with ${logger.errorCount} errors and ${logger.warningCount} warnings.`);
|
|
}
|
|
}
|
|
|
|
async function build() {
|
|
await fs.rm(outputDir, { recursive: true, force: true });
|
|
await viteBuild();
|
|
await buildAllLocale();
|
|
}
|
|
|
|
await build();
|