From 0d0644593ab858087c288c0ce2b65566e6d4c5b1 Mon Sep 17 00:00:00 2001 From: Mosh Feu Date: Sun, 25 Apr 2021 23:18:18 +0300 Subject: [PATCH] fix: homedir + webpack local --- src/services/path.ts | 3 ++- webpack.config.js | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/services/path.ts b/src/services/path.ts index 9eae73c..789da7d 100644 --- a/src/services/path.ts +++ b/src/services/path.ts @@ -1,9 +1,10 @@ import { join } from 'path'; import { mkdirSync, existsSync, readdirSync } from 'fs'; import { findArgument } from './additional-arguments'; +import { homedir } from 'os'; function downloadsFolder() { - return join(process.env.HOME, 'downloads'); + return join(homedir(), 'downloads'); } const folderName = 'y2mp3'; diff --git a/webpack.config.js b/webpack.config.js index a0eca4e..70d4ef5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -74,13 +74,14 @@ module.exports = (env, argv) => ({ // }); let firstTime = true; compiler.hooks.done.tap('ts', () => { - console.log('after compile'); - spawnSync('tsc', { + console.log(`after compile in mode "${compiler.options.mode}"`); + spawnSync('tsc', ['--project', `tsconfig${compiler.options.mode === 'production' ? '.prod' : ''}.json`], { stdio: 'inherit' }); - console.log('after tsc'); - if (firstTime && argv.mode === 'development') { + console.log(`after tsc. first time? ${firstTime}`); + if (firstTime && compiler.options.mode === 'development') { firstTime = false; + console.log('run electron') spawnSync('yarn', ['electron'], { stdio: 'inherit' });