Skip to content

Commit

Permalink
Merge branch 'chore/electron-33' of https://github.com/meetfranz/franz
Browse files Browse the repository at this point in the history
…into chore/electron-33
  • Loading branch information
adlk committed Dec 16, 2024
2 parents da5da68 + 46632c5 commit e1821b6
Show file tree
Hide file tree
Showing 43 changed files with 3,950 additions and 1,385 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Build/release
on: push

env:
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
APPLE_ID: ${{ secrets.APPLEID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}

Expand All @@ -23,6 +23,7 @@ jobs:
out/*.mac.zip.blockmap
out/latest-mac.yml
CSC_LINK: CSC_LINK_MAC
APPLE_TEAM_ID: TAC9P63ANZ

- platform: ubuntu
os: ubuntu-latest
Expand Down Expand Up @@ -51,6 +52,17 @@ jobs:
node-version: 16.14.0
cache: "npm"

- name: Set up Python (mac only)
if: matrix.platform == 'mac'
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Upgrade pip and install setuptools/wheel (mac only)
if: matrix.platform == 'mac'
run: |
python3 -m pip install --upgrade pip setuptools wheel
- name: Install dependencies
run: |
npm i -g [email protected]
Expand All @@ -60,7 +72,7 @@ jobs:
run: npm run build

- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}
path: ${{ matrix.artifactPath }}
53 changes: 53 additions & 0 deletions build-helpers/ensure-mac-dependency.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const os = require('os');
const fs = require('fs');
const { execSync } = require('child_process');
const path = require('path');

// Configuration: Array of packages to handle conditionally
const packages = [
'node-mac-permissions',
// Add more packages here if needed
];


exports.default = function () {
console.log('Checking for macOS dependencies...');

const isMac = os.platform() === 'darwin';

packages.forEach((packageName) => {
const packagePath = path.join(__dirname, '..', 'node_modules', packageName);

if (isMac) {
// On macOS, ensure that the package is installed
if (!fs.existsSync(packagePath)) {
console.log(`macOS detected and ${packageName} is not installed. Installing...`);
try {
execSync(`npm install ${packageName}`, { stdio: 'inherit' });
console.log(`${packageName} installed successfully.`);
} catch (error) {
console.error(`Failed to install ${packageName} on macOS:`, error);
process.exit(1);
}
} else {
console.log(`macOS detected and ${packageName} is already installed. No action needed.`);
}
} else {
// On non-macOS platforms, ensure that the package is not present
if (fs.existsSync(packagePath)) {
console.log(`Non-macOS platform detected and ${packageName} is present. Removing...`);
try {
execSync(`npm uninstall ${packageName}`, { stdio: 'inherit' });
console.log(`${packageName} removed successfully.`);
} catch (error) {
console.error(`Failed to uninstall ${packageName} on non-mac platform:`, error);
process.exit(1);
}
} else {
console.log(`Non-macOS platform detected and ${packageName} is not installed. No action needed.`);
}
}
});

return true;
};
5 changes: 2 additions & 3 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ compression: maximum
mac:
category: public.app-category.productivity
icon: ./build-helpers/images/icon.icns
notarize:
teamId: TAC9P63ANZ
target:
target: default
arch:
Expand Down Expand Up @@ -61,5 +59,6 @@ protocols:
schemes: [franz]

asarUnpack:
- ./node_modules/mac-screen-capture-permissions
- ./assets/images/taskbar

beforeBuild: ./build-helpers/ensure-mac-dependency.js
41 changes: 23 additions & 18 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
/* eslint max-len: 0 */
import gulp from 'gulp';
import babel from 'gulp-babel';
import server from 'gulp-server-livereload';
import { exec } from 'child_process';
import dotenv from 'dotenv';
import sassVariables from 'gulp-sass-variables';
import { removeSync } from 'fs-extra';
import kebabCase from 'kebab-case';
import hexRgb from 'hex-rgb';
import ts from 'gulp-typescript';
import gulp from 'gulp';
import babel from 'gulp-babel';
import sassVariables from 'gulp-sass-variables';
import server from 'gulp-server-livereload';
import terser from 'gulp-terser';
import ts from 'gulp-typescript';
import hexRgb from 'hex-rgb';
import kebabCase from 'kebab-case';

// Tailwind & PostCSS
import autoprefixer from 'autoprefixer';
import postcss from 'gulp-postcss';
import tailwindcss from 'tailwindcss';

import config from './package.json';

Expand All @@ -23,7 +28,13 @@ dotenv.config();

const styleConfig = Object.keys(rawStyleConfig).map((key) => {
const isHex = /^#[0-9A-F]{6}$/i.test(rawStyleConfig[key]);
return ({ [`$raw_${kebabCase(key)}`]: isHex ? hexRgb(rawStyleConfig[key], { format: 'array' }).splice(0, 3).join(',') : rawStyleConfig[key] });
return ({
[`$raw_${kebabCase(key)}`]: isHex
? hexRgb(rawStyleConfig[key], { format: 'array' })
.splice(0, 3)
.join(',')
: rawStyleConfig[key],
});
});

const paths = {
Expand All @@ -45,25 +56,18 @@ const paths = {
src: 'src/**/*.js',
dest: 'build/',
watch: [
// 'packages/**/*.js',
'src/**/*.js',
],
},
tsScripts: {
src: 'src/**/*.ts',
dest: 'build/',
watch: [
// 'packages/**/*.js',
'src/**/*.ts',
],
},
packages: {
watch: 'packages/**/*',
// dest: 'build/',
// watch: [
// // 'packages/**/*.js',
// 'src/**/*.js',
// ],
},
};

Expand All @@ -86,7 +90,6 @@ function _shell(cmd, cb) {
const clean = (done) => {
removeSync(paths.tmp);
removeSync(paths.dest);

done();
};
export { clean };
Expand All @@ -96,7 +99,6 @@ export function mvSrc() {
[
`${paths.src}/*`,
`${paths.src}/*/**`,
`!${paths.scripts.watch[1]}`,
`!${paths.src}/styles/**`,
`!${paths.src}/**/*.js`,
`!${paths.src}/**/*.ts`,
Expand Down Expand Up @@ -139,6 +141,10 @@ export function styles() {
'../node_modules',
],
}).on('error', sass.logError))
.pipe(postcss([
tailwindcss('./tailwind.config.js'),
autoprefixer(),
]))
.pipe(gulp.dest(paths.styles.dest));
}

Expand Down Expand Up @@ -169,7 +175,6 @@ export function watch() {
gulp.watch([
paths.src,
`${paths.scripts.src}`,
`${paths.scripts.src}`,
`${paths.styles.src}`,
], mvSrc);

Expand Down
Loading

0 comments on commit e1821b6

Please sign in to comment.