Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:

- run: pnpm install
- run: pnpm build
- run: pnpm prepare:remove-source-maps
- run: pnpm package:macos --publish=never -c.mac.identity=null
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
Expand Down Expand Up @@ -61,7 +60,6 @@ jobs:

- run: pnpm install
- run: pnpm build
- run: pnpm prepare:remove-source-maps
- run: pnpm package:win --publish=never

- name: Clean up builds
Expand Down Expand Up @@ -93,7 +91,6 @@ jobs:

- run: pnpm install
- run: pnpm build
- run: pnpm prepare:remove-source-maps
- run: pnpm package:linux --publish=never

- name: Clean up builds
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
env:
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
- run: pnpm prepare:remove-source-maps
- run: pnpm package:macos --publish onTagOrDraft
env:
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
Expand Down Expand Up @@ -70,7 +69,6 @@ jobs:
env:
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
- run: pnpm prepare:remove-source-maps
- run: pnpm package:win --publish onTagOrDraft
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -104,7 +102,6 @@ jobs:
env:
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
- run: pnpm prepare:remove-source-maps
- run: pnpm package:linux --publish onTagOrDraft
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 2 additions & 4 deletions config/electron-builder.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const { Configuration } = require('electron-builder');

/**
* @type {Configuration}
* @type {import('electron-builder').Configuration}
*/
const config = {
productName: 'Gitify',
Expand All @@ -28,7 +26,7 @@ const config = {
icon: 'assets/images/app-icon.icns',
identity: 'Adam Setch (5KD23H9729)',
type: 'distribution',
notarize: false,
notarize: false, // Handle notarization in afterSign.js
target: {
target: 'default',
arch: ['universal'],
Expand Down
3 changes: 0 additions & 3 deletions config/webpack.config.main.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ const configuration: webpack.Configuration = {
output: {
path: webpackPaths.buildPath,
filename: 'main.js',
library: {
type: 'umd',
},
},
};

Expand Down
2 changes: 1 addition & 1 deletion config/webpack.config.main.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { merge } from 'webpack-merge';
import baseConfig from './webpack.config.main.base';

const configuration: webpack.Configuration = {
devtool: 'source-map',
devtool: false,

mode: 'production',

Expand Down
24 changes: 24 additions & 0 deletions config/webpack.config.preload.base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import path from 'node:path';

import type webpack from 'webpack';
import { merge } from 'webpack-merge';

import baseConfig from './webpack.config.common';
import webpackPaths from './webpack.paths';

const configuration: webpack.Configuration = {
devtool: 'inline-source-map',

mode: 'development',

target: 'electron-preload',

entry: [path.join(webpackPaths.srcPreloadPath, 'index.ts')],

output: {
path: webpackPaths.buildPath,
filename: 'preload.js',
},
};

export default merge(baseConfig, configuration);
18 changes: 18 additions & 0 deletions config/webpack.config.preload.prod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import TerserPlugin from 'terser-webpack-plugin';
import type webpack from 'webpack';
import { merge } from 'webpack-merge';

import baseConfig from './webpack.config.preload.base';

const configuration: webpack.Configuration = {
devtool: false,

mode: 'production',

optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
};

export default merge(baseConfig, configuration);
31 changes: 25 additions & 6 deletions config/webpack.config.renderer.base.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
import path from 'node:path';

import twemoji from '@discordapp/twemoji';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import webpack from 'webpack';
import { merge } from 'webpack-merge';

import { ALL_EMOJI_SVG_FILENAMES } from '../src/renderer/utils/emojis';
import { Constants } from '../src/renderer/constants';
import { Errors } from '../src/renderer/utils/errors';
import baseConfig from './webpack.config.common';
import webpackPaths from './webpack.paths';

const ALL_EMOJIS = [
...Constants.ALL_READ_EMOJIS,
...Errors.BAD_CREDENTIALS.emojis,
...Errors.MISSING_SCOPES.emojis,
...Errors.NETWORK.emojis,
...Errors.RATE_LIMITED.emojis,
...Errors.UNKNOWN.emojis,
];

export const ALL_EMOJI_SVG_FILENAMES = ALL_EMOJIS.map((emoji) => {
const imgHtml = twemoji.parse(emoji, { folder: 'svg', ext: '.svg' });
return extractSvgFilename(imgHtml);
});

const configuration: webpack.Configuration = {
devtool: 'inline-source-map',

mode: 'development',

target: 'electron-renderer',
target: ['web', 'electron-renderer'],

entry: [path.join(webpackPaths.srcRendererPath, 'index.tsx')],

output: {
path: webpackPaths.buildPath,
filename: 'renderer.js',
library: {
type: 'umd',
},
},

module: {
Expand Down Expand Up @@ -61,7 +74,6 @@ const configuration: webpack.Configuration = {
removeAttributeQuotes: true,
removeComments: true,
},
isBrowser: false,
}),

// Twemoji SVGs for Emoji parsing
Expand All @@ -87,4 +99,11 @@ const configuration: webpack.Configuration = {
],
};

function extractSvgFilename(imgHtml: string) {
const srcMatch = /src="(.*)"/.exec(imgHtml);
const src = srcMatch ? srcMatch[1] : '';
const filename = src.split('/').pop(); // Get the last part after splitting by "/"
return filename;
}

export default merge(baseConfig, configuration);
2 changes: 1 addition & 1 deletion config/webpack.config.renderer.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { merge } from 'webpack-merge';
import baseConfig from './webpack.config.renderer.base';

const configuration: webpack.Configuration = {
devtool: 'source-map',
devtool: false,

mode: 'production',

Expand Down
5 changes: 5 additions & 0 deletions config/webpack.paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ const rootPath = path.join(__dirname, '..');
const nodeModulesPath = path.join(rootPath, 'node_modules');

const srcPath = path.join(rootPath, 'src');

const srcMainPath = path.join(srcPath, 'main');

const srcPreloadPath = path.join(srcPath, 'preload');

const srcRendererPath = path.join(srcPath, 'renderer');

const buildPath = path.join(rootPath, 'build');
Expand All @@ -17,6 +21,7 @@ export default {
nodeModulesPath,
srcPath,
srcMainPath,
srcPreloadPath,
srcRendererPath,
buildPath,
distPath,
Expand Down
14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
"main": "build/main.js",
"scripts": {
"clean": "rimraf build coverage dist node_modules",
"build": "concurrently --names \"main,renderer\" --prefix-colors \"blue,green\" \"pnpm build:main\" \"pnpm build:renderer\"",
"build": "concurrently --names \"main,preload,renderer\" --prefix-colors \"blue,magenta,green\" \"pnpm build:main\" \"pnpm build:preload\" \"pnpm build:renderer\"",
"build:main": "webpack --config ./config/webpack.config.main.prod.ts",
"build:preload": "webpack --config ./config/webpack.config.preload.prod.ts",
"build:renderer": "webpack --config ./config/webpack.config.renderer.prod.ts",
"watch": "concurrently --names \"main,renderer\" --prefix-colors \"blue,green\" \"pnpm watch:main\" \"pnpm watch:renderer\"",
"watch": "concurrently --names \"main,preload,renderer\" --prefix-colors \"blue,magenta,green\" \"pnpm watch:main\" \"pnpm watch:preload\" \"pnpm watch:renderer\"",
"watch:main": "webpack --watch --config ./config/webpack.config.main.base.ts",
"watch:preload": "webpack --watch --config ./config/webpack.config.preload.base.ts",
"watch:renderer": "webpack --watch --config ./config/webpack.config.renderer.base.ts",
"prepare:remove-source-maps": "ts-node ./scripts/delete-source-maps.ts",
"package:linux": "electron-builder --linux --config ./config/electron-builder.js",
"package:macos": "electron-builder --mac --config ./config/electron-builder.js",
"package:win": "electron-builder --win --config ./config/electron-builder.js",
Expand All @@ -31,12 +32,10 @@
"keywords": [
"gitify",
"github",
"notifier",
"notifications",
"electron",
"atom",
"shell",
"app",
"menubar",
"taskbar",
"tray"
],
"author": {
Expand Down Expand Up @@ -67,7 +66,6 @@
},
"homepage": "https://gitify.io/",
"dependencies": {
"@electron/remote": "2.1.3",
"electron-log": "5.4.3",
"electron-updater": "6.6.2",
"menubar": "9.5.1",
Expand Down
12 changes: 0 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions scripts/afterPack.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const path = require('node:path');
const fs = require('node:fs');
const { AfterPackContext } = require('electron-builder');

const builderConfig = require('../config/electron-builder');
const electronLanguages = builderConfig.electronLanguages;
Expand All @@ -11,7 +10,7 @@ function logAfterPackProgress(msg) {
}

/**
* @param {AfterPackContext} context
* @param {import('electron-builder').AfterPackContext} context
*/
const afterPack = async (context) => {
logAfterPackProgress('Starting...');
Expand Down
3 changes: 1 addition & 2 deletions scripts/afterSign.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
const { notarize } = require('@electron/notarize');
const { AfterPackContext } = require('electron-builder');

function logAfterSignProgress(msg) {
// biome-ignore lint/suspicious/noConsole: log notarizing progress
console.log(` • [afterSign]: ${msg}`);
}

/**
* @param {AfterPackContext} context
* @param {import('electron-builder').AfterPackContext} context
*/
const afterSign = async (context) => {
logAfterSignProgress('Starting...');
Expand Down
16 changes: 0 additions & 16 deletions scripts/delete-source-maps.ts

This file was deleted.

Loading
Loading