mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 01:52:28 +08:00
refactor(forge): switch to TypeScript
This commit is contained in:
parent
0744a85421
commit
248f6d6a7d
2
.github/workflows/nightly.yml
vendored
2
.github/workflows/nightly.yml
vendored
@ -12,7 +12,7 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- .github/actions/build-electron/*
|
- .github/actions/build-electron/*
|
||||||
- .github/workflows/nightly.yml
|
- .github/workflows/nightly.yml
|
||||||
- forge.config.cjs
|
- forge.config.ts
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
const path = require("path");
|
import path from "path";
|
||||||
const fs = require("fs-extra");
|
import fs from "fs-extra";
|
||||||
const { LOCALES } = require("@triliumnext/commons");
|
import { LOCALES } from "@triliumnext/commons";
|
||||||
|
import { PRODUCT_NAME } from "../src/app-info.js";
|
||||||
|
|
||||||
const ELECTRON_FORGE_DIR = __dirname;
|
const ELECTRON_FORGE_DIR = __dirname;
|
||||||
|
|
||||||
const EXECUTABLE_NAME = "trilium"; // keep in sync with server's package.json -> packagerConfig.executableName
|
const EXECUTABLE_NAME = "trilium"; // keep in sync with server's package.json -> packagerConfig.executableName
|
||||||
const { PRODUCT_NAME } = require("../src/app-info.js");
|
|
||||||
const APP_ICON_PATH = path.join(ELECTRON_FORGE_DIR, "app-icon");
|
const APP_ICON_PATH = path.join(ELECTRON_FORGE_DIR, "app-icon");
|
||||||
|
|
||||||
const extraResourcesForPlatform = getExtraResourcesForPlatform();
|
const extraResourcesForPlatform = getExtraResourcesForPlatform();
|
||||||
@ -147,13 +147,13 @@ module.exports = {
|
|||||||
const isMac = (process.platform === "darwin");
|
const isMac = (process.platform === "darwin");
|
||||||
let localesToKeep = LOCALES
|
let localesToKeep = LOCALES
|
||||||
.filter(locale => !locale.contentOnly)
|
.filter(locale => !locale.contentOnly)
|
||||||
.map(locale => locale.electronLocale);
|
.map(locale => locale.electronLocale) as string[];
|
||||||
if (!isMac) {
|
if (!isMac) {
|
||||||
localesToKeep = localesToKeep.map(locale => locale.replace("_", "-"))
|
localesToKeep = localesToKeep.map(locale => locale.replace("_", "-"))
|
||||||
}
|
}
|
||||||
|
|
||||||
const keptLocales = new Set();
|
const keptLocales = new Set();
|
||||||
const removedLocales = [];
|
const removedLocales: string[] = [];
|
||||||
const extension = (isMac ? ".lproj" : ".pak");
|
const extension = (isMac ? ".lproj" : ".pak");
|
||||||
|
|
||||||
for (const outputPath of packageResult.outputPaths) {
|
for (const outputPath of packageResult.outputPaths) {
|
||||||
@ -240,7 +240,7 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function getExtraResourcesForPlatform() {
|
function getExtraResourcesForPlatform() {
|
||||||
const resources = [];
|
const resources: string[] = [];
|
||||||
|
|
||||||
const getScriptResources = () => {
|
const getScriptResources = () => {
|
||||||
const scripts = ["trilium-portable", "trilium-safe-mode", "trilium-no-cert-check"];
|
const scripts = ["trilium-portable", "trilium-safe-mode", "trilium-no-cert-check"];
|
@ -29,7 +29,7 @@
|
|||||||
"prebuild-install": "^7.1.1"
|
"prebuild-install": "^7.1.1"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"forge": "./electron-forge/forge.config.cjs"
|
"forge": "./electron-forge/forge.config.ts"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start-prod": "nx build desktop && cross-env TRILIUM_DATA_DIR=data TRILIUM_RESOURCE_DIR=dist TRILIUM_PORT=37841 electron dist/main.js"
|
"start-prod": "nx build desktop && cross-env TRILIUM_DATA_DIR=data TRILIUM_RESOURCE_DIR=dist TRILIUM_PORT=37841 electron dist/main.js"
|
||||||
|
23
apps/desktop/tsconfig.forge.json
Normal file
23
apps/desktop/tsconfig.forge.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"target": "ES2020",
|
||||||
|
"outDir": "dist",
|
||||||
|
"types": [
|
||||||
|
"node",
|
||||||
|
"express"
|
||||||
|
],
|
||||||
|
"rootDir": "electron-forge",
|
||||||
|
"tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.cjs",
|
||||||
|
"eslint.config.mjs"
|
||||||
|
]
|
||||||
|
}
|
@ -11,6 +11,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "./tsconfig.app.json"
|
"path": "./tsconfig.app.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.forge.json"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -169,8 +169,6 @@
|
|||||||
comment = meta.description;
|
comment = meta.description;
|
||||||
desktopName = "TriliumNext Notes";
|
desktopName = "TriliumNext Notes";
|
||||||
categories = [ "Office" ];
|
categories = [ "Office" ];
|
||||||
# TODO: electron-forge build has this set to PRODUCT_NAME (forge.config.cjs)
|
|
||||||
# But the plain build doesn't set this (or the app icon).
|
|
||||||
startupWMClass = "TriliumNext Notes";
|
startupWMClass = "TriliumNext Notes";
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user