Skip to content

Commit 494e4e6

Browse files
authored
Fix ci error (#17)
* Fix ci error
1 parent 137147d commit 494e4e6

2 files changed

Lines changed: 25 additions & 36 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches: [ "main", "develop" ] # Or your primary branches
77
pull_request:
88
branches: [ "main", "develop" ]
9+
workflow_dispatch:
910

1011
jobs:
1112
build-and-test:
@@ -16,45 +17,30 @@ jobs:
1617
node-version: [18.x] # Specify Node.js versions to test against
1718

1819
steps:
19-
- name: Checkout repository
20-
uses: actions/checkout@v4
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
2122

22-
- name: Set up Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v4
24-
with:
25-
node-version: ${{ matrix.node-version }}
26-
cache: "npm" # Enable caching for npm dependencies
23+
- name: Set up Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: "npm" # Enable caching for npm dependencies
2728

28-
- name: Install dependencies
29-
- name: Run tests
30-
run: npm test
31-
run: npm ci # Use npm ci for cleaner installs in CI
29+
- name: Install dependencies
30+
run: npm ci
3231

33-
- name: TypeScript Compile Check (Lint placeholder)
34-
run: npm run build:electron:main && npm run build:electron:preload && npx tsc --project src/renderer/tsconfig.json --noEmit
35-
# This checks if main, preload, and renderer TypeScript code compiles without errors.
36-
# Replace with actual linting command when a linter is added.
32+
- name: Run tests
33+
run: npm test
3734

38-
# Replace with `npm test` when Jest/React Testing Library tests are added.
35+
- name: TypeScript compile check
36+
run: npm run build:electron:main && npm run build:electron:preload && npx tsc --project src/renderer/tsconfig.json --noEmit
3937

40-
- name: Build application (compiles main, preload, renderer)
41-
run: npm run build
42-
# This script typically runs:
43-
# - vite build (for renderer)
44-
# - tsc (for main and preload)
38+
- name: Build application
39+
run: npm run build
4540

46-
- name: Package application (Linux AppImage example)
47-
run: |
48-
# Need to install dependencies for electron-builder to run on Linux
49-
# sudo apt-get update
50-
# sudo apt-get install -y --no-install-recommends libopenjp2-7 libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm1 libnss3 libasound2
51-
# The above dependencies might be needed for a full AppImage build with GUI tests.
52-
# For a headless build check or if runner has them, might not be needed.
53-
# For now, we focus on the command itself.
54-
npm run package -- --linux AppImage --dir # Build unpacked dir first to check
55-
# npm run package -- --linux AppImage # Build the actual AppImage
56-
# Note: Full GUI app packaging might be complex in headless CI environments
57-
# without specific display servers (e.g., Xvfb). For now, this is a structural step.
41+
- name: Package application (Linux AppImage)
42+
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
43+
run: npm run package -- --linux AppImage --dir
5844

5945
# Optional: Upload build artifacts (e.g., the AppImage)
6046
# - name: Upload Linux Build Artifact

scripts/generate-licenses.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
const fs = require('fs');
22
const path = require('path');
33
const util = require('util');
4-
const checker = require('license-checker-rseidelsohn');
5-
6-
const init = util.promisify(checker.init);
4+
const loadChecker = async () => {
5+
const checkerModule = await import('license-checker-rseidelsohn');
6+
return checkerModule.default || checkerModule;
7+
};
78
const projectRoot = path.resolve(__dirname, '..');
89
const outputDir = path.join(projectRoot, 'build', 'licenses');
910
const outputFile = path.join(outputDir, 'THIRD_PARTY_LICENSES.txt');
@@ -43,6 +44,8 @@ function formatPackage(pkgName, info) {
4344

4445
async function main() {
4546
const skipSelf = packageJson.name && packageJson.version ? `${packageJson.name}@${packageJson.version}` : null;
47+
const checker = await loadChecker();
48+
const init = util.promisify(checker.init);
4649
const packages = await init({
4750
start: projectRoot,
4851
production: true,

0 commit comments

Comments
 (0)