refactor(infra): directory structure (#4615)

This commit is contained in:
Joooye_34
2023-10-18 23:30:08 +08:00
committed by GitHub
parent 814d552be8
commit bed9310519
1150 changed files with 539 additions and 584 deletions
+32
View 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);
}
);
};
+41
View File
@@ -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',
});
};