mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
build: update cli (#3374)
This commit is contained in:
@@ -3,6 +3,7 @@ import path from 'node:path';
|
||||
|
||||
import type { BuildFlags } from '../config/index.js';
|
||||
import { projectRoot } from '../config/index.js';
|
||||
import { buildI18N } from '../util/i18n.js';
|
||||
|
||||
const cwd = path.resolve(projectRoot, 'apps', 'core');
|
||||
|
||||
@@ -43,6 +44,7 @@ const flags = {
|
||||
coverage: process.env.COVERAGE === 'true',
|
||||
} satisfies BuildFlags;
|
||||
|
||||
buildI18N();
|
||||
spawn(
|
||||
'node',
|
||||
[
|
||||
|
||||
@@ -6,6 +6,7 @@ import * as p from '@clack/prompts';
|
||||
import { config } from 'dotenv';
|
||||
|
||||
import { type BuildFlags, projectRoot } from '../config/index.js';
|
||||
import { watchI18N } from '../util/i18n.js';
|
||||
|
||||
const files = ['.env', '.env.local'];
|
||||
|
||||
@@ -91,6 +92,7 @@ flags.mode = buildFlags.mode as any;
|
||||
flags.channel = buildFlags.channel as any;
|
||||
flags.coverage = buildFlags.coverage;
|
||||
|
||||
watchI18N();
|
||||
spawn(
|
||||
'node',
|
||||
[
|
||||
|
||||
32
packages/cli/src/util/i18n.ts
Normal file
32
packages/cli/src/util/i18n.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
import { runCli } from '@magic-works/i18n-codegen';
|
||||
|
||||
import { projectRoot } from '../config/index.js';
|
||||
|
||||
const configPath = resolve(projectRoot, '.i18n-codegen.json');
|
||||
|
||||
export const watchI18N = () => {
|
||||
runCli(
|
||||
{
|
||||
config: configPath,
|
||||
watch: true,
|
||||
},
|
||||
error => {
|
||||
console.error(error);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export const buildI18N = () => {
|
||||
runCli(
|
||||
{
|
||||
config: configPath,
|
||||
watch: false,
|
||||
},
|
||||
error => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
}
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user