'use strict';
const fs = require('fs');
const path = require('path');
const PLUGIN_FILE = 'rnoh-hvigor-plugin-0.3.0.tgz';
const projectDir = process.cwd();
const source = path.join(projectDir, 'node_modules', '@react-native-oh', 'react-native-harmony-cli', 'harmony', PLUGIN_FILE);
const target = path.join(projectDir, 'harmony', 'hvigor', PLUGIN_FILE);
if (fs.existsSync(target)) {
console.log(`[hvigor] keep existing ${path.relative(projectDir, target)}`);
process.exit(0);
}
if (!fs.existsSync(source)) {
console.log(`[hvigor] skip ${PLUGIN_FILE}: @react-native-oh/react-native-harmony-cli is not installed yet.`);
process.exit(0);
}
fs.mkdirSync(path.dirname(target), { recursive: true });
fs.copyFileSync(source, target);
console.log(`[hvigor] provisioned ${path.relative(projectDir, target)} from ${path.relative(projectDir, source)}`);