mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-02-02 11:48:25 +00:00
Emit TS type declarations, and type NativefierOptions (#1016)
This PR adds better Typescript support when using the Node module directly: 1. Generate type declarations when running `tsc` 2. Created the `NativefierOptions` type for the `buildNativefierApp` function instead of using `any`
This commit is contained in:
parent
3e5f1fabad
commit
bd077756e8
@ -9,7 +9,7 @@ import { isWindows, getTempDir, copyFileOrDir } from '../helpers/helpers';
|
|||||||
import { getOptions } from '../options/optionsMain';
|
import { getOptions } from '../options/optionsMain';
|
||||||
import { prepareElectronApp } from './prepareElectronApp';
|
import { prepareElectronApp } from './prepareElectronApp';
|
||||||
import { convertIconIfNecessary } from './buildIcon';
|
import { convertIconIfNecessary } from './buildIcon';
|
||||||
import { AppOptions } from '../options/model';
|
import { AppOptions, NativefierOptions } from '../options/model';
|
||||||
|
|
||||||
const OPTIONS_REQUIRING_WINDOWS_FOR_WINDOWS_BUILD = [
|
const OPTIONS_REQUIRING_WINDOWS_FOR_WINDOWS_BUILD = [
|
||||||
'icon',
|
'icon',
|
||||||
@ -99,7 +99,9 @@ function trimUnprocessableOptions(options: AppOptions): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||||
export async function buildNativefierApp(rawOptions: any): Promise<string> {
|
export async function buildNativefierApp(
|
||||||
|
rawOptions: NativefierOptions,
|
||||||
|
): Promise<string> {
|
||||||
log.info('Processing options...');
|
log.info('Processing options...');
|
||||||
const options = await getOptions(rawOptions);
|
const options = await getOptions(rawOptions);
|
||||||
|
|
||||||
|
@ -56,3 +56,7 @@ export interface AppOptions {
|
|||||||
zoom: number;
|
zoom: number;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type NativefierOptions = Partial<
|
||||||
|
AppOptions['packager'] & AppOptions['nativefier']
|
||||||
|
>;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowJs": false,
|
"allowJs": false,
|
||||||
"declaration": false,
|
"declaration": true,
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user