tachybase_todo/packages/plugins/@tachybase/plugin-china-region/build.config.ts
sealday ede7ead8b1 chore(version): release v0.21.34 (#1045)
Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1045
2024-05-24 01:06:06 +08:00

23 lines
635 B
TypeScript

import { existsSync } from 'fs';
import fs from 'fs/promises';
import path from 'path';
import { defineConfig } from '@tachybase/build';
export default defineConfig({
afterBuild: async (log) => {
const dir = path.resolve(__dirname, './dist/china-division');
if (existsSync(dir)) {
await fs.rm(dir, { recursive: true });
}
const keys = ['areas', 'cities', 'provinces'];
for (const key of keys) {
log(`coping ${key}.json`);
await fs.cp(require.resolve(`china-division/dist/${key}.json`), path.resolve(dir, `${key}.json`), {
recursive: true,
force: true,
});
}
},
});