Files
fitness-coach/backend/scripts/copy-data.mjs
wm b3b58e66fb feat: init fitness-coach (backend + miniprogram)
- backend: NestJS service with exercise/plan data
- miniprogram: WeChat mini program client
- exclude node_modules, dist, runtime data-store, local env
2026-07-22 00:35:40 +08:00

21 lines
761 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 将原始数据集 exercises.json 从 src 复制到编译产物 dist
// 因为 tsc 不会拷贝非 .ts 资源文件。
import * as fs from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const root = path.resolve(__dirname, '..');
const src = path.join(root, 'src', 'exercises', 'data', 'exercises.json');
const destDir = path.join(root, 'dist', 'exercises', 'data');
const dest = path.join(destDir, 'exercises.json');
if (!fs.existsSync(src)) {
console.warn('[copy-data] 源数据集不存在,跳过:', src);
process.exit(0);
}
fs.mkdirSync(destDir, { recursive: true });
fs.copyFileSync(src, dest);
console.log('[copy-data] 已复制数据集 ->', dest);