4 Commits

Author SHA1 Message Date
Samuel Attard
bb304ce10b fix: Revert "feat: bump minimum node version to 16 and add tests (#86)"
This reverts commit 8e2842b4a3.
2023-11-09 11:08:16 -08:00
Samuel Attard
8e2842b4a3 feat: bump minimum node version to 16 and add tests (#86)
* build: add tests

* build: bump deps

* sigh

* build: install rosetta on m1
2023-11-09 10:56:22 -08:00
Baldvin Th
02119d5a83 fix: import for path now compiles correctly after TypeScript was added (#85)
* Fixing import for path after TypeScript was added

* Added esModuleInterop: true, fixed breaking imports after change
2023-11-05 11:37:48 -03:00
Erik Moura
1948f1caa9 fix: use Typescript for files in entry-asar (#83) 2023-11-02 19:10:17 -03:00
12 changed files with 62 additions and 20 deletions

4
.gitignore vendored
View File

@@ -1,3 +1,5 @@
node_modules
dist
*.app
entry-asar/*.js*
entry-asar/*.ts
*.app

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();

View File

@@ -20,13 +20,14 @@
"files": [
"dist/*",
"entry-asar/*",
"!entry-asar/**/*.ts",
"README.md"
],
"author": "Samuel Attard",
"scripts": {
"build": "tsc && tsc -p tsconfig.esm.json",
"lint": "prettier --check \"{src,entry-asar}/**/*.{js,ts}\"",
"prettier:write": "prettier --write \"{src,entry-asar}/**/*.{js,ts}\"",
"build": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && tsc -p tsconfig.entry-asar.json",
"lint": "prettier --check \"{src,entry-asar}/**/*.ts\"",
"prettier:write": "prettier --write \"{src,entry-asar}/**/*.ts\"",
"prepublishOnly": "npm run build",
"test": "exit 0",
"prepare": "husky install"
@@ -57,4 +58,4 @@
"prettier --write"
]
}
}
}

View File

@@ -1,10 +1,10 @@
import * as asar from '@electron/asar';
import asar from '@electron/asar';
import { execFileSync } from 'child_process';
import * as crypto from 'crypto';
import * as fs from 'fs-extra';
import * as path from 'path';
import * as minimatch from 'minimatch';
import * as os from 'os';
import crypto from 'crypto';
import fs from 'fs-extra';
import path from 'path';
import minimatch from 'minimatch';
import os from 'os';
import { d } from './debug';
const LIPO = 'lipo';

View File

@@ -1,3 +1,3 @@
import * as debug from 'debug';
import debug from 'debug';
export const d = debug('electron-universal');

View File

@@ -2,7 +2,7 @@ import { spawn } from '@malept/cross-spawn-promise';
import * as asar from '@electron/asar';
import * as crypto from 'crypto';
import * as fs from 'fs-extra';
import * as minimatch from 'minimatch';
import minimatch from 'minimatch';
import * as os from 'os';
import * as path from 'path';
import * as plist from 'plist';

4
tsconfig.cjs.json Normal file
View File

@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["src"]
}

10
tsconfig.entry-asar.json Normal file
View File

@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "entry-asar",
},
"include": [
"entry-asar"
],
"exclude": []
}

View File

@@ -3,5 +3,6 @@
"compilerOptions": {
"module": "esnext",
"outDir": "dist/esm"
}
}
},
"include": ["src"]
}

View File

@@ -13,9 +13,11 @@
],
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"esModuleInterop": true,
"declaration": true
},
"include": [
"src"
"src",
"entry-asar"
]
}