Skip to content

Instantly share code, notes, and snippets.

@davej
Created April 22, 2020 13:19
Show Gist options
  • Save davej/025b1736266b2fdae0b66bce9017a06e to your computer and use it in GitHub Desktop.
Save davej/025b1736266b2fdae0b66bce9017a06e to your computer and use it in GitHub Desktop.
Config for todesktop.json

Project configuration (todesktop.json)

This describes all of the possible configuration options ín your todesktop.json.

To avoid confusion, the following terms will be used throughout this file:

  • "Project root": this is the parent directory of your todesktop.json.

appId - (optional) string

Default: auto-generated.

Example: com.microsoft.word.

Your application ID. Omit this unless you know what you're doing. It's used as the CFBundleIdentifier for MacOS and as the Application User Model ID for Windows.

WARNING: if you have deployed an application with ToDesktop and would like to change this ID, talk to us first.

appPath - (optional) string

Default: ..

Example: ./dist.

This is the path to your Electron application directory. Omit this unless your project setup is complicated. This is the directory that the CLI uploads.

The path can be absolute or a relative path from the project root. The directory it points to must be a valid Electron application directory; i.e.:

  • It could be ran with the electron command; i.e. npx electron {{appPath}}.
  • It needs to contain a valid package.json.
  • The package.json must either have a main property pointing to a file in the directory or there must be an index.js at the root of the directory.

Side note: if your package.json contains a postinstall script which references scripts, these must be accessible within the appPath directory as only the appPath is uploaded to our servers.

appProtocolScheme - (optional) string

Default: no protocol scheme is registered.

Example: word.

If you want to register a protocol for your application (e.g. example://) and or support deeplinking, you will need to use this option. If your desired protocol is example://, you would set "appProtocolScheme": "example". NOTE: these features also require additional application logic.

extraResources - (optional) array of objects

Default: [].

Example:

[
  { "from": "./static/image.png" },
  { "from": "./static/anotherImage.png", "to": "images" },
  { "from": "./static", "to": "static" }
]

This option allows you to specifiy files to be copied into the application's resources directory (Contents/Resources for MacOS, resources for Linux and Windows).

Each item in the array must be an object, containing a from property which is a path to a file or directory. The path can be absolute or a relative path from the project root. The files specified must be inside your project root.

The to property is optional. Use it to specify a directory inside the resources directory to copy the file to.

In the example above, image.png would be copied to the root of the resources directory, whereas anotherImage.png would be copied to an images directory at the root of the resources directory. ./static would be copied to static/static in the resources directory.

icon - string

Example: ./appIcon.png.

The path to your application's desktop icon. It must be a PNG.

Note: to ensure the icon is never missing (e.g. this happens sometimes in Ubuntu), set the icon option when creating your BrowserWindows.

mac - (optional) object

Default: We have good default settings for Mac. Example: { "entitlements": "./entitlements.mac.plist".

This object contains some options that only apply to the building & releasing for MacOS.

mac.entitlements - (optional) string

Default: A sane minimal entitlements file we've put together. Example: ./entitlements.mac.plist.

The path to an entitlements file for signing your application. It must be a plist file.

productName - (optional) string

Default: the name field in your package.json is used.

Example: My Example App.

The name of your product / application. You should use this as it allows for spaces, capitalization, etc. unlike the package.json name field.

schemaVersion - number

Example: 1.

This is the todesktop.json schema version. This must be 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment