mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 09:36:17 +08:00
refactor(infra): directory structure (#4615)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
import { spawn } from 'node:child_process';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
import { build } from 'vite';
|
||||
|
||||
import { projectRoot } from '../config/index.js';
|
||||
|
||||
const infraFilePath = resolve(
|
||||
projectRoot,
|
||||
'packages',
|
||||
'infra',
|
||||
'vite.config.ts'
|
||||
);
|
||||
const pluginInfraFilePath = resolve(
|
||||
projectRoot,
|
||||
'packages',
|
||||
'plugin-infra',
|
||||
'vite.config.ts'
|
||||
);
|
||||
|
||||
export const buildInfra = async () => {
|
||||
await build({
|
||||
configFile: infraFilePath,
|
||||
});
|
||||
await build({
|
||||
configFile: pluginInfraFilePath,
|
||||
});
|
||||
};
|
||||
|
||||
export const watchInfra = async () => {
|
||||
spawn('vite', ['build', '--watch'], {
|
||||
cwd: resolve(projectRoot, 'packages/common/infra'),
|
||||
shell: true,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
spawn('vite', ['build', '--watch'], {
|
||||
cwd: resolve(projectRoot, 'packages/plugin-infra'),
|
||||
shell: true,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user