desktop: add logs in build script for debugging

This commit is contained in:
Abdullah Atta
2025-10-03 18:40:47 +05:00
parent 9e265dbecf
commit 5d07db366b

View File

@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
console.log("starting build...");
import path from "path"; import path from "path";
import fs from "fs/promises"; import fs from "fs/promises";
import { existsSync } from "fs"; import { existsSync } from "fs";
@@ -26,6 +27,7 @@ import * as childProcess from "child_process";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import { patchBetterSQLite3 } from "./patch-better-sqlite3.mjs"; import { patchBetterSQLite3 } from "./patch-better-sqlite3.mjs";
console.log("imports done...");
const args = yargs(process.argv); const args = yargs(process.argv);
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename); const __dirname = path.dirname(__filename);
@@ -34,9 +36,20 @@ const skipTscBuild = args.skipTscBuild || false;
const webAppPath = path.resolve(path.join(__dirname, "..", "..", "web")); const webAppPath = path.resolve(path.join(__dirname, "..", "..", "web"));
console.log("loaded args", {
args,
__filename,
__dirname,
root,
skipTscBuild,
webAppPath
});
await fs.rm(path.join(root, "build"), { force: true, recursive: true }); await fs.rm(path.join(root, "build"), { force: true, recursive: true });
console.log("removed build folder");
if (args.rebuild || !existsSync(path.join(webAppPath, "build"))) { if (args.rebuild || !existsSync(path.join(webAppPath, "build"))) {
console.log("rebuilding...");
await exec( await exec(
"npx nx build:desktop @notesnook/web", "npx nx build:desktop @notesnook/web",
path.join(__dirname, "..", "..", "..") path.join(__dirname, "..", "..", "..")