tachybase_todo/packages/plugins/@nocobase/plugin-china-region/build.config.ts
jack zhang 9e5e96b9e4
fix: improve build (#2643)
* fix: client lib require wrapper

* fix: bug

* fix: add tsconfig.paths.json

* fix: collection dir not exists

* fix: improve...

* fix: update yarn.lock

* fix: db.sync

* fix: bugs

* fix: bugs

* fix: bugs

* fix: bugs && allow user custom build config

* docs: user custom config docs

* refactor: custom user build config

* fix: bugs

* fix: build plugin-client bug

---------

Co-authored-by: chenos <chenlinxh@gmail.com>
2023-09-15 08:51:20 +08:00

24 lines
635 B
TypeScript

import { defineConfig } from '@nocobase/build';
import fs from 'fs/promises';
import path from 'path';
import { existsSync } from 'fs';
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,
});
}
},
});