'use strict';
import { execSyncCommand } from '../../ci/tools/exec.js';
import { environmentVariables } from '../../ci/constants/ci-constants.js';
import { systemCommands, npmCommands, npxCommands } from '../../ci/constants/npm-commands.js';
import { appEnvironments } from '../../../fd-toolbox/constants/environment-constants.js';
import { folders, generatedPaths, files } from '../../../base-repo/app-constants/project-paths.js';
import { defaultRegistry } from './deploy-constants.js';
import { mkdirSync } from 'fs';

var __defProp=Object['defineProperty'],__name=(_0x3bd955,_0x3b5ee0)=>__defProp(_0x3bd955,'name',{'value':_0x3b5ee0,'configurable':!![]});function commonSetup(_0xabf932,_0x2f9ebc){process['env'][environmentVariables['nodeEnv']]=appEnvironments['production'],execSyncCommand(systemCommands['removeRecursive']+'\x20'+folders['dotNext'],_0x2f9ebc),execSyncCommand(systemCommands['removeRecursive']+'\x20'+_0xabf932,_0x2f9ebc),genMetaAndSchema(_0x2f9ebc),mkdirSync(_0xabf932+'/'+folders['generated'],{'recursive':!![]}),mkdirSync(_0xabf932+'/'+folders['generated']+'/'+folders['meta'],{'recursive':!![]}),mkdirSync(_0xabf932+'/'+folders['server'],{'recursive':!![]});}__name(commonSetup,'commonSetup');function genMetaAndSchema(_0x28cac0){execSyncCommand(npmCommands['genMeta'],_0x28cac0),execSyncCommand(npmCommands['genSchema'],_0x28cac0);}__name(genMetaAndSchema,'genMetaAndSchema');function copyFiles(_0x178b1d,_0x52b4fa){execSyncCommand(systemCommands['copy']+'\x20'+generatedPaths['metaJson']+'\x20'+_0x178b1d+'/'+generatedPaths['metaJson'],_0x52b4fa),execSyncCommand(systemCommands['copy']+'\x20'+generatedPaths['schema']+'\x20'+_0x178b1d+'/'+generatedPaths['schema'],_0x52b4fa),execSyncCommand(systemCommands['copy']+'\x20'+files['packageJson']+'\x20'+_0x178b1d+'/'+files['packageJson'],_0x52b4fa),execSyncCommand(systemCommands['copy']+'\x20'+files['pnpmLock']+'\x20'+_0x178b1d+'/'+files['pnpmLock']),execSyncCommand(systemCommands['copy']+'\x20'+files['envStaging']+'\x20'+_0x178b1d+'/'+files['dotEnv']),execSyncCommand(systemCommands['copyRecursive']+'\x20'+folders['public']+'\x20'+_0x178b1d+'/'+folders['public']);}__name(copyFiles,'copyFiles');function buildAndCopyNextAndInitDb(_0x39e51a,_0x5c53d2,_0x39cf9a){execSyncCommand(npmCommands['build'],_0x39cf9a),execSyncCommand(systemCommands['copyRecursive']+'\x20'+folders['dotNext']+'\x20'+_0x39e51a+'/'+folders['dotNext'],_0x39cf9a),execSyncCommand(npxCommands['npxTsx']+'\x20'+_0x5c53d2);}__name(buildAndCopyNextAndInitDb,'buildAndCopyNextAndInitDb');function dockerBuildAndPush(_0x4403d4,_0x2777b2,_0x2d1557,_0xd47b47,_0x1c8d63){const _0x31e243=_0x1c8d63??defaultRegistry;execSyncCommand(systemCommands['dockerBuild']+'\x20'+_0x31e243+'/'+_0x4403d4+'\x20-f\x20'+_0x2777b2+'\x20.'),execSyncCommand(systemCommands['dockerPush']+'\x20'+_0x31e243+'/'+_0x4403d4),execSyncCommand(systemCommands['dockerBuild']+'\x20-t\x20'+_0x31e243+'/'+_0x2d1557+'\x20-f\x20'+_0xd47b47+'\x20.'),execSyncCommand(systemCommands['dockerPush']+'\x20'+_0x31e243+'/'+_0x2d1557);}__name(dockerBuildAndPush,'dockerBuildAndPush');

export { buildAndCopyNextAndInitDb, commonSetup, copyFiles, dockerBuildAndPush, genMetaAndSchema };
