rewrite consumer + testmode utils

This commit is contained in:
Emily
2025-02-01 15:26:26 +01:00
parent 4da840f2ec
commit 0963201a32
12 changed files with 135 additions and 40 deletions

View File

@@ -1,6 +1,7 @@
import fs from 'fs-extra';
import path from 'path';
import child from 'child_process';
import { createZip } from '../helpers/zip-helper';
import { DeployHelper } from '../helpers/deploy-helper';
import { REMOTE_HOST_TESTMODE } from '../.config';
@@ -11,6 +12,8 @@ const REMOTE_PATH = '/home/litlyx/producer';
const ZIP_NAME = 'producer.zip';
const MODE = DeployHelper.getMode();
const SKIP_BUILD = DeployHelper.getArgAt(0) == '--no-build';
console.log('Deploying producer in mode:', MODE);
setTimeout(() => { main(); }, 3000);
@@ -20,6 +23,13 @@ async function main() {
if (fs.existsSync(TMP_PATH)) fs.rmSync(TMP_PATH, { force: true, recursive: true });
fs.ensureDirSync(TMP_PATH);
if (!SKIP_BUILD) {
console.log('Building');
child.execSync(`cd ${LOCAL_PATH} && pnpm run build`);
}
console.log('Creting zip file');
const archive = createZip(TMP_PATH + '/' + ZIP_NAME);
archive.directory(LOCAL_PATH + '/dist', '/dist');