Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(i18n): 翻訳ファイルのd.ts生成をbuild-assetsスクリプト内で実行する #11812

Merged
merged 2 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion locales/generateDTS.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import * as fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import * as yaml from 'js-yaml';
import * as ts from 'typescript';
import ts from 'typescript';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

function createMembers(record) {
return Object.entries(record)
Expand Down
5 changes: 0 additions & 5 deletions packages/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { type UserConfig, defineConfig } from 'vite';
import ReactivityTransform from '@vue-macros/reactivity-transform/vite';

import locales from '../../locales';
import generateDTS from '../../locales/generateDTS';
import meta from '../../package.json';
import pluginUnwindCssModuleClassName from './lib/rollup-plugin-unwind-css-module-class-name';
import pluginJson5 from './vite.json5';
Expand Down Expand Up @@ -67,10 +66,6 @@ export function getConfig(): UserConfig {
}),
]
: [],
{
name: 'locale:generateDTS',
buildStart: generateDTS,
},
],

resolve: {
Expand Down
3 changes: 3 additions & 0 deletions scripts/build-assets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import postcss from 'postcss';
import * as terser from 'terser';

import locales from '../locales/index.js';
import generateDTS from '../locales/generateDTS.js';
import meta from '../package.json' assert { type: "json" };

async function copyFrontendFonts() {
Expand All @@ -21,6 +22,8 @@ async function copyFrontendTablerIcons() {
}

async function copyFrontendLocales() {
generateDTS();

await fs.mkdir('./built/_frontend_dist_/locales', { recursive: true });

const v = { '_version_': meta.version };
Expand Down
Loading