From dbd02e44df6882d2d19079b5a4196c4ddeb9031f Mon Sep 17 00:00:00 2001 From: Arturo Rodriguez Date: Fri, 16 Jul 2021 00:44:41 -0500 Subject: [PATCH] Fix not bundling app dependencies when building --- CHANGELOG.md | 5 ++++- app/package.json | 7 +++++-- package.json | 1 - scripts/build.js | 38 ++++++++++++++++++-------------------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3eb0845..82dd5c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.4.1] - 2021-07-15 +## [0.5.0] - 2021-07-16 ### Updated - Update some dependencies. +### Fixed +- Unable to execute build script. + ## [0.4.0] - 2021-05-01 ### Updated - Update some dependencies. diff --git a/app/package.json b/app/package.json index 301da68..87082eb 100644 --- a/app/package.json +++ b/app/package.json @@ -3,7 +3,7 @@ "productName": "Basecamp for Linux", "baseName": "basecamp", "description": "Unofficial Basecamp GNU/Linux Desktop Client.", - "version": "0.4.1", + "version": "0.5.0", "author": "Arturo Rodríguez", "license": "MIT", "main": "app.js", @@ -22,5 +22,8 @@ ], "dependencies": { "electron-settings": "^4.0.2" - } + }, + "os": [ + "linux" + ] } diff --git a/package.json b/package.json index dd51966..86ac402 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "license": "MIT", "private": true, "devDependencies": { - "basecamp-linux": "file:app", "electron": "11.4.4", "electron-packager": "15.2.0", "eslint": "7.30.0", diff --git a/scripts/build.js b/scripts/build.js index 8a19990..60ae95a 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -20,19 +20,7 @@ const ASSETS_PATH = path.join(__dirname, '..', 'assets'); const BUILD_PATH = path.join(__dirname, '..', 'build'); const DIST_PATH = path.join(__dirname, '..', 'dist'); const NODE_MODULES_PATH = path.join(__dirname, '..', 'node_modules'); -const E_VERSION = require(path.join(NODE_MODULES_PATH, 'electron', 'package.json')).version; - -const PACKAGE_CONFIG = { - dir: SOURCE_PATH, - out: BUILD_PATH, - name: APP_NAME, - appVersion: APP_VERSION, - buildVersion: APP_VERSION, - electronVersion: E_VERSION, - extraResource: [`${ASSETS_PATH}`], - packageManager: 'yarn', - platform: 'linux', -}; +const ELECTRON_VERSION = require(path.join(NODE_MODULES_PATH, 'electron', 'package.json')).version; const ARGS = minimist(process.argv.slice(2), { boolean: ['compress'], @@ -43,9 +31,20 @@ const ARGS = minimist(process.argv.slice(2), { }, }); +const PACKAGE_CONFIG = { + dir: SOURCE_PATH, + out: BUILD_PATH, + name: APP_NAME, + appVersion: APP_VERSION, + electronVersion: ELECTRON_VERSION, + extraResource: [`${ASSETS_PATH}`], + platform: 'linux', + arch: ARGS.arch.split(','), +}; + const builder = { build() { - this.reinstallModules(); + this.installAppModules(); this.deleteDir(BUILD_PATH); @@ -56,9 +55,10 @@ const builder = { this.package(); }, - reinstallModules() { - console.log('\nReinstalling node_modules...'); - cp.execSync('yarn install', { stdio: 'inherit' }); + installAppModules() { + this.deleteDir(`${SOURCE_PATH}/node_modules`); + console.log('\nInstalling app modules...'); + cp.execSync('yarn install --no-lockfile', { cwd: SOURCE_PATH, stdio: 'inherit' }); }, deleteDir(pathToDelete) { @@ -69,9 +69,7 @@ const builder = { package() { console.log('\nPackaging app...'); - const arch = { arch: ARGS.arch.split(',') }; - - packager({ ...PACKAGE_CONFIG, ...arch }) + packager(PACKAGE_CONFIG) .then((appPaths) => { appPaths.forEach((appPath) => { if (ARGS.compress) {