app-builder-lib 25.1.8 → 26.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/codeSign/windowsSignToolManager.js +1 -1
- package/out/codeSign/windowsSignToolManager.js.map +1 -1
- package/out/configuration.d.ts +7 -12
- package/out/configuration.js.map +1 -1
- package/out/electron/ElectronFramework.js +12 -2
- package/out/electron/ElectronFramework.js.map +1 -1
- package/out/fileMatcher.js +13 -1
- package/out/fileMatcher.js.map +1 -1
- package/out/index.d.ts +2 -2
- package/out/index.js.map +1 -1
- package/out/options/linuxOptions.d.ts +29 -2
- package/out/options/linuxOptions.js.map +1 -1
- package/out/targets/FpmTarget.js +1 -1
- package/out/targets/FpmTarget.js.map +1 -1
- package/out/targets/LinuxTargetHelper.js +14 -2
- package/out/targets/LinuxTargetHelper.js.map +1 -1
- package/out/util/AppFileWalker.js +3 -26
- package/out/util/AppFileWalker.js.map +1 -1
- package/out/util/filter.js +8 -1
- package/out/util/filter.js.map +1 -1
- package/out/version.d.ts +1 -1
- package/out/version.js +1 -1
- package/out/version.js.map +1 -1
- package/package.json +8 -8
- package/scheme.json +90 -15
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA8DA,4DAMC;AAED,sBAwDC;AA7HD,+CAA6E;AAC7E,+DAA8C;AAC9C,yCAAqC;AAErC,4CAAgD;AAChD,6DAAyD;AAEzD,uCAAkD;AAAzC,oGAAA,QAAQ,OAAA;AAEjB,+BAWe;AATb,gGAAA,QAAQ,OAAA;AACR,8FAAA,MAAM,OAAA;AACN,kGAAA,UAAU,OAAA;AAKV,sGAAA,cAAc,OAAA;AAGhB,6CAAkE;AAAzD,6GAAA,aAAa,OAAA;AAAE,oGAA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;wBACE,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,IAAI;qBACX,EACD,QAAQ,CAAC,OAAO,CACjB,CAAA;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,WAAW,CAAC,aAAa,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,OAAO,IAAA,6BAAc,EAAC,OAAO,EAAE,eAAe,CAAC,EAAE;QAC/C,IAAI,OAAqB,CAAA;QACzB,IAAI,eAAe,EAAE,CAAC;YACpB,cAAc,CAAC,WAAW,EAAE,CAAA;YAC5B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACjC,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,cAAc,CAAC,UAAU,EAAE,CAAA;QACvC,CAAC;QAED,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAA;IAC5E,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { PublishOptions } from \"electron-publish/out/publisher\"\nimport { log, InvalidConfigurationError, executeFinally } from \"builder-util\"\nimport { asArray } from \"builder-util-runtime\"\nimport { Packager } from \"./packager\"\nimport { PackagerOptions } from \"./packagerApi\"\nimport { resolveFunction } from \"./util/resolve\"\nimport { PublishManager } from \"./publish/PublishManager\"\n\nexport { Packager, BuildResult } from \"./packager\"\nexport { PackagerOptions, ArtifactCreated, ArtifactBuildStarted } from \"./packagerApi\"\nexport {\n TargetConfiguration,\n Platform,\n Target,\n DIR_TARGET,\n BeforeBuildContext,\n SourceRepositoryInfo,\n TargetSpecificOptions,\n TargetConfigType,\n DEFAULT_TARGET,\n CompressionLevel,\n} from \"./core\"\nexport { getArchSuffix, Arch, archFromString } from \"builder-util\"\nexport { CommonConfiguration, Configuration, AfterPackContext, MetadataDirectories, BeforePackContext, AfterExtractContext, Hooks, Hook, PackContext } from \"./configuration\"\nexport { ElectronBrandingOptions, ElectronDownloadOptions, ElectronPlatformName } from \"./electron/ElectronFramework\"\nexport { PlatformSpecificBuildOptions, AsarOptions, FileSet, Protocol, ReleaseInfo, FilesBuildOptions } from \"./options/PlatformSpecificBuildOptions\"\nexport { FileAssociation } from \"./options/FileAssociation\"\nexport { MacConfiguration, DmgOptions, MasConfiguration, MacOsTargetName, DmgContent, DmgWindow, NotarizeNotaryOptions } from \"./options/macOptions\"\nexport { PkgOptions, PkgBackgroundOptions, BackgroundAlignment, BackgroundScaling } from \"./options/pkgOptions\"\nexport { WindowsConfiguration, WindowsAzureSigningConfiguration, WindowsSigntoolConfiguration } from \"./options/winOptions\"\nexport { AppXOptions } from \"./options/AppXOptions\"\nexport { MsiOptions } from \"./options/MsiOptions\"\nexport { MsiWrappedOptions } from \"./options/MsiWrappedOptions\"\nexport { CommonWindowsInstallerConfiguration } from \"./options/CommonWindowsInstallerConfiguration\"\nexport { NsisOptions, NsisWebOptions, PortableOptions, CommonNsisOptions, CustomNsisBinary } from \"./targets/nsis/nsisOptions\"\nexport { LinuxConfiguration, DebOptions, CommonLinuxOptions, LinuxTargetSpecificOptions, AppImageOptions, FlatpakOptions, LinuxDesktopFile } from \"./options/linuxOptions\"\nexport { SnapOptions, PlugDescriptor, SlotDescriptor } from \"./options/SnapOptions\"\nexport { Metadata, AuthorMetadata, RepositoryInfo } from \"./options/metadata\"\nexport { AppInfo } from \"./appInfo\"\nexport { SquirrelWindowsOptions } from \"./options/SquirrelWindowsOptions\"\n\nexport { CustomMacSign, CustomMacSignOptions } from \"./macPackager\"\nexport { WindowsSignOptions } from \"./codeSign/windowsCodeSign\"\nexport {\n CustomWindowsSignTaskConfiguration,\n WindowsSignTaskConfiguration,\n CustomWindowsSign,\n FileCodeSigningInfo,\n CertificateFromStoreInfo,\n} from \"./codeSign/windowsSignToolManager\"\nexport { CancellationToken, ProgressInfo } from \"builder-util-runtime\"\nexport { PublishOptions, UploadTask } from \"electron-publish\"\nexport { PublishManager } from \"./publish/PublishManager\"\nexport { PlatformPackager } from \"./platformPackager\"\nexport { Framework, PrepareApplicationStageDirectoryOptions } from \"./Framework\"\nexport { buildForge, ForgeOptions } from \"./forge-maker\"\nexport { LinuxPackager } from \"./linuxPackager\"\nexport { WinPackager } from \"./winPackager\"\nexport { MacPackager } from \"./macPackager\"\n\nconst expectedOptions = new Set([\"publish\", \"targets\", \"mac\", \"win\", \"linux\", \"projectDir\", \"platformPackagerFactory\", \"config\", \"effectiveOptionComputed\", \"prepackaged\"])\n\nexport function checkBuildRequestOptions(options: PackagerOptions & PublishOptions) {\n for (const optionName of Object.keys(options)) {\n if (!expectedOptions.has(optionName) && (options as any)[optionName] !== undefined) {\n throw new InvalidConfigurationError(`Unknown option \"${optionName}\"`)\n }\n }\n}\n\nexport function build(options: PackagerOptions & PublishOptions, packager: Packager = new Packager(options)): Promise<Array<string>> {\n checkBuildRequestOptions(options)\n\n const publishManager = new PublishManager(packager, options)\n const sigIntHandler = () => {\n log.warn(\"cancelled by SIGINT\")\n packager.cancellationToken.cancel()\n publishManager.cancelTasks()\n }\n process.once(\"SIGINT\", sigIntHandler)\n\n const promise = packager.build().then(async buildResult => {\n const afterAllArtifactBuild = await resolveFunction(packager.appInfo.type, buildResult.configuration.afterAllArtifactBuild, \"afterAllArtifactBuild\")\n if (afterAllArtifactBuild != null) {\n const newArtifacts = asArray(await Promise.resolve(afterAllArtifactBuild(buildResult)))\n if (newArtifacts.length === 0 || !publishManager.isPublish) {\n return buildResult.artifactPaths\n }\n\n const publishConfigurations = await publishManager.getGlobalPublishConfigurations()\n if (publishConfigurations == null || publishConfigurations.length === 0) {\n return buildResult.artifactPaths\n }\n\n for (const newArtifact of newArtifacts) {\n if (buildResult.artifactPaths.includes(newArtifact)) {\n log.warn({ newArtifact }, \"skipping publish of artifact, already published\")\n continue\n }\n buildResult.artifactPaths.push(newArtifact)\n for (const publishConfiguration of publishConfigurations) {\n publishManager.scheduleUpload(\n publishConfiguration,\n {\n file: newArtifact,\n arch: null,\n },\n packager.appInfo\n )\n }\n }\n }\n return buildResult.artifactPaths\n })\n\n return executeFinally(promise, isErrorOccurred => {\n let promise: Promise<any>\n if (isErrorOccurred) {\n publishManager.cancelTasks()\n promise = Promise.resolve(null)\n } else {\n promise = publishManager.awaitTasks()\n }\n\n return promise.then(() => process.removeListener(\"SIGINT\", sigIntHandler))\n })\n}\n"]}
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
import { PlatformSpecificBuildOptions, TargetConfigType, TargetSpecificOptions } from "../index";
|
|
2
|
+
/**
|
|
3
|
+
* Example Spec: https://specifications.freedesktop.org/desktop-entry-spec/latest/example.html
|
|
4
|
+
*/
|
|
5
|
+
export interface LinuxDesktopFile {
|
|
6
|
+
/**
|
|
7
|
+
* `[Desktop Entry]` metadata entries (name to value). Overwrites default values calculated by electron-builder
|
|
8
|
+
*/
|
|
9
|
+
entry?: {
|
|
10
|
+
[k: string]: string;
|
|
11
|
+
} | null;
|
|
12
|
+
/**
|
|
13
|
+
* `[Desktop Actions <ActionName>]` metadata entries (name to value).
|
|
14
|
+
*
|
|
15
|
+
* Config Example:
|
|
16
|
+
* ```js
|
|
17
|
+
* desktopActions: {
|
|
18
|
+
* NewWindow: {
|
|
19
|
+
* Name: 'New Window',
|
|
20
|
+
* Exec: 'app --new-window',
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
desktopActions?: {
|
|
26
|
+
[ActionName: string]: any;
|
|
27
|
+
} | null;
|
|
28
|
+
}
|
|
2
29
|
export interface LinuxConfiguration extends CommonLinuxOptions, PlatformSpecificBuildOptions {
|
|
3
30
|
/**
|
|
4
31
|
* Target package type: list of `AppImage`, `flatpak`, `snap`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.
|
|
@@ -46,9 +73,9 @@ export interface CommonLinuxOptions {
|
|
|
46
73
|
*/
|
|
47
74
|
readonly mimeTypes?: Array<string> | null;
|
|
48
75
|
/**
|
|
49
|
-
* The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)
|
|
76
|
+
* The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)
|
|
50
77
|
*/
|
|
51
|
-
readonly desktop?:
|
|
78
|
+
readonly desktop?: LinuxDesktopFile | null;
|
|
52
79
|
/**
|
|
53
80
|
* The executable parameters. Pass to executableName
|
|
54
81
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linuxOptions.js","sourceRoot":"","sources":["../../src/options/linuxOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { PlatformSpecificBuildOptions, TargetConfigType, TargetSpecificOptions } from \"../index\"\n\nexport interface LinuxConfiguration extends CommonLinuxOptions, PlatformSpecificBuildOptions {\n /**\n * Target package type: list of `AppImage`, `flatpak`, `snap`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n *\n * electron-builder [docker image](./multi-platform-build.md#docker) can be used to build Linux targets on any platform.\n *\n * Please [do not put an AppImage into another archive](https://github.com/probonopd/AppImageKit/wiki/Creating-AppImages#common-mistake) like a .zip or .tar.gz.\n * @default AppImage\n */\n readonly target?: TargetConfigType\n\n /**\n * The maintainer. Defaults to [author](./configuration.md#author).\n */\n readonly maintainer?: string | null\n\n /**\n * The vendor. Defaults to [author](./configuration.md#author).\n */\n readonly vendor?: string | null\n\n /**\n * The path to icon set directory or one png file, relative to the [build resources](./contents.md#extraresources) or to the project directory. The icon filename must contain the size (e.g. 32x32.png) of the icon.\n * By default will be generated automatically based on the macOS icns file.\n */\n readonly icon?: string\n\n /**\n * backward compatibility + to allow specify fpm-only category for all possible fpm targets in one place\n * @private\n */\n readonly packageCategory?: string | null\n}\n\nexport interface CommonLinuxOptions {\n /**\n * The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).\n */\n readonly synopsis?: string | null\n\n /**\n * As [description](./configuration.md#description) from application package.json, but allows you to specify different for Linux.\n */\n readonly description?: string | null\n\n /**\n * The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).\n */\n readonly category?: string | null\n\n /**\n * The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing.\n */\n readonly mimeTypes?: Array<string> | null\n\n /**\n * The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value).\n */\n readonly desktop?: any | null\n\n /**\n * The executable parameters. Pass to executableName\n */\n readonly executableArgs?: Array<string> | null\n}\n\n// fpm-only specific options\nexport interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * Package dependencies.\n */\n readonly depends?: Array<string> | null\n\n /**\n * The compression type.\n * @default xz\n */\n readonly compression?: \"gz\" | \"bzip2\" | \"xz\" | \"lzo\" | null\n\n readonly icon?: string\n\n /**\n * The package category.\n */\n readonly packageCategory?: string | null\n\n /**\n * The name of the package.\n */\n readonly packageName?: string | null\n\n readonly vendor?: string | null\n readonly maintainer?: string | null\n\n readonly afterInstall?: string | null\n readonly afterRemove?: string | null\n\n /**\n * *Advanced only* The [fpm](https://fpm.readthedocs.io/en/latest/cli-reference.html) options.\n *\n * Example: `[\"--before-install=build/deb-preinstall.sh\", \"--after-upgrade=build/deb-postinstall.sh\"]`\n */\n readonly fpm?: Array<string> | null\n}\nexport interface DebOptions extends LinuxTargetSpecificOptions {\n /**\n * Package dependencies. Defaults to `[\"gconf2\", \"gconf-service\", \"libnotify4\", \"libappindicator1\", \"libxtst6\", \"libnss3\"]`.\n * If need to support Debian, `libappindicator1` should be removed, it is [deprecated in Debian](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895037).\n * If need to support KDE, `gconf2` and `gconf-service` should be removed as it's no longer used [by GNOME](https://packages.debian.org/bullseye/gconf2).\n */\n readonly depends?: Array<string> | null\n\n /**\n * The [recommended package dependencies](https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps)..\n */\n readonly recommends?: Array<string> | null\n\n /**\n * The [package category](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section).\n */\n readonly packageCategory?: string | null\n\n /**\n * The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute.\n */\n readonly priority?: string | null\n}\n\nexport interface AppImageOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.\n */\n readonly license?: string | null\n}\n\nexport interface FlatpakOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.\n */\n readonly license?: string | null\n\n /**\n * The name of the runtime that the application uses. Defaults to `org.freedesktop.Platform`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly runtime?: string\n\n /**\n * The version of the runtime that the application uses. Defaults to `20.08`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly runtimeVersion?: string\n\n /**\n * The name of the development runtime that the application builds with. Defaults to `org.freedesktop.Sdk`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly sdk?: string\n\n /**\n * Start with the files from the specified application. This can be used to create applications that extend another application.\n * Defaults to [org.electronjs.Electron2.BaseApp](https://github.com/flathub/org.electronjs.Electron2.BaseApp).\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly base?: string\n\n /**\n * Use this specific version of the application specified in base. Defaults to `20.08`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly baseVersion?: string\n\n /**\n * The branch to use when exporting the application. Defaults to `master`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly branch?: string\n\n /**\n * An array of arguments passed to the flatpak build-finish command. Defaults to:\n * ```json\n * [\n * // Wayland/X11 Rendering\n * \"--socket=wayland\",\n * \"--socket=x11\",\n * \"--share=ipc\",\n * // Open GL\n * \"--device=dri\",\n * // Audio output\n * \"--socket=pulseaudio\",\n * // Read/write home directory access\n * \"--filesystem=home\",\n * // Allow communication with network\n * \"--share=network\",\n * // System notifications with libnotify\n * \"--talk-name=org.freedesktop.Notifications\",\n * ]\n * ```\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly finishArgs?: string[]\n\n /**\n * An array of objects specifying the modules to be built in order.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly modules?: (string | any)[]\n\n /**\n * Files to copy directly into the app. Should be a list of [source, dest] tuples. Source should be a relative/absolute path to a file/directory to copy into the flatpak, and dest should be the path inside the app install prefix (e.g. /share/applications/).\n *\n * See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).\n */\n readonly files?: [string, string][]\n\n /**\n * Symlinks to create in the app files. Should be a list of [target, location] symlink tuples. Target can be either a relative or absolute path inside the app install prefix, and location should be a absolute path inside the prefix to create the symlink at.\n *\n * See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).\n */\n readonly symlinks?: [string, string][]\n\n /**\n * Whether to enable the Wayland specific flags (`--enable-features=UseOzonePlatform --ozone-platform=wayland`) in the wrapper script. These flags are only available starting with Electron version 12. Defaults to `false`.\n */\n readonly useWaylandFlags?: boolean\n}\n"]}
|
|
1
|
+
{"version":3,"file":"linuxOptions.js","sourceRoot":"","sources":["../../src/options/linuxOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { PlatformSpecificBuildOptions, TargetConfigType, TargetSpecificOptions } from \"../index\"\n\n/**\n * Example Spec: https://specifications.freedesktop.org/desktop-entry-spec/latest/example.html\n */\nexport interface LinuxDesktopFile {\n /**\n * `[Desktop Entry]` metadata entries (name to value). Overwrites default values calculated by electron-builder\n */\n entry?: {\n [k: string]: string\n } | null\n /**\n * `[Desktop Actions <ActionName>]` metadata entries (name to value).\n *\n * Config Example:\n * ```js\n * desktopActions: {\n * NewWindow: {\n * Name: 'New Window',\n * Exec: 'app --new-window',\n * }\n * }\n * ```\n */\n desktopActions?: {\n [ActionName: string]: any\n } | null\n}\n\nexport interface LinuxConfiguration extends CommonLinuxOptions, PlatformSpecificBuildOptions {\n /**\n * Target package type: list of `AppImage`, `flatpak`, `snap`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n *\n * electron-builder [docker image](./multi-platform-build.md#docker) can be used to build Linux targets on any platform.\n *\n * Please [do not put an AppImage into another archive](https://github.com/probonopd/AppImageKit/wiki/Creating-AppImages#common-mistake) like a .zip or .tar.gz.\n * @default AppImage\n */\n readonly target?: TargetConfigType\n\n /**\n * The maintainer. Defaults to [author](./configuration.md#author).\n */\n readonly maintainer?: string | null\n\n /**\n * The vendor. Defaults to [author](./configuration.md#author).\n */\n readonly vendor?: string | null\n\n /**\n * The path to icon set directory or one png file, relative to the [build resources](./contents.md#extraresources) or to the project directory. The icon filename must contain the size (e.g. 32x32.png) of the icon.\n * By default will be generated automatically based on the macOS icns file.\n */\n readonly icon?: string\n\n /**\n * backward compatibility + to allow specify fpm-only category for all possible fpm targets in one place\n * @private\n */\n readonly packageCategory?: string | null\n}\n\nexport interface CommonLinuxOptions {\n /**\n * The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).\n */\n readonly synopsis?: string | null\n\n /**\n * As [description](./configuration.md#description) from application package.json, but allows you to specify different for Linux.\n */\n readonly description?: string | null\n\n /**\n * The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).\n */\n readonly category?: string | null\n\n /**\n * The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing.\n */\n readonly mimeTypes?: Array<string> | null\n\n /**\n * The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)\n */\n readonly desktop?: LinuxDesktopFile | null\n\n /**\n * The executable parameters. Pass to executableName\n */\n readonly executableArgs?: Array<string> | null\n}\n\n// fpm-only specific options\nexport interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * Package dependencies.\n */\n readonly depends?: Array<string> | null\n\n /**\n * The compression type.\n * @default xz\n */\n readonly compression?: \"gz\" | \"bzip2\" | \"xz\" | \"lzo\" | null\n\n readonly icon?: string\n\n /**\n * The package category.\n */\n readonly packageCategory?: string | null\n\n /**\n * The name of the package.\n */\n readonly packageName?: string | null\n\n readonly vendor?: string | null\n readonly maintainer?: string | null\n\n readonly afterInstall?: string | null\n readonly afterRemove?: string | null\n\n /**\n * *Advanced only* The [fpm](https://fpm.readthedocs.io/en/latest/cli-reference.html) options.\n *\n * Example: `[\"--before-install=build/deb-preinstall.sh\", \"--after-upgrade=build/deb-postinstall.sh\"]`\n */\n readonly fpm?: Array<string> | null\n}\nexport interface DebOptions extends LinuxTargetSpecificOptions {\n /**\n * Package dependencies. Defaults to `[\"gconf2\", \"gconf-service\", \"libnotify4\", \"libappindicator1\", \"libxtst6\", \"libnss3\"]`.\n * If need to support Debian, `libappindicator1` should be removed, it is [deprecated in Debian](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895037).\n * If need to support KDE, `gconf2` and `gconf-service` should be removed as it's no longer used [by GNOME](https://packages.debian.org/bullseye/gconf2).\n */\n readonly depends?: Array<string> | null\n\n /**\n * The [recommended package dependencies](https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps)..\n */\n readonly recommends?: Array<string> | null\n\n /**\n * The [package category](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section).\n */\n readonly packageCategory?: string | null\n\n /**\n * The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute.\n */\n readonly priority?: string | null\n}\n\nexport interface AppImageOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.\n */\n readonly license?: string | null\n}\n\nexport interface FlatpakOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.\n */\n readonly license?: string | null\n\n /**\n * The name of the runtime that the application uses. Defaults to `org.freedesktop.Platform`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly runtime?: string\n\n /**\n * The version of the runtime that the application uses. Defaults to `20.08`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly runtimeVersion?: string\n\n /**\n * The name of the development runtime that the application builds with. Defaults to `org.freedesktop.Sdk`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly sdk?: string\n\n /**\n * Start with the files from the specified application. This can be used to create applications that extend another application.\n * Defaults to [org.electronjs.Electron2.BaseApp](https://github.com/flathub/org.electronjs.Electron2.BaseApp).\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly base?: string\n\n /**\n * Use this specific version of the application specified in base. Defaults to `20.08`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly baseVersion?: string\n\n /**\n * The branch to use when exporting the application. Defaults to `master`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly branch?: string\n\n /**\n * An array of arguments passed to the flatpak build-finish command. Defaults to:\n * ```json\n * [\n * // Wayland/X11 Rendering\n * \"--socket=wayland\",\n * \"--socket=x11\",\n * \"--share=ipc\",\n * // Open GL\n * \"--device=dri\",\n * // Audio output\n * \"--socket=pulseaudio\",\n * // Read/write home directory access\n * \"--filesystem=home\",\n * // Allow communication with network\n * \"--share=network\",\n * // System notifications with libnotify\n * \"--talk-name=org.freedesktop.Notifications\",\n * ]\n * ```\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly finishArgs?: string[]\n\n /**\n * An array of objects specifying the modules to be built in order.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly modules?: (string | any)[]\n\n /**\n * Files to copy directly into the app. Should be a list of [source, dest] tuples. Source should be a relative/absolute path to a file/directory to copy into the flatpak, and dest should be the path inside the app install prefix (e.g. /share/applications/).\n *\n * See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).\n */\n readonly files?: [string, string][]\n\n /**\n * Symlinks to create in the app files. Should be a list of [target, location] symlink tuples. Target can be either a relative or absolute path inside the app install prefix, and location should be a absolute path inside the prefix to create the symlink at.\n *\n * See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).\n */\n readonly symlinks?: [string, string][]\n\n /**\n * Whether to enable the Wayland specific flags (`--enable-features=UseOzonePlatform --ozone-platform=wayland`) in the wrapper script. These flags are only available starting with Electron version 12. Defaults to `false`.\n */\n readonly useWaylandFlags?: boolean\n}\n"]}
|
package/out/targets/FpmTarget.js
CHANGED
|
@@ -232,7 +232,7 @@ class FpmTarget extends core_1.Target {
|
|
|
232
232
|
await packager.info.callArtifactBuildCompleted(info);
|
|
233
233
|
}
|
|
234
234
|
supportsAutoUpdate(target) {
|
|
235
|
-
return ["deb", "rpm"].includes(target);
|
|
235
|
+
return ["deb", "rpm", "pacman"].includes(target);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
exports.default = FpmTarget;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FpmTarget.js","sourceRoot":"","sources":["../../src/targets/FpmTarget.ts"],"names":[],"mappings":";;AAAA,+CAAoI;AACpI,+CAA6C;AAC7C,uCAA2C;AAC3C,0CAA6C;AAC7C,6BAA4B;AAC5B,wCAAoC;AACpC,kCAAgC;AAChC,kDAAiD;AAGjD,mDAAiD;AACjD,qDAAgD;AAChD,uDAAoD;AACpD,qDAAqD;AACrD,2DAAsE;AACtE,mCAA2C;AAC3C,uCAAuC;AAEvC,8DAA4E;AAC5E,+CAAyC;AASzC,MAAqB,SAAU,SAAQ,aAAM;IAK3C,YACE,IAAY,EACK,QAAuB,EACvB,MAAyB,EACjC,MAAc;QAEvB,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QAJD,aAAQ,GAAR,QAAQ,CAAe;QACvB,WAAM,GAAN,MAAM,CAAmB;QACjC,WAAM,GAAN,MAAM,CAAQ;QARhB,YAAO,GAA+B,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,GAAI,IAAI,CAAC,QAAQ,CAAC,MAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA;QAY3I,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;IACzC,CAAC;IAEO,KAAK,CAAC,aAAa;QACzB,MAAM,mBAAmB,GAAG,IAAA,6BAAe,EAAC,OAAO,CAAC,CAAA;QAEpD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,MAAM,eAAe,GAAG;YACtB,wBAAwB;YACxB,UAAU,EAAE,QAAQ,CAAC,cAAc;YACnC,oBAAoB,EAA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EAAE,EAAE;QACrI,kBAAG,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAA;QACvE,OAAO,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;IACnC,CAAC,CAAC,CAAA;IAEF,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IAC5F,MAAM,IAAA,qBAAU,EAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACpC,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import { Arch, executeAppBuilder, getArchSuffix, log, TmpDir, toLinuxArchString, use, serializeToYaml, asArray } from \"builder-util\"\nimport { unlinkIfExists } from \"builder-util\"\nimport { outputFile, stat } from \"fs-extra\"\nimport { mkdir, readFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { smarten } from \"../appInfo\"\nimport { Target } from \"../core\"\nimport * as errorMessages from \"../errorMessages\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { DebOptions, LinuxTargetSpecificOptions } from \"../options/linuxOptions\"\nimport { objectToArgs } from \"../util/appBuilder\"\nimport { computeEnv } from \"../util/bundledTool\"\nimport { isMacOsSierra } from \"../util/macosVersion\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { installPrefix, LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { getLinuxToolsPath } from \"./tools\"\nimport { hashFile } from \"../util/hash\"\nimport { ArtifactCreated } from \"../packagerApi\"\nimport { getAppUpdatePublishConfiguration } from \"../publish/PublishManager\"\nimport { getPath7za } from \"builder-util\"\n\ninterface FpmOptions {\n name: string\n maintainer: string | undefined\n vendor: string\n url: string\n}\n\nexport default class FpmTarget extends Target {\n readonly options: LinuxTargetSpecificOptions = { ...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name] }\n\n private readonly scriptFiles: Promise<Array<string>>\n\n constructor(\n name: string,\n private readonly packager: LinuxPackager,\n private readonly helper: LinuxTargetHelper,\n readonly outDir: string\n ) {\n super(name, false)\n\n this.scriptFiles = this.createScripts()\n }\n\n private async createScripts(): Promise<Array<string>> {\n const defaultTemplatesDir = getTemplatePath(\"linux\")\n\n const packager = this.packager\n const templateOptions = {\n // old API compatibility\n executable: packager.executableName,\n sanitizedProductName: packager.appInfo.sanitizedProductName,\n productFilename: packager.appInfo.productFilename,\n ...packager.platformSpecificBuildOptions,\n }\n\n function getResource(value: string | null | undefined, defaultFile: string) {\n if (value == null) {\n return path.join(defaultTemplatesDir, defaultFile)\n }\n return path.resolve(packager.projectDir, value)\n }\n\n return await Promise.all<string>([\n writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterInstall, \"after-install.tpl\"), templateOptions),\n writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterRemove, \"after-remove.tpl\"), templateOptions),\n ])\n }\n\n checkOptions(): Promise<any> {\n return this.computeFpmMetaInfoOptions()\n }\n\n private async computeFpmMetaInfoOptions(): Promise<FpmOptions> {\n const packager = this.packager\n const projectUrl = await packager.appInfo.computePackageUrl()\n const errors: Array<string> = []\n if (projectUrl == null) {\n errors.push(\"Please specify project homepage, see https://electron.build./configuration.md#Metadata-homepage\")\n }\n\n const options = this.options\n let author = options.maintainer\n if (author == null) {\n const a = packager.info.metadata.author\n if (a == null || a.email == null) {\n errors.push(errorMessages.authorEmailIsMissed)\n } else {\n author = `${a.name} <${a.email}>`\n }\n }\n\n if (errors.length > 0) {\n throw new Error(errors.join(\"\\n\\n\"))\n }\n\n return {\n name: options.packageName ?? this.packager.appInfo.linuxPackageName,\n maintainer: author!,\n url: projectUrl!,\n vendor: options.vendor || author!,\n }\n }\n\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const target = this.name\n\n // tslint:disable:no-invalid-template-strings\n let nameFormat = \"${name}-${version}-${arch}.${ext}\"\n let isUseArchIfX64 = false\n if (target === \"deb\") {\n nameFormat = \"${name}_${version}_${arch}.${ext}\"\n isUseArchIfX64 = true\n } else if (target === \"rpm\") {\n nameFormat = \"${name}-${version}.${arch}.${ext}\"\n isUseArchIfX64 = true\n }\n\n const packager = this.packager\n const artifactName = packager.expandArtifactNamePattern(this.options, target, arch, nameFormat, !isUseArchIfX64)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: target,\n file: artifactPath,\n arch,\n })\n\n await unlinkIfExists(artifactPath)\n if (packager.packagerOptions.prepackaged != null) {\n await mkdir(this.outDir, { recursive: true })\n }\n\n const publishConfig = this.supportsAutoUpdate(target)\n ? await getAppUpdatePublishConfiguration(packager, arch, false /* in any case validation will be done on publish */)\n : null\n if (publishConfig != null) {\n const linuxDistType = this.packager.packagerOptions.prepackaged || path.join(this.outDir, `linux${getArchSuffix(arch)}-unpacked`)\n const resourceDir = packager.getResourcesDir(linuxDistType)\n log.info({ resourceDir: log.filePath(resourceDir) }, `adding autoupdate files for: ${target}. (Beta feature)`)\n await outputFile(path.join(resourceDir, \"app-update.yml\"), serializeToYaml(publishConfig))\n // Extra file needed for auto-updater to detect installation method\n await outputFile(path.join(resourceDir, \"package-type\"), target)\n }\n\n const scripts = await this.scriptFiles\n const appInfo = packager.appInfo\n const options = this.options\n const synopsis = options.synopsis\n const args = [\n \"--architecture\",\n toLinuxArchString(arch, target),\n \"--after-install\",\n scripts[0],\n \"--after-remove\",\n scripts[1],\n \"--description\",\n smarten(target === \"rpm\" ? this.helper.getDescription(options) : `${synopsis || \"\"}\\n ${this.helper.getDescription(options)}`),\n \"--version\",\n this.helper.getSanitizedVersion(target),\n \"--package\",\n artifactPath,\n ]\n\n objectToArgs(args, (await this.computeFpmMetaInfoOptions()) as any)\n\n const packageCategory = options.packageCategory\n if (packageCategory != null) {\n args.push(\"--category\", packageCategory)\n }\n\n if (target === \"deb\") {\n args.push(\"--deb-priority\", (options as DebOptions).priority ?? \"optional\")\n } else if (target === \"rpm\") {\n if (synopsis != null) {\n args.push(\"--rpm-summary\", smarten(synopsis))\n }\n }\n\n const fpmConfiguration: FpmConfiguration = {\n args,\n target,\n }\n\n if (options.compression != null) {\n fpmConfiguration.compression = options.compression\n }\n\n // noinspection JSDeprecatedSymbols\n const depends = options.depends\n if (depends != null) {\n if (Array.isArray(depends)) {\n fpmConfiguration.customDepends = depends\n } else {\n // noinspection SuspiciousTypeOfGuard\n if (typeof depends === \"string\") {\n fpmConfiguration.customDepends = [depends as string]\n } else {\n throw new Error(`depends must be Array or String, but specified as: ${depends}`)\n }\n }\n }\n\n if (target === \"deb\") {\n const recommends = (options as DebOptions).recommends\n if (recommends) {\n fpmConfiguration.customRecommends = asArray(recommends)\n }\n }\n\n use(packager.info.metadata.license, it => args.push(\"--license\", it))\n use(appInfo.buildNumber, it =>\n args.push(\n \"--iteration\",\n // dashes are not supported for iteration in older versions of fpm\n // https://github.com/jordansissel/fpm/issues/1833\n it.split(\"-\").join(\"_\")\n )\n )\n\n use(options.fpm, it => args.push(...it))\n\n args.push(`${appOutDir}/=${installPrefix}/${appInfo.sanitizedProductName}`)\n for (const icon of await this.helper.icons) {\n const extWithDot = path.extname(icon.file)\n const sizeName = extWithDot === \".svg\" ? \"scalable\" : `${icon.size}x${icon.size}`\n args.push(`${icon.file}=/usr/share/icons/hicolor/${sizeName}/apps/${packager.executableName}${extWithDot}`)\n }\n\n const mimeTypeFilePath = await this.helper.mimeTypeFiles\n if (mimeTypeFilePath != null) {\n args.push(`${mimeTypeFilePath}=/usr/share/mime/packages/${packager.executableName}.xml`)\n }\n\n const desktopFilePath = await this.helper.writeDesktopEntry(this.options)\n args.push(`${desktopFilePath}=/usr/share/applications/${packager.executableName}.desktop`)\n\n if (packager.packagerOptions.effectiveOptionComputed != null && (await packager.packagerOptions.effectiveOptionComputed([args, desktopFilePath]))) {\n return\n }\n\n const env = {\n ...process.env,\n SZA_PATH: await getPath7za(),\n SZA_COMPRESSION_LEVEL: packager.compression === \"store\" ? \"0\" : \"9\",\n }\n\n // rpmbuild wants directory rpm with some default config files. Even if we can use dylibbundler, path to such config files are not changed (we need to replace in the binary)\n // so, for now, brew install rpm is still required.\n if (target !== \"rpm\" && (await isMacOsSierra())) {\n const linuxToolsPath = await getLinuxToolsPath()\n Object.assign(env, {\n PATH: computeEnv(process.env.PATH, [path.join(linuxToolsPath, \"bin\")]),\n DYLD_LIBRARY_PATH: computeEnv(process.env.DYLD_LIBRARY_PATH, [path.join(linuxToolsPath, \"lib\")]),\n })\n }\n\n await executeAppBuilder([\"fpm\", \"--configuration\", JSON.stringify(fpmConfiguration)], undefined, { env })\n\n let info: ArtifactCreated = {\n file: artifactPath,\n target: this,\n arch,\n packager,\n }\n if (publishConfig != null) {\n info = {\n ...info,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, target, arch, !isUseArchIfX64),\n isWriteUpdateInfo: true,\n updateInfo: {\n sha512: await hashFile(artifactPath),\n size: (await stat(artifactPath)).size,\n },\n }\n }\n await packager.info.callArtifactBuildCompleted(info)\n }\n\n private supportsAutoUpdate(target: string) {\n return [\"deb\", \"rpm\"].includes(target)\n }\n}\n\ninterface FpmConfiguration {\n target: string\n args: Array<string>\n customDepends?: Array<string>\n customRecommends?: Array<string>\n compression?: string | null\n}\n\nasync function writeConfigFile(tmpDir: TmpDir, templatePath: string, options: any): Promise<string> {\n //noinspection JSUnusedLocalSymbols\n function replacer(match: string, p1: string) {\n if (p1 in options) {\n return options[p1]\n } else {\n throw new Error(`Macro ${p1} is not defined`)\n }\n }\n const config = (await readFile(templatePath, \"utf8\")).replace(/\\${([a-zA-Z]+)}/g, replacer).replace(/<%=([a-zA-Z]+)%>/g, (match, p1) => {\n log.warn(\"<%= varName %> is deprecated, please use ${varName} instead\")\n return replacer(match, p1.trim())\n })\n\n const outputPath = await tmpDir.getTempFile({ suffix: path.basename(templatePath, \".tpl\") })\n await outputFile(outputPath, config)\n return outputPath\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FpmTarget.js","sourceRoot":"","sources":["../../src/targets/F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AAQ,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IAC5F,MAAM,IAAA,qBAAU,EAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACpC,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import { Arch, executeAppBuilder, getArchSuffix, log, TmpDir, toLinuxArchString, use, serializeToYaml, asArray } from \"builder-util\"\nimport { unlinkIfExists } from \"builder-util\"\nimport { outputFile, stat } from \"fs-extra\"\nimport { mkdir, readFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { smarten } from \"../appInfo\"\nimport { Target } from \"../core\"\nimport * as errorMessages from \"../errorMessages\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { DebOptions, LinuxTargetSpecificOptions } from \"../options/linuxOptions\"\nimport { objectToArgs } from \"../util/appBuilder\"\nimport { computeEnv } from \"../util/bundledTool\"\nimport { isMacOsSierra } from \"../util/macosVersion\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { installPrefix, LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { getLinuxToolsPath } from \"./tools\"\nimport { hashFile } from \"../util/hash\"\nimport { ArtifactCreated } from \"../packagerApi\"\nimport { getAppUpdatePublishConfiguration } from \"../publish/PublishManager\"\nimport { getPath7za } from \"builder-util\"\n\ninterface FpmOptions {\n name: string\n maintainer: string | undefined\n vendor: string\n url: string\n}\n\nexport default class FpmTarget extends Target {\n readonly options: LinuxTargetSpecificOptions = { ...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name] }\n\n private readonly scriptFiles: Promise<Array<string>>\n\n constructor(\n name: string,\n private readonly packager: LinuxPackager,\n private readonly helper: LinuxTargetHelper,\n readonly outDir: string\n ) {\n super(name, false)\n\n this.scriptFiles = this.createScripts()\n }\n\n private async createScripts(): Promise<Array<string>> {\n const defaultTemplatesDir = getTemplatePath(\"linux\")\n\n const packager = this.packager\n const templateOptions = {\n // old API compatibility\n executable: packager.executableName,\n sanitizedProductName: packager.appInfo.sanitizedProductName,\n productFilename: packager.appInfo.productFilename,\n ...packager.platformSpecificBuildOptions,\n }\n\n function getResource(value: string | null | undefined, defaultFile: string) {\n if (value == null) {\n return path.join(defaultTemplatesDir, defaultFile)\n }\n return path.resolve(packager.projectDir, value)\n }\n\n return await Promise.all<string>([\n writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterInstall, \"after-install.tpl\"), templateOptions),\n writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterRemove, \"after-remove.tpl\"), templateOptions),\n ])\n }\n\n checkOptions(): Promise<any> {\n return this.computeFpmMetaInfoOptions()\n }\n\n private async computeFpmMetaInfoOptions(): Promise<FpmOptions> {\n const packager = this.packager\n const projectUrl = await packager.appInfo.computePackageUrl()\n const errors: Array<string> = []\n if (projectUrl == null) {\n errors.push(\"Please specify project homepage, see https://electron.build./configuration.md#Metadata-homepage\")\n }\n\n const options = this.options\n let author = options.maintainer\n if (author == null) {\n const a = packager.info.metadata.author\n if (a == null || a.email == null) {\n errors.push(errorMessages.authorEmailIsMissed)\n } else {\n author = `${a.name} <${a.email}>`\n }\n }\n\n if (errors.length > 0) {\n throw new Error(errors.join(\"\\n\\n\"))\n }\n\n return {\n name: options.packageName ?? this.packager.appInfo.linuxPackageName,\n maintainer: author!,\n url: projectUrl!,\n vendor: options.vendor || author!,\n }\n }\n\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const target = this.name\n\n // tslint:disable:no-invalid-template-strings\n let nameFormat = \"${name}-${version}-${arch}.${ext}\"\n let isUseArchIfX64 = false\n if (target === \"deb\") {\n nameFormat = \"${name}_${version}_${arch}.${ext}\"\n isUseArchIfX64 = true\n } else if (target === \"rpm\") {\n nameFormat = \"${name}-${version}.${arch}.${ext}\"\n isUseArchIfX64 = true\n }\n\n const packager = this.packager\n const artifactName = packager.expandArtifactNamePattern(this.options, target, arch, nameFormat, !isUseArchIfX64)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: target,\n file: artifactPath,\n arch,\n })\n\n await unlinkIfExists(artifactPath)\n if (packager.packagerOptions.prepackaged != null) {\n await mkdir(this.outDir, { recursive: true })\n }\n\n const publishConfig = this.supportsAutoUpdate(target)\n ? await getAppUpdatePublishConfiguration(packager, arch, false /* in any case validation will be done on publish */)\n : null\n if (publishConfig != null) {\n const linuxDistType = this.packager.packagerOptions.prepackaged || path.join(this.outDir, `linux${getArchSuffix(arch)}-unpacked`)\n const resourceDir = packager.getResourcesDir(linuxDistType)\n log.info({ resourceDir: log.filePath(resourceDir) }, `adding autoupdate files for: ${target}. (Beta feature)`)\n await outputFile(path.join(resourceDir, \"app-update.yml\"), serializeToYaml(publishConfig))\n // Extra file needed for auto-updater to detect installation method\n await outputFile(path.join(resourceDir, \"package-type\"), target)\n }\n\n const scripts = await this.scriptFiles\n const appInfo = packager.appInfo\n const options = this.options\n const synopsis = options.synopsis\n const args = [\n \"--architecture\",\n toLinuxArchString(arch, target),\n \"--after-install\",\n scripts[0],\n \"--after-remove\",\n scripts[1],\n \"--description\",\n smarten(target === \"rpm\" ? this.helper.getDescription(options) : `${synopsis || \"\"}\\n ${this.helper.getDescription(options)}`),\n \"--version\",\n this.helper.getSanitizedVersion(target),\n \"--package\",\n artifactPath,\n ]\n\n objectToArgs(args, (await this.computeFpmMetaInfoOptions()) as any)\n\n const packageCategory = options.packageCategory\n if (packageCategory != null) {\n args.push(\"--category\", packageCategory)\n }\n\n if (target === \"deb\") {\n args.push(\"--deb-priority\", (options as DebOptions).priority ?? \"optional\")\n } else if (target === \"rpm\") {\n if (synopsis != null) {\n args.push(\"--rpm-summary\", smarten(synopsis))\n }\n }\n\n const fpmConfiguration: FpmConfiguration = {\n args,\n target,\n }\n\n if (options.compression != null) {\n fpmConfiguration.compression = options.compression\n }\n\n // noinspection JSDeprecatedSymbols\n const depends = options.depends\n if (depends != null) {\n if (Array.isArray(depends)) {\n fpmConfiguration.customDepends = depends\n } else {\n // noinspection SuspiciousTypeOfGuard\n if (typeof depends === \"string\") {\n fpmConfiguration.customDepends = [depends as string]\n } else {\n throw new Error(`depends must be Array or String, but specified as: ${depends}`)\n }\n }\n }\n\n if (target === \"deb\") {\n const recommends = (options as DebOptions).recommends\n if (recommends) {\n fpmConfiguration.customRecommends = asArray(recommends)\n }\n }\n\n use(packager.info.metadata.license, it => args.push(\"--license\", it))\n use(appInfo.buildNumber, it =>\n args.push(\n \"--iteration\",\n // dashes are not supported for iteration in older versions of fpm\n // https://github.com/jordansissel/fpm/issues/1833\n it.split(\"-\").join(\"_\")\n )\n )\n\n use(options.fpm, it => args.push(...it))\n\n args.push(`${appOutDir}/=${installPrefix}/${appInfo.sanitizedProductName}`)\n for (const icon of await this.helper.icons) {\n const extWithDot = path.extname(icon.file)\n const sizeName = extWithDot === \".svg\" ? \"scalable\" : `${icon.size}x${icon.size}`\n args.push(`${icon.file}=/usr/share/icons/hicolor/${sizeName}/apps/${packager.executableName}${extWithDot}`)\n }\n\n const mimeTypeFilePath = await this.helper.mimeTypeFiles\n if (mimeTypeFilePath != null) {\n args.push(`${mimeTypeFilePath}=/usr/share/mime/packages/${packager.executableName}.xml`)\n }\n\n const desktopFilePath = await this.helper.writeDesktopEntry(this.options)\n args.push(`${desktopFilePath}=/usr/share/applications/${packager.executableName}.desktop`)\n\n if (packager.packagerOptions.effectiveOptionComputed != null && (await packager.packagerOptions.effectiveOptionComputed([args, desktopFilePath]))) {\n return\n }\n\n const env = {\n ...process.env,\n SZA_PATH: await getPath7za(),\n SZA_COMPRESSION_LEVEL: packager.compression === \"store\" ? \"0\" : \"9\",\n }\n\n // rpmbuild wants directory rpm with some default config files. Even if we can use dylibbundler, path to such config files are not changed (we need to replace in the binary)\n // so, for now, brew install rpm is still required.\n if (target !== \"rpm\" && (await isMacOsSierra())) {\n const linuxToolsPath = await getLinuxToolsPath()\n Object.assign(env, {\n PATH: computeEnv(process.env.PATH, [path.join(linuxToolsPath, \"bin\")]),\n DYLD_LIBRARY_PATH: computeEnv(process.env.DYLD_LIBRARY_PATH, [path.join(linuxToolsPath, \"lib\")]),\n })\n }\n\n await executeAppBuilder([\"fpm\", \"--configuration\", JSON.stringify(fpmConfiguration)], undefined, { env })\n\n let info: ArtifactCreated = {\n file: artifactPath,\n target: this,\n arch,\n packager,\n }\n if (publishConfig != null) {\n info = {\n ...info,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, target, arch, !isUseArchIfX64),\n isWriteUpdateInfo: true,\n updateInfo: {\n sha512: await hashFile(artifactPath),\n size: (await stat(artifactPath)).size,\n },\n }\n }\n await packager.info.callArtifactBuildCompleted(info)\n }\n\n private supportsAutoUpdate(target: string) {\n return [\"deb\", \"rpm\", \"pacman\"].includes(target)\n }\n}\n\ninterface FpmConfiguration {\n target: string\n args: Array<string>\n customDepends?: Array<string>\n customRecommends?: Array<string>\n compression?: string | null\n}\n\nasync function writeConfigFile(tmpDir: TmpDir, templatePath: string, options: any): Promise<string> {\n //noinspection JSUnusedLocalSymbols\n function replacer(match: string, p1: string) {\n if (p1 in options) {\n return options[p1]\n } else {\n throw new Error(`Macro ${p1} is not defined`)\n }\n }\n const config = (await readFile(templatePath, \"utf8\")).replace(/\\${([a-zA-Z]+)}/g, replacer).replace(/<%=([a-zA-Z]+)%>/g, (match, p1) => {\n log.warn(\"<%= varName %> is deprecated, please use ${varName} instead\")\n return replacer(match, p1.trim())\n })\n\n const outputPath = await tmpDir.getTempFile({ suffix: path.basename(templatePath, \".tpl\") })\n await outputFile(outputPath, config)\n return outputPath\n}\n"]}
|
|
@@ -78,11 +78,12 @@ class LinuxTargetHelper {
|
|
|
78
78
|
return file;
|
|
79
79
|
}
|
|
80
80
|
computeDesktopEntry(targetSpecificOptions, exec, extra) {
|
|
81
|
+
var _a, _b, _c, _d, _e, _f;
|
|
81
82
|
if (exec != null && exec.length === 0) {
|
|
82
83
|
throw new Error("Specified exec is empty");
|
|
83
84
|
}
|
|
84
85
|
// https://github.com/electron-userland/electron-builder/issues/3418
|
|
85
|
-
if (targetSpecificOptions.desktop
|
|
86
|
+
if ((_b = (_a = targetSpecificOptions.desktop) === null || _a === void 0 ? void 0 : _a.entry) === null || _b === void 0 ? void 0 : _b.Exec) {
|
|
86
87
|
throw new Error("Please specify executable name as linux.executableName instead of linux.desktop.Exec");
|
|
87
88
|
}
|
|
88
89
|
const packager = this.packager;
|
|
@@ -116,7 +117,7 @@ class LinuxTargetHelper {
|
|
|
116
117
|
// https://github.com/electron/electron/blob/2-0-x/atom/browser/native_window_views.cc#L226
|
|
117
118
|
StartupWMClass: appInfo.productName,
|
|
118
119
|
...extra,
|
|
119
|
-
...targetSpecificOptions.desktop,
|
|
120
|
+
...((_d = (_c = targetSpecificOptions.desktop) === null || _c === void 0 ? void 0 : _c.entry) !== null && _d !== void 0 ? _d : {}),
|
|
120
121
|
};
|
|
121
122
|
const description = this.getDescription(targetSpecificOptions);
|
|
122
123
|
if (!(0, builder_util_1.isEmptyOrSpaces)(description)) {
|
|
@@ -160,6 +161,17 @@ class LinuxTargetHelper {
|
|
|
160
161
|
data += `\n${name}=${desktopMeta[name]}`;
|
|
161
162
|
}
|
|
162
163
|
data += "\n";
|
|
164
|
+
const desktopActions = (_f = (_e = targetSpecificOptions.desktop) === null || _e === void 0 ? void 0 : _e.desktopActions) !== null && _f !== void 0 ? _f : {};
|
|
165
|
+
for (const [actionName, config] of Object.entries(desktopActions)) {
|
|
166
|
+
if (!Object.keys(config !== null && config !== void 0 ? config : {}).length) {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
data += `\n[Desktop Action ${actionName}]`;
|
|
170
|
+
for (const [key, value] of Object.entries(config !== null && config !== void 0 ? config : {})) {
|
|
171
|
+
data += `\n${key}=${value}`;
|
|
172
|
+
}
|
|
173
|
+
data += "\n";
|
|
174
|
+
}
|
|
163
175
|
return Promise.resolve(data);
|
|
164
176
|
}
|
|
165
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinuxTargetHelper.js","sourceRoot":"","sources":["../../src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nimport { Lazy } from \"lazy-val\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { LinuxTargetSpecificOptions } from \"../options/linuxOptions\"\nimport { IconInfo } from \"../platformPackager\"\nimport { join } from \"path\"\n\nexport const installPrefix = \"/opt\"\n\nexport class LinuxTargetHelper {\n private readonly iconPromise = new Lazy(() => this.computeDesktopIcons())\n\n private readonly mimeTypeFilesPromise = new Lazy(() => this.computeMimeTypeFiles())\n\n maxIconPath: string | null = null\n\n constructor(private packager: LinuxPackager) {}\n\n get icons(): Promise<Array<IconInfo>> {\n return this.iconPromise.value\n }\n\n get mimeTypeFiles(): Promise<string | null> {\n return this.mimeTypeFilesPromise.value\n }\n\n private async computeMimeTypeFiles(): Promise<string | null> {\n const items: Array<string> = []\n for (const fileAssociation of this.packager.fileAssociations) {\n if (!fileAssociation.mimeType) {\n continue\n }\n\n const data = `<mime-type type=\"${fileAssociation.mimeType}\">\n <glob pattern=\"*.${fileAssociation.ext}\"/>\n ${fileAssociation.description ? `<comment>${fileAssociation.description}</comment>` : \"\"}\n <icon name=\"x-office-document\" />\n</mime-type>`\n items.push(data)\n }\n\n if (items.length === 0) {\n return null\n }\n\n const file = await this.packager.getTempFile(\".xml\")\n await outputFile(\n file,\n '<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">\\n' + items.join(\"\\n\") + \"\\n</mime-info>\"\n )\n return file\n }\n\n // must be name without spaces and other special characters, but not product name used\n private async computeDesktopIcons(): Promise<Array<IconInfo>> {\n const packager = this.packager\n const { platformSpecificBuildOptions, config } = packager\n\n const sources = [platformSpecificBuildOptions.icon, config.mac?.icon ?? config.icon].filter(str => !!str) as string[]\n\n // If no explicit sources are defined, fallback to buildResources directory, then default framework icon\n let fallbackSources = [...asArray(packager.getDefaultFrameworkIcon())]\n const buildResources = config.directories?.buildResources\n if (buildResources && (await exists(join(buildResources, \"icons\")))) {\n fallbackSources = [buildResources, ...fallbackSources]\n }\n\n // need to put here and not as default because need to resolve image size\n const result = await packager.resolveIcon(sources, fallbackSources, \"set\")\n this.maxIconPath = result[result.length - 1].file\n return result\n }\n\n getDescription(options: LinuxTargetSpecificOptions) {\n return options.description || this.packager.appInfo.description\n }\n\n getSanitizedVersion(target: string) {\n const {\n appInfo: { version },\n } = this.packager\n switch (target) {\n case \"pacman\":\n return version.replace(/-/g, \"_\")\n case \"rpm\":\n case \"deb\":\n return version.replace(/-/g, \"~\")\n default:\n return version\n }\n }\n\n async writeDesktopEntry(targetSpecificOptions: LinuxTargetSpecificOptions, exec?: string, destination?: string | null, extra?: { [key: string]: string }): Promise<string> {\n const data = await this.computeDesktopEntry(targetSpecificOptions, exec, extra)\n const file = destination || (await this.packager.getTempFile(`${this.packager.appInfo.productFilename}.desktop`))\n await outputFile(file, data)\n return file\n }\n\n computeDesktopEntry(targetSpecificOptions: LinuxTargetSpecificOptions, exec?: string, extra?: { [key: string]: string }): Promise<string> {\n if (exec != null && exec.length === 0) {\n throw new Error(\"Specified exec is empty\")\n }\n // https://github.com/electron-userland/electron-builder/issues/3418\n if (targetSpecificOptions.desktop != null && targetSpecificOptions.desktop.Exec != null) {\n throw new Error(\"Please specify executable name as linux.executableName instead of linux.desktop.Exec\")\n }\n\n const packager = this.packager\n const appInfo = packager.appInfo\n\n const executableArgs = targetSpecificOptions.executableArgs\n if (exec == null) {\n exec = `${installPrefix}/${appInfo.sanitizedProductName}/${packager.executableName}`\n if (!/^[/0-9A-Za-z._-]+$/.test(exec)) {\n exec = `\"${exec}\"`\n }\n if (executableArgs) {\n exec += \" \"\n exec += executableArgs.join(\" \")\n }\n // https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables\n const execCodes = [\"%f\", \"%u\", \"%F\", \"%U\"]\n if (executableArgs == null || executableArgs.findIndex(arg => execCodes.includes(arg)) === -1) {\n exec += \" %U\"\n }\n }\n\n const desktopMeta: any = {\n Name: appInfo.productName,\n Exec: exec,\n Terminal: \"false\",\n Type: \"Application\",\n Icon: packager.executableName,\n // https://askubuntu.com/questions/367396/what-represent-the-startupwmclass-field-of-a-desktop-file\n // must be set to package.json name (because it is Electron set WM_CLASS)\n // to get WM_CLASS of running window: xprop WM_CLASS\n // StartupWMClass doesn't work for unicode\n // https://github.com/electron/electron/blob/2-0-x/atom/browser/native_window_views.cc#L226\n StartupWMClass: appInfo.productName,\n ...extra,\n ...targetSpecificOptions.desktop,\n }\n\n const description = this.getDescription(targetSpecificOptions)\n if (!isEmptyOrSpaces(description)) {\n desktopMeta.Comment = description\n }\n\n const mimeTypes: Array<string> = asArray(targetSpecificOptions.mimeTypes)\n for (const fileAssociation of packager.fileAssociations) {\n if (fileAssociation.mimeType != null) {\n mimeTypes.push(fileAssociation.mimeType)\n }\n }\n\n for (const protocol of asArray(packager.config.protocols).concat(asArray(packager.platformSpecificBuildOptions.protocols))) {\n for (const scheme of asArray(protocol.schemes)) {\n mimeTypes.push(`x-scheme-handler/${scheme}`)\n }\n }\n\n if (mimeTypes.length !== 0) {\n desktopMeta.MimeType = mimeTypes.join(\";\") + \";\"\n }\n\n let category = targetSpecificOptions.category\n if (isEmptyOrSpaces(category)) {\n const macCategory = (packager.config.mac || {}).category\n if (macCategory != null) {\n category = macToLinuxCategory[macCategory]\n }\n\n if (category == null) {\n // https://github.com/develar/onshape-desktop-shell/issues/48\n if (macCategory != null) {\n log.warn({ macCategory }, \"cannot map macOS category to Linux. If possible mapping is known for you, please file issue to add it.\")\n }\n log.warn(\n {\n reason: \"linux.category is not set and cannot map from macOS\",\n docs: \"https://www.electron.build/linux\",\n },\n 'application Linux category is set to default \"Utility\"'\n )\n category = \"Utility\"\n }\n }\n desktopMeta.Categories = `${category}${category.endsWith(\";\") ? \"\" : \";\"}`\n\n let data = `[Desktop Entry]`\n for (const name of Object.keys(desktopMeta)) {\n data += `\\n${name}=${desktopMeta[name]}`\n }\n data += \"\\n\"\n return Promise.resolve(data)\n }\n}\n\nconst macToLinuxCategory: any = {\n \"public.app-category.graphics-design\": \"Graphics\",\n \"public.app-category.developer-tools\": \"Development\",\n \"public.app-category.education\": \"Education\",\n \"public.app-category.games\": \"Game\",\n \"public.app-category.video\": \"Video;AudioVideo\",\n \"public.app-category.utilities\": \"Utility\",\n \"public.app-category.social-networking\": \"Network;Chat\",\n \"public.app-category.finance\": \"Office;Finance\",\n \"public.app-category.music\": \"Audio;AudioVideo\",\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LinuxTargetHelper.js","sourceRoot":"","sources":["../../src/targets/LinuxTargetHelper.ts"],"names":[],"mappings":";;;AAAA,+CAAoE;AACpE,uCAAqC;AACrC,uCAA+B;AAI/B,+BAA2B;AAEd,QAAA,aAAa,GAAG,MAAM,CAAA;AAEnC,MAAa,iBAAiB;IAO5B,YAAoB,QAAuB;QAAvB,aAAQ,GAAR,QAAQ,CAAe;QAN1B,gBAAW,GAAG,IAAI,eAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAA;QAExD,yBAAoB,GAAG,IAAI,eAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAA;QAEnF,gBAAW,GAAkB,IAAI,CAAA;IAEa,CAAC;IAE/C,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAA;IAC/B,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAA;IACxC,CAAC;IAEO,KAAK,CAAC,oBAAoB;QAChC,MAAM,KAAK,GAAkB,EAAE,CAAA;QAC/B,KAAK,MAAM,eAAe,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;YAC7D,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;gBAC9B,SAAQ;YACV,CAAC;YAED,MAAM,IAAI,GAAG,oBAAoB,eAAe,CAAC,QAAQ;qBAC1C,eAAe,CAAC,GAAG;MAClC,eAAe,CA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AAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;YAClE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;gBACtC,SAAQ;YACV,CAAC;YACD,IAAI,IAAI,qBAAqB,UAAU,GAAG,CAAA;YAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,EAAE,CAAC;gBACxD,IAAI,IAAI,KAAK,GAAG,IAAI,KAAK,EAAE,CAAA;YAC7B,CAAC;YACD,IAAI,IAAI,IAAI,CAAA;QACd,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B,CAAC;CACF;AAvMD,8CAuMC;AAED,MAAM,kBAAkB,GAAQ;IAC9B,qCAAqC,EAAE,UAAU;IACjD,qCAAqC,EAAE,aAAa;IACpD,+BAA+B,EAAE,WAAW;IAC5C,2BAA2B,EAAE,MAAM;IACnC,2BAA2B,EAAE,kBAAkB;IAC/C,+BAA+B,EAAE,SAAS;IAC1C,uCAAuC,EAAE,cAAc;IACvD,6BAA6B,EAAE,gBAAgB;IAC/C,2BAA2B,EAAE,kBAAkB;CAChD,CAAA","sourcesContent":["import { asArray, isEmptyOrSpaces, log, exists } from \"builder-util\"\nimport { outputFile } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { LinuxTargetSpecificOptions } from \"../options/linuxOptions\"\nimport { IconInfo } from \"../platformPackager\"\nimport { join } from \"path\"\n\nexport const installPrefix = \"/opt\"\n\nexport class LinuxTargetHelper {\n private readonly iconPromise = new Lazy(() => this.computeDesktopIcons())\n\n private readonly mimeTypeFilesPromise = new Lazy(() => this.computeMimeTypeFiles())\n\n maxIconPath: string | null = null\n\n constructor(private packager: LinuxPackager) {}\n\n get icons(): Promise<Array<IconInfo>> {\n return this.iconPromise.value\n }\n\n get mimeTypeFiles(): Promise<string | null> {\n return this.mimeTypeFilesPromise.value\n }\n\n private async computeMimeTypeFiles(): Promise<string | null> {\n const items: Array<string> = []\n for (const fileAssociation of this.packager.fileAssociations) {\n if (!fileAssociation.mimeType) {\n continue\n }\n\n const data = `<mime-type type=\"${fileAssociation.mimeType}\">\n <glob pattern=\"*.${fileAssociation.ext}\"/>\n ${fileAssociation.description ? `<comment>${fileAssociation.description}</comment>` : \"\"}\n <icon name=\"x-office-document\" />\n</mime-type>`\n items.push(data)\n }\n\n if (items.length === 0) {\n return null\n }\n\n const file = await this.packager.getTempFile(\".xml\")\n await outputFile(\n file,\n '<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">\\n' + items.join(\"\\n\") + \"\\n</mime-info>\"\n )\n return file\n }\n\n // must be name without spaces and other special characters, but not product name used\n private async computeDesktopIcons(): Promise<Array<IconInfo>> {\n const packager = this.packager\n const { platformSpecificBuildOptions, config } = packager\n\n const sources = [platformSpecificBuildOptions.icon, config.mac?.icon ?? config.icon].filter(str => !!str) as string[]\n\n // If no explicit sources are defined, fallback to buildResources directory, then default framework icon\n let fallbackSources = [...asArray(packager.getDefaultFrameworkIcon())]\n const buildResources = config.directories?.buildResources\n if (buildResources && (await exists(join(buildResources, \"icons\")))) {\n fallbackSources = [buildResources, ...fallbackSources]\n }\n\n // need to put here and not as default because need to resolve image size\n const result = await packager.resolveIcon(sources, fallbackSources, \"set\")\n this.maxIconPath = result[result.length - 1].file\n return result\n }\n\n getDescription(options: LinuxTargetSpecificOptions) {\n return options.description || this.packager.appInfo.description\n }\n\n getSanitizedVersion(target: string) {\n const {\n appInfo: { version },\n } = this.packager\n switch (target) {\n case \"pacman\":\n return version.replace(/-/g, \"_\")\n case \"rpm\":\n case \"deb\":\n return version.replace(/-/g, \"~\")\n default:\n return version\n }\n }\n\n async writeDesktopEntry(targetSpecificOptions: LinuxTargetSpecificOptions, exec?: string, destination?: string | null, extra?: { [key: string]: string }): Promise<string> {\n const data = await this.computeDesktopEntry(targetSpecificOptions, exec, extra)\n const file = destination || (await this.packager.getTempFile(`${this.packager.appInfo.productFilename}.desktop`))\n await outputFile(file, data)\n return file\n }\n\n computeDesktopEntry(targetSpecificOptions: LinuxTargetSpecificOptions, exec?: string, extra?: { [key: string]: string }): Promise<string> {\n if (exec != null && exec.length === 0) {\n throw new Error(\"Specified exec is empty\")\n }\n // https://github.com/electron-userland/electron-builder/issues/3418\n if (targetSpecificOptions.desktop?.entry?.Exec) {\n throw new Error(\"Please specify executable name as linux.executableName instead of linux.desktop.Exec\")\n }\n\n const packager = this.packager\n const appInfo = packager.appInfo\n\n const executableArgs = targetSpecificOptions.executableArgs\n if (exec == null) {\n exec = `${installPrefix}/${appInfo.sanitizedProductName}/${packager.executableName}`\n if (!/^[/0-9A-Za-z._-]+$/.test(exec)) {\n exec = `\"${exec}\"`\n }\n if (executableArgs) {\n exec += \" \"\n exec += executableArgs.join(\" \")\n }\n // https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables\n const execCodes = [\"%f\", \"%u\", \"%F\", \"%U\"]\n if (executableArgs == null || executableArgs.findIndex(arg => execCodes.includes(arg)) === -1) {\n exec += \" %U\"\n }\n }\n\n const desktopMeta: any = {\n Name: appInfo.productName,\n Exec: exec,\n Terminal: \"false\",\n Type: \"Application\",\n Icon: packager.executableName,\n // https://askubuntu.com/questions/367396/what-represent-the-startupwmclass-field-of-a-desktop-file\n // must be set to package.json name (because it is Electron set WM_CLASS)\n // to get WM_CLASS of running window: xprop WM_CLASS\n // StartupWMClass doesn't work for unicode\n // https://github.com/electron/electron/blob/2-0-x/atom/browser/native_window_views.cc#L226\n StartupWMClass: appInfo.productName,\n ...extra,\n ...(targetSpecificOptions.desktop?.entry ?? {}),\n }\n\n const description = this.getDescription(targetSpecificOptions)\n if (!isEmptyOrSpaces(description)) {\n desktopMeta.Comment = description\n }\n\n const mimeTypes: Array<string> = asArray(targetSpecificOptions.mimeTypes)\n for (const fileAssociation of packager.fileAssociations) {\n if (fileAssociation.mimeType != null) {\n mimeTypes.push(fileAssociation.mimeType)\n }\n }\n\n for (const protocol of asArray(packager.config.protocols).concat(asArray(packager.platformSpecificBuildOptions.protocols))) {\n for (const scheme of asArray(protocol.schemes)) {\n mimeTypes.push(`x-scheme-handler/${scheme}`)\n }\n }\n\n if (mimeTypes.length !== 0) {\n desktopMeta.MimeType = mimeTypes.join(\";\") + \";\"\n }\n\n let category = targetSpecificOptions.category\n if (isEmptyOrSpaces(category)) {\n const macCategory = (packager.config.mac || {}).category\n if (macCategory != null) {\n category = macToLinuxCategory[macCategory]\n }\n\n if (category == null) {\n // https://github.com/develar/onshape-desktop-shell/issues/48\n if (macCategory != null) {\n log.warn({ macCategory }, \"cannot map macOS category to Linux. If possible mapping is known for you, please file issue to add it.\")\n }\n log.warn(\n {\n reason: \"linux.category is not set and cannot map from macOS\",\n docs: \"https://www.electron.build/linux\",\n },\n 'application Linux category is set to default \"Utility\"'\n )\n category = \"Utility\"\n }\n }\n desktopMeta.Categories = `${category}${category.endsWith(\";\") ? \"\" : \";\"}`\n\n let data = `[Desktop Entry]`\n for (const name of Object.keys(desktopMeta)) {\n data += `\\n${name}=${desktopMeta[name]}`\n }\n data += \"\\n\"\n const desktopActions = targetSpecificOptions.desktop?.desktopActions ?? {}\n for (const [actionName, config] of Object.entries(desktopActions)) {\n if (!Object.keys(config ?? {}).length) {\n continue\n }\n data += `\\n[Desktop Action ${actionName}]`\n for (const [key, value] of Object.entries(config ?? {})) {\n data += `\\n${key}=${value}`\n }\n data += \"\\n\"\n }\n return Promise.resolve(data)\n }\n}\n\nconst macToLinuxCategory: any = {\n \"public.app-category.graphics-design\": \"Graphics\",\n \"public.app-category.developer-tools\": \"Development\",\n \"public.app-category.education\": \"Education\",\n \"public.app-category.games\": \"Game\",\n \"public.app-category.video\": \"Video;AudioVideo\",\n \"public.app-category.utilities\": \"Utility\",\n \"public.app-category.social-networking\": \"Network;Chat\",\n \"public.app-category.finance\": \"Office;Finance\",\n \"public.app-category.music\": \"Audio;AudioVideo\",\n}\n"]}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AppFileWalker = exports.FileCopyHelper = void 0;
|
|
4
4
|
const fs_extra_1 = require("fs-extra");
|
|
5
5
|
const path = require("path");
|
|
6
|
-
const nodeModulesSystemDependentSuffix = `${path.sep}node_modules`;
|
|
7
6
|
function addAllPatternIfNeed(matcher) {
|
|
8
7
|
if (!matcher.isSpecifiedAsEmptyArray && (matcher.isEmpty() || matcher.containsOnlyIgnore())) {
|
|
9
8
|
matcher.prependPattern("**/*");
|
|
@@ -49,19 +48,7 @@ function createAppFilter(matcher, packager) {
|
|
|
49
48
|
if (packager.areNodeModulesHandledExternally) {
|
|
50
49
|
return matcher.isEmpty() ? null : matcher.createFilter();
|
|
51
50
|
}
|
|
52
|
-
|
|
53
|
-
return !(fileStat.isDirectory() && file.endsWith(nodeModulesSystemDependentSuffix));
|
|
54
|
-
};
|
|
55
|
-
if (matcher.isEmpty()) {
|
|
56
|
-
return nodeModulesFilter;
|
|
57
|
-
}
|
|
58
|
-
const filter = matcher.createFilter();
|
|
59
|
-
return (file, fileStat) => {
|
|
60
|
-
if (!nodeModulesFilter(file, fileStat)) {
|
|
61
|
-
return !!packager.config.includeSubNodeModules;
|
|
62
|
-
}
|
|
63
|
-
return filter(file, fileStat);
|
|
64
|
-
};
|
|
51
|
+
return matcher.createFilter();
|
|
65
52
|
}
|
|
66
53
|
/** @internal */
|
|
67
54
|
class AppFileWalker extends FileCopyHelper {
|
|
@@ -73,18 +60,8 @@ class AppFileWalker extends FileCopyHelper {
|
|
|
73
60
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
74
61
|
consume(file, fileStat, parent, siblingNames) {
|
|
75
62
|
if (fileStat.isDirectory()) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// update: solution disabled, node module resolver should support such setup
|
|
79
|
-
if (file.endsWith(nodeModulesSystemDependentSuffix)) {
|
|
80
|
-
if (!this.packager.config.includeSubNodeModules) {
|
|
81
|
-
const matchesFilter = this.matcherFilter(file, fileStat);
|
|
82
|
-
if (!matchesFilter) {
|
|
83
|
-
// Skip the file
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
63
|
+
const matchesFilter = this.matcherFilter(file, fileStat);
|
|
64
|
+
return !matchesFilter;
|
|
88
65
|
}
|
|
89
66
|
else {
|
|
90
67
|
// save memory - no need to store stat for directory
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppFileWalker.js","sourceRoot":"","sources":["../../src/util/AppFileWalker.ts"],"names":[],"mappings":";;;AACA,uCAAgD;AAGhD,6BAA4B;AAE5B,
|
|
1
|
+
{"version":3,"file":"AppFileWalker.js","sourceRoot":"","sources":["../../src/util/AppFileWalker.ts"],"names":[],"mappings":";;;AACA,uCAAgD;AAGhD,6BAA4B;AAE5B,SAAS,mBAAmB,CAAC,OAAoB;IAC/C,IAAI,CAAC,OAAO,CAAC,uBAAuB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,EAAE,CAAC;QAC5F,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAsB,cAAc;IAGlC,YACqB,OAAoB,EAC9B,MAAqB,EACX,QAAkB;QAFlB,YAAO,GAAP,OAAO,CAAa;QAC9B,WAAM,GAAN,MAAM,CAAe;QACX,aAAQ,GAAR,QAAQ,CAAU;QAL9B,aAAQ,GAAG,IAAI,GAAG,EAAiB,CAAA;IAMzC,CAAC;IAEM,UAA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AAC;QAC7C,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,CAAA;IAC1D,CAAC;IACD,OAAO,OAAO,CAAC,YAAY,EAAE,CAAA;AAC/B,CAAC;AAED,gBAAgB;AAChB,MAAa,aAAc,SAAQ,cAAc;IAE/C,YAAY,OAAoB,EAAE,QAAkB;QAClD,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAA;QACjF,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,EAAE,CAAA;IAC7C,CAAC;IAED,qCAAqC;IACrC,6DAA6D;IAC7D,OAAO,CAAC,IAAY,EAAE,QAAe,EAAE,MAAc,EAAE,YAA2B;QAChF,IAAI,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;YAC3B,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;YACxD,OAAO,CAAC,aAAa,CAAA;QACvB,CAAC;aAAM,CAAC;YACN,oDAAoD;YACpD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;QACnC,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;IAChD,CAAC;CACF;AApBD,sCAoBC","sourcesContent":["import { Filter, FileConsumer } from \"builder-util\"\nimport { readlink, stat, Stats } from \"fs-extra\"\nimport { FileMatcher } from \"../fileMatcher\"\nimport { Packager } from \"../packager\"\nimport * as path from \"path\"\n\nfunction addAllPatternIfNeed(matcher: FileMatcher) {\n if (!matcher.isSpecifiedAsEmptyArray && (matcher.isEmpty() || matcher.containsOnlyIgnore())) {\n matcher.prependPattern(\"**/*\")\n }\n return matcher\n}\n\nexport abstract class FileCopyHelper {\n readonly metadata = new Map<string, Stats>()\n\n protected constructor(\n protected readonly matcher: FileMatcher,\n readonly filter: Filter | null,\n protected readonly packager: Packager\n ) {}\n\n protected handleFile(file: string, parent: string, fileStat: Stats): Promise<Stats | null> | null {\n if (!fileStat.isSymbolicLink()) {\n return null\n }\n\n return readlink(file).then((linkTarget): any => {\n // http://unix.stackexchange.com/questions/105637/is-symlinks-target-relative-to-the-destinations-parent-directory-and-if-so-wh\n return this.handleSymlink(fileStat, file, parent, linkTarget)\n })\n }\n\n private handleSymlink(fileStat: Stats, file: string, parent: string, linkTarget: string): Promise<Stats> | null {\n const resolvedLinkTarget = path.resolve(parent, linkTarget)\n const link = path.relative(this.matcher.from, resolvedLinkTarget)\n if (link.startsWith(\"..\")) {\n // outside of project, linked module (https://github.com/electron-userland/electron-builder/issues/675)\n return stat(resolvedLinkTarget).then(targetFileStat => {\n this.metadata.set(file, targetFileStat)\n return targetFileStat\n })\n } else {\n const s = fileStat as any\n s.relativeLink = link\n s.linkRelativeToFile = path.relative(parent, resolvedLinkTarget)\n }\n return null\n }\n}\n\nfunction createAppFilter(matcher: FileMatcher, packager: Packager): Filter | null {\n if (packager.areNodeModulesHandledExternally) {\n return matcher.isEmpty() ? null : matcher.createFilter()\n }\n return matcher.createFilter()\n}\n\n/** @internal */\nexport class AppFileWalker extends FileCopyHelper implements FileConsumer {\n readonly matcherFilter: any\n constructor(matcher: FileMatcher, packager: Packager) {\n super(addAllPatternIfNeed(matcher), createAppFilter(matcher, packager), packager)\n this.matcherFilter = matcher.createFilter()\n }\n\n // noinspection JSUnusedGlobalSymbols\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n consume(file: string, fileStat: Stats, parent: string, siblingNames: Array<string>): any {\n if (fileStat.isDirectory()) {\n const matchesFilter = this.matcherFilter(file, fileStat)\n return !matchesFilter\n } else {\n // save memory - no need to store stat for directory\n this.metadata.set(file, fileStat)\n }\n\n return this.handleFile(file, parent, fileStat)\n }\n}\n"]}
|
package/out/util/filter.js
CHANGED
|
@@ -48,7 +48,14 @@ function createFilter(src, patterns, excludePatterns) {
|
|
|
48
48
|
if (src === file) {
|
|
49
49
|
return true;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
let relative = getRelativePath(file, srcWithEndSlash);
|
|
52
|
+
// filter the root node_modules, but not a subnode_modules (like /appDir/others/foo/node_modules/blah)
|
|
53
|
+
if (relative === "node_modules") {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
else if (relative.endsWith("/node_modules")) {
|
|
57
|
+
relative += "/";
|
|
58
|
+
}
|
|
52
59
|
// https://github.com/electron-userland/electron-builder/issues/867
|
|
53
60
|
return minimatchAll(relative, patterns, stat) && (excludePatterns == null || stat.isDirectory() || !minimatchAll(relative, excludePatterns, stat));
|
|
54
61
|
};
|
package/out/util/filter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/util/filter.ts"],"names":[],"mappings":";;AAOA,4BAaC;AA6BD,
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/util/filter.ts"],"names":[],"mappings":";;AAOA,4BAaC;AA6BD,oCAmBC;AAjED,6BAA4B;AAC5B,wDAAyD;AAEzD,gBAAgB;AAChB,SAAgB,QAAQ,CAAC,OAAkB;IACzC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACvB,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,6JAA6J;AAC7J,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAO,CAAC,CAAC,MAAM,KAAK,CA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,IAAI,QAAQ,GAAG,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,CAAA;QAErD,sGAAsG;QACtG,IAAI,QAAQ,KAAK,cAAc,EAAE,CAAC;YAChC,OAAO,KAAK,CAAA;QACd,CAAC;aAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YAC9C,QAAQ,IAAI,GAAG,CAAA;QACjB,CAAC;QAED,mEAAmE;QACnE,OAAO,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC,CAAA;IACpJ,CAAC,CAAA;AACH,CAAC;AAED,gEAAgE;AAChE,SAAS,YAAY,CAAC,IAAY,EAAE,QAA0B,EAAE,IAAW;IACzE,IAAI,KAAK,GAAG,KAAK,CAAA;IACjB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,qDAAqD;QACrD,yDAAyD;QACzD,IAAI,KAAK,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;YAC7B,SAAQ;QACV,CAAC;QAED,qEAAqE;QACrE,oMAAoM;QACpM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACpE,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import { Filter } from \"builder-util\"\nimport { Stats } from \"fs-extra\"\nimport { Minimatch } from \"minimatch\"\nimport * as path from \"path\"\nimport { NODE_MODULES_PATTERN } from \"../fileTransformer\"\n\n/** @internal */\nexport function hasMagic(pattern: Minimatch) {\n const set = pattern.set\n if (set.length > 1) {\n return true\n }\n\n for (const i of set[0]) {\n if (typeof i !== \"string\") {\n return true\n }\n }\n\n return false\n}\n\n// sometimes, destination may not contain path separator in the end (path to folder), but the src does. So let's ensure paths have path separators in the end\nfunction ensureEndSlash(s: string) {\n return s.length === 0 || s.endsWith(path.sep) ? s : s + path.sep\n}\n\nfunction getRelativePath(file: string, srcWithEndSlash: string) {\n if (!file.startsWith(srcWithEndSlash)) {\n const index = file.indexOf(NODE_MODULES_PATTERN)\n if (index < 0) {\n throw new Error(`${file} must be under ${srcWithEndSlash}`)\n } else {\n return file.substring(index + 1 /* leading slash */)\n }\n }\n\n let relative = file.substring(srcWithEndSlash.length)\n if (path.sep === \"\\\\\") {\n if (relative.startsWith(\"\\\\\")) {\n // windows problem: double backslash, the above substring call removes root path with a single slash, so here can me some leftovers\n relative = relative.substring(1)\n }\n relative = relative.replace(/\\\\/g, \"/\")\n }\n return relative\n}\n\n/** @internal */\nexport function createFilter(src: string, patterns: Array<Minimatch>, excludePatterns?: Array<Minimatch> | null): Filter {\n const srcWithEndSlash = ensureEndSlash(src)\n return (file, stat) => {\n if (src === file) {\n return true\n }\n\n let relative = getRelativePath(file, srcWithEndSlash)\n\n // filter the root node_modules, but not a subnode_modules (like /appDir/others/foo/node_modules/blah)\n if (relative === \"node_modules\") {\n return false\n } else if (relative.endsWith(\"/node_modules\")) {\n relative += \"/\"\n }\n\n // https://github.com/electron-userland/electron-builder/issues/867\n return minimatchAll(relative, patterns, stat) && (excludePatterns == null || stat.isDirectory() || !minimatchAll(relative, excludePatterns, stat))\n }\n}\n\n// https://github.com/joshwnj/minimatch-all/blob/master/index.js\nfunction minimatchAll(path: string, patterns: Array<Minimatch>, stat: Stats): boolean {\n let match = false\n for (const pattern of patterns) {\n // If we've got a match, only re-test for exclusions.\n // if we don't have a match, only re-test for inclusions.\n if (match !== pattern.negate) {\n continue\n }\n\n // partial match — pattern: foo/bar.txt path: foo — we must allow foo\n // use it only for non-negate patterns: const m = new Minimatch(\"!node_modules/@(electron-download|electron)/**/*\", {dot: true }); m.match(\"node_modules\", true) will return false, but must be true\n match = pattern.match(path, stat.isDirectory() && !pattern.negate)\n }\n return match\n}\n"]}
|
package/out/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "
|
|
1
|
+
export declare const PACKAGE_VERSION = "26.0.0-alpha.0";
|
package/out/version.js
CHANGED
package/out/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,gBAAgB,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"26.0.0-alpha.0\"\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "app-builder-lib",
|
|
3
3
|
"description": "electron-builder lib",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "26.0.0-alpha.0",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"out",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"semver": "^7.3.8",
|
|
76
76
|
"tar": "^6.1.12",
|
|
77
77
|
"temp-file": "^3.4.0",
|
|
78
|
-
"builder-util": "
|
|
79
|
-
"
|
|
80
|
-
"
|
|
78
|
+
"builder-util": "26.0.0-alpha.0",
|
|
79
|
+
"builder-util-runtime": "9.2.10",
|
|
80
|
+
"electron-publish": "26.0.0-alpha.0"
|
|
81
81
|
},
|
|
82
82
|
"///": "babel in devDependencies for proton tests",
|
|
83
83
|
"devDependencies": {
|
|
@@ -108,12 +108,12 @@
|
|
|
108
108
|
"@types/semver": "7.3.8",
|
|
109
109
|
"@types/tar": "^6.1.3",
|
|
110
110
|
"toml": "^3.0.0",
|
|
111
|
-
"dmg-builder": "
|
|
112
|
-
"electron-builder-squirrel-windows": "
|
|
111
|
+
"dmg-builder": "26.0.0-alpha.0",
|
|
112
|
+
"electron-builder-squirrel-windows": "26.0.0-alpha.0"
|
|
113
113
|
},
|
|
114
114
|
"peerDependencies": {
|
|
115
|
-
"dmg-builder": "
|
|
116
|
-
"electron-builder-squirrel-windows": "
|
|
115
|
+
"dmg-builder": "26.0.0-alpha.0",
|
|
116
|
+
"electron-builder-squirrel-windows": "26.0.0-alpha.0"
|
|
117
117
|
},
|
|
118
118
|
"//": "electron-builder-squirrel-windows and dmg-builder added as dev dep for tests (as otherwise `require` doesn't work using Yarn 2)",
|
|
119
119
|
"typings": "./out/index.d.ts"
|