'use strict';
import { configureUser, configureCiToken, fetchQuiet, mergeOriginMain } from '../tools/git.js';
import { cliLogInfo, cliLogSeparator } from '../../../fd-toolbox/logging/cli-logger.js';
import { branches } from '../../../base-repo/app-constants/internal-system-constants.js';
import { environmentVariables, ciLogMessages } from '../constants/ci-constants.js';
import { execSyncCommand } from '../tools/exec.js';
import { npmCommands } from '../constants/npm-commands.js';
import { gitRestoreDependencyFiles } from '../constants/job-constants.js';
import { getStringEnvSetting } from '../../../fd-toolbox/infra/env-functions.js';

var __defProp=Object['defineProperty'],__name=(_0x264949,_0x40b27b)=>__defProp(_0x264949,'name',{'value':_0x40b27b,'configurable':!![]});async function externalPrepareEnvironment(_0x14abab){const _0x5ae535=getStringEnvSetting(environmentVariables['ciCommitRefName']);cliLogInfo(ciLogMessages['configuringGitSettings']),configureUser(),configureCiToken(),cliLogSeparator(),cliLogInfo('[1.2]\x20Merging\x20\x27'+branches['main']+'\x27\x20into\x20branch\x20\x27'+_0x5ae535+'\x27...'),execSyncCommand(gitRestoreDependencyFiles),fetchQuiet(process['cwd']()),mergeOriginMain(process['cwd']()),cliLogSeparator(),cliLogInfo('[1.3]\x20Installing\x20dependencies...'),execSyncCommand(npmCommands['pnpmAdd']+'\x20'+_0x14abab),cliLogSeparator(),cliLogInfo('[1.4]\x20Generating\x20meta\x20and\x20schema...'),execSyncCommand(npmCommands['genMeta']),execSyncCommand(npmCommands['genSchema']),cliLogSeparator();}__name(externalPrepareEnvironment,'externalPrepareEnvironment');

export { externalPrepareEnvironment };
