Skip to content
Open
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
27 changes: 27 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/electron",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser",
"ignorePatterns": ["out", ".vite", ".bootstrap-app"],
"rules": {
"import/no-unresolved": "off"
}
}
37 changes: 37 additions & 0 deletions .github/workflows/windows-exe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build Windows EXE

on:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: windows-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install dependencies
run: npm ci

- name: Build Windows installer
run: npm run make:win

- name: Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: lofi-defragger-windows-exe
if-no-files-found: error
path: |
out/make/squirrel.windows/x64/*.exe
out/make/squirrel.windows/x64/*.nupkg
out/make/squirrel.windows/x64/RELEASES
80 changes: 80 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock
.DS_Store

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Webpack
.webpack/

# Vite
.vite/

# Electron-Forge
out/

# Local workflow artifacts
runtime/checkpoints/

# Local screenshot drops in repo root
/*.png
22 changes: 22 additions & 0 deletions DISTRIBUTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Distribution

## Windows EXE

- Local Windows build: double-click `build-windows.bat` or run `npm run make:win` from Windows.
- GitHub one-click build: run the workflow in `.github/workflows/windows-exe.yml`.
- Expected output folder: `out/make/squirrel.windows/x64/`
- Expected artifacts:
- `*.exe`
- `RELEASES`
- one or more `.nupkg` files

## macOS / Linux

- Use `python3 launch.py`.
- Default behavior:
- if a packaged app for the current OS already exists, it launches that
- otherwise it runs `npm ci` if needed and starts the app with `npm run dev`
- Useful options:
- `python3 launch.py --dry-run`
- `python3 launch.py --source`
- `python3 launch.py --install`
36 changes: 36 additions & 0 deletions build-windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@echo off
setlocal

where node >nul 2>nul
if errorlevel 1 (
echo Node.js is required to build the Windows EXE.
exit /b 1
)

where npm >nul 2>nul
if errorlevel 1 (
echo npm is required to build the Windows EXE.
exit /b 1
)

pushd "%~dp0"

echo Installing dependencies...
call npm ci
if errorlevel 1 (
popd
exit /b 1
)

echo Building Windows EXE...
call npm run make:win
if errorlevel 1 (
popd
exit /b 1
)

echo Windows artifacts are in out\make\squirrel.windows\x64
if exist "out\make\squirrel.windows\x64" start "" "out\make\squirrel.windows\x64"

popd
exit /b 0
Binary file added defrag-like-its-1992-2_png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions forge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import type { ForgeConfig } from '@electron-forge/shared-types';
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
import { MakerZIP } from '@electron-forge/maker-zip';
import { MakerDeb } from '@electron-forge/maker-deb';
import { MakerRpm } from '@electron-forge/maker-rpm';
import { VitePlugin } from '@electron-forge/plugin-vite';
import { FusesPlugin } from '@electron-forge/plugin-fuses';
import { FuseV1Options, FuseVersion } from '@electron/fuses';

const config: ForgeConfig = {
packagerConfig: {
asar: true,
},
rebuildConfig: {},
makers: [
new MakerSquirrel({}),
new MakerZIP({}, ['darwin']),
new MakerRpm({}),
new MakerDeb({}),
],
plugins: [
new VitePlugin({
// `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
// If you are familiar with Vite configuration, it will look really familiar.
build: [
{
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
entry: 'src/main.ts',
config: 'vite.main.config.ts',
target: 'main',
},
{
entry: 'src/preload.ts',
config: 'vite.preload.config.ts',
target: 'preload',
},
],
renderer: [
{
name: 'main_window',
config: 'vite.renderer.config.ts',
},
],
}),
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};

export default config;
1 change: 1 addition & 0 deletions forge.env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@electron-forge/plugin-vite/forge-vite-env" />
15 changes: 15 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1"
/>
<title>Lo-fi Defragger</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/renderer.tsx"></script>
</body>
</html>
Loading