-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathtsup.config.ts
30 lines (27 loc) · 944 Bytes
/
tsup.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { defineConfig } from 'tsup';
import fs from 'fs';
import path from 'path';
export default defineConfig({
entry: ['src/index.ts'],
format: ['esm'],
dts: true,
clean: true,
outDir: 'dist',
// Copy the employee-sqlite resources to dist
async onSuccess() {
// Create target directory
const targetDir = path.join('dist', 'resources', 'employee-sqlite');
fs.mkdirSync(targetDir, { recursive: true });
// Copy all SQL files from resources/employee-sqlite to dist/resources/employee-sqlite
const sourceDir = path.join('resources', 'employee-sqlite');
const files = fs.readdirSync(sourceDir);
for (const file of files) {
if (file.endsWith('.sql')) {
const sourcePath = path.join(sourceDir, file);
const targetPath = path.join(targetDir, file);
fs.copyFileSync(sourcePath, targetPath);
console.log(`Copied ${sourcePath} to ${targetPath}`);
}
}
},
});