From 4516173b60e1bb3e38db0fcb572aad0cc96a8de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A7=81Ash=C3=BB=EA=A7=82?= <30575805+Ashu11-A@users.noreply.github.com> Date: Sat, 4 May 2024 02:39:27 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix:=20Multi=20Build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yaml | 2 +- release.ts | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 40f6c670..6117ffbf 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [18.x] + node-version: [20.x] steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/release.ts b/release.ts index 19283414..1b9272ed 100644 --- a/release.ts +++ b/release.ts @@ -3,7 +3,7 @@ import { exec as processChild } from 'child_process' import { Presets, SingleBar } from 'cli-progress' import { createHash } from 'crypto' import { existsSync, mkdirSync, rmSync, writeFileSync } from 'fs' -import { readFile, rm, stat, writeFile } from 'fs/promises' +import { readFile, rm, rmdir, stat, writeFile } from 'fs/promises' import { glob } from 'glob' import { obfuscate } from 'javascript-obfuscator' import os from 'os' @@ -208,8 +208,18 @@ class Build { async installModules() { console.debug('Baixando node_modules, sem as devDependencies\n\n') - await new Promise((resolve, reject) => { - processChild(`cd ${this.options.outdir} && npm i && npm rebuild`, (error, stdout, stderr) => { + if (existsSync(`${this.options.outdir}/node_modules`)) { + await new Promise(async (resolve, reject) => { + processChild(`cd ${this.options.outdir} && rm -r node_modules`, (error, stdout, stderr) => { + if (error !== null || stderr !== '') { + reject(error ?? stderr) + } + resolve() + }) + }) + } + await new Promise(async (resolve, reject) => { + processChild(`cd ${this.options.outdir} && npm i && npm rebuild better_sqlite3 && npm rebuild`, (error, stdout, stderr) => { if (error !== null || stderr !== '') { reject(error ?? stderr) }