fix: use Typescript for files in entry-asar (#83)

This commit is contained in:
Erik Moura
2023-11-02 19:10:17 -03:00
committed by GitHub
parent 52fa9a2a78
commit 1948f1caa9
9 changed files with 53 additions and 12 deletions

19
entry-asar/ambient.d.ts vendored Normal file
View File

@@ -0,0 +1,19 @@
declare namespace NodeJS {
interface Process extends EventEmitter {
// This is an undocumented private API. It exists.
_archPath: string;
}
}
declare module 'electron' {
const app: Electron.App;
namespace Electron {
interface App {
getAppPath: () => string;
setAppPath: (p: string) => void;
}
}
export { app };
}

View File

@@ -1,5 +1,5 @@
const { app } = require('electron');
const path = require('path');
import { app } from 'electron';
import path from 'path';
if (process.arch === 'arm64') {
setPaths('arm64');
@@ -7,7 +7,7 @@ if (process.arch === 'arm64') {
setPaths('x64');
}
function setPaths(platform) {
function setPaths(platform: string) {
// This should return the full path, ending in something like
// Notion.app/Contents/Resources/app.asar
const appPath = app.getAppPath();

View File

@@ -1,10 +1,13 @@
import { app } from 'electron';
import path from 'path';
if (process.arch === 'arm64') {
setPaths('arm64');
} else {
setPaths('x64');
}
function setPaths(platform) {
function setPaths(platform: string) {
// This should return the full path, ending in something like
// Notion.app/Contents/Resources/app
const appPath = app.getAppPath();