Skip to content

Commit

Permalink
Fix not bundling app dependencies when building
Browse files Browse the repository at this point in the history
  • Loading branch information
artrz committed Jul 16, 2021
1 parent 4d4a423 commit dbd02e4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -22,5 +22,8 @@
],
"dependencies": {
"electron-settings": "^4.0.2"
}
},
"os": [
"linux"
]
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
38 changes: 18 additions & 20 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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);

Expand All @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit dbd02e4

Please sign in to comment.