const path = require('path');
const { execFileSync } = require('child_process');

const projectRoot = path.resolve(__dirname, '..');

try {
  execFileSync(process.execPath, [path.join(__dirname, 'bump-web-asset-version.js'), '--auto'], {
    cwd: projectRoot,
    stdio: 'inherit'
  });
} catch (error) {
  console.error('[asset:auto] 启动前自动版本同步失败，进程终止。');
  throw error;
}

require(path.join(projectRoot, 'server', 'index.js'));
